mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Less touchy bad tip detection, move tip model text over, at local debug options for atollic
This commit is contained in:
@@ -3478,48 +3478,7 @@ void HAL_I2C_EV_IRQHandler(I2C_HandleTypeDef *hi2c)
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Slave mode selected */
|
||||
else
|
||||
{
|
||||
/* ADDR set --------------------------------------------------------------*/
|
||||
if(((sr1itflags & I2C_FLAG_ADDR) != RESET) && ((itsources & I2C_IT_EVT) != RESET))
|
||||
{
|
||||
I2C_Slave_ADDR(hi2c);
|
||||
}
|
||||
/* STOPF set --------------------------------------------------------------*/
|
||||
else if(((sr1itflags & I2C_FLAG_STOPF) != RESET) && ((itsources & I2C_IT_EVT) != RESET))
|
||||
{
|
||||
I2C_Slave_STOPF(hi2c);
|
||||
}
|
||||
/* I2C in mode Transmitter -----------------------------------------------*/
|
||||
else if((sr2itflags & I2C_FLAG_TRA) != RESET)
|
||||
{
|
||||
/* TXE set and BTF reset -----------------------------------------------*/
|
||||
if(((sr1itflags & I2C_FLAG_TXE) != RESET) && ((itsources & I2C_IT_BUF) != RESET) && ((sr1itflags & I2C_FLAG_BTF) == RESET))
|
||||
{
|
||||
I2C_SlaveTransmit_TXE(hi2c);
|
||||
}
|
||||
/* BTF set -------------------------------------------------------------*/
|
||||
else if(((sr1itflags & I2C_FLAG_BTF) != RESET) && ((itsources & I2C_IT_EVT) != RESET))
|
||||
{
|
||||
I2C_SlaveTransmit_BTF(hi2c);
|
||||
}
|
||||
}
|
||||
/* I2C in mode Receiver --------------------------------------------------*/
|
||||
else
|
||||
{
|
||||
/* RXNE set and BTF reset ----------------------------------------------*/
|
||||
if(((sr1itflags & I2C_FLAG_RXNE) != RESET) && ((itsources & I2C_IT_BUF) != RESET) && ((sr1itflags & I2C_FLAG_BTF) == RESET))
|
||||
{
|
||||
I2C_SlaveReceive_RXNE(hi2c);
|
||||
}
|
||||
/* BTF set -------------------------------------------------------------*/
|
||||
else if(((sr1itflags & I2C_FLAG_BTF) != RESET) && ((itsources & I2C_IT_EVT) != RESET))
|
||||
{
|
||||
I2C_SlaveReceive_BTF(hi2c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,14 +6,19 @@ ENTRY(Reset_Handler)
|
||||
/* Highest address of the user mode stack */
|
||||
_estack = 0x20005000; /* end of RAM */
|
||||
|
||||
_Min_Heap_Size = 0x200; /* required amount of heap */
|
||||
_Min_Stack_Size = 0x400; /* required amount of stack */
|
||||
_Min_Heap_Size = 0x300; /* required amount of heap */
|
||||
_Min_Stack_Size = 1024; /* required amount of stack */
|
||||
|
||||
/* Memories definition */
|
||||
MEMORY
|
||||
{
|
||||
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K
|
||||
ROM (rx) : ORIGIN = 0x08004000, LENGTH = 46K
|
||||
/* LOCAL_BUILD*/
|
||||
/*ROM (rx) : ORIGIN = 0x08000000, LENGTH = 46K*/
|
||||
/* production*/
|
||||
ROM (rx) : ORIGIN = 0x08004000, LENGTH = 46K
|
||||
|
||||
|
||||
|
||||
}
|
||||
/* ROM is normally 48K after the bootloader, however we allocate the last page for settings, and the second last one for display boot logo*/
|
||||
|
||||
@@ -101,13 +101,13 @@
|
||||
#define configTICK_RATE_HZ ((TickType_t)100)
|
||||
#define configMAX_PRIORITIES ( 4 )
|
||||
#define configMINIMAL_STACK_SIZE ((uint16_t)256)
|
||||
#define configTOTAL_HEAP_SIZE ((size_t)10240+2048) /*Currently use about 9000*/
|
||||
#define configTOTAL_HEAP_SIZE ((size_t)1024*14) /*Currently use about 9000*/
|
||||
#define configMAX_TASK_NAME_LEN ( 24 )
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
#define configUSE_MUTEXES 1
|
||||
#define configQUEUE_REGISTRY_SIZE 8
|
||||
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
|
||||
#define configCHECK_FOR_STACK_OVERFLOW 0 /*Bump this to 2 during development and bug hunting*/
|
||||
#define configCHECK_FOR_STACK_OVERFLOW 2 /*Bump this to 2 during development and bug hunting*/
|
||||
|
||||
|
||||
/* Co-routine definitions. */
|
||||
|
||||
@@ -32,8 +32,13 @@ static void MX_ADC2_Init(void);
|
||||
|
||||
void Setup_HAL() {
|
||||
SystemClock_Config();
|
||||
__HAL_AFIO_REMAP_SWJ_DISABLE()
|
||||
;
|
||||
#ifndef LOCAL_BUILD
|
||||
__HAL_AFIO_REMAP_SWJ_DISABLE();
|
||||
#else
|
||||
__HAL_AFIO_REMAP_SWJ_NOJTAG();
|
||||
#endif
|
||||
|
||||
|
||||
MX_GPIO_Init();
|
||||
MX_DMA_Init();
|
||||
MX_I2C1_Init();
|
||||
@@ -226,7 +231,7 @@ static void MX_ADC2_Init(void) {
|
||||
/* I2C1 init function */
|
||||
static void MX_I2C1_Init(void) {
|
||||
hi2c1.Instance = I2C1;
|
||||
hi2c1.Init.ClockSpeed = 50000;
|
||||
hi2c1.Init.ClockSpeed = 75000;
|
||||
// OLED doesnt handle >100k when its asleep (off).
|
||||
hi2c1.Init.DutyCycle = I2C_DUTYCYCLE_2;
|
||||
hi2c1.Init.OwnAddress1 = 0;
|
||||
@@ -243,7 +248,9 @@ static void MX_IWDG_Init(void) {
|
||||
hiwdg.Instance = IWDG;
|
||||
hiwdg.Init.Prescaler = IWDG_PRESCALER_256;
|
||||
hiwdg.Init.Reload = 100;
|
||||
#ifndef LOCAL_BUILD
|
||||
HAL_IWDG_Init(&hiwdg);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* TIM3 init function */
|
||||
@@ -253,11 +260,11 @@ static void MX_TIM3_Init(void) {
|
||||
TIM_OC_InitTypeDef sConfigOC;
|
||||
|
||||
htim3.Instance = TIM3;
|
||||
htim3.Init.Prescaler = 4;
|
||||
htim3.Init.Prescaler = 8;
|
||||
htim3.Init.CounterMode = TIM_COUNTERMODE_UP;
|
||||
htim3.Init.Period = 100; // 10 Khz PWM freq
|
||||
htim3.Init.ClockDivision = TIM_CLOCKDIVISION_DIV4; // 4mhz before div
|
||||
htim3.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
|
||||
htim3.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_ENABLE;
|
||||
HAL_TIM_Base_Init(&htim3);
|
||||
|
||||
sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL;
|
||||
@@ -314,7 +321,7 @@ static void MX_TIM2_Init(void) {
|
||||
htim2.Init.CounterMode = TIM_COUNTERMODE_UP;
|
||||
htim2.Init.Period = 255 + 60;
|
||||
htim2.Init.ClockDivision = TIM_CLOCKDIVISION_DIV4; // 4mhz before divide
|
||||
htim2.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
|
||||
htim2.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_ENABLE;
|
||||
HAL_TIM_Base_Init(&htim2);
|
||||
|
||||
sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL;
|
||||
|
||||
@@ -580,7 +580,7 @@ static void settings_displayTipModel(void) {
|
||||
OLED::setFont(1);
|
||||
// set the cursor
|
||||
// Print the mfg
|
||||
OLED::setCursor(40, 0);
|
||||
OLED::setCursor(55, 0);
|
||||
if (systemSettings.tipType < Tip_MiniWare) {
|
||||
#ifdef MODEL_TS100
|
||||
OLED::print("TS100");
|
||||
@@ -596,7 +596,7 @@ static void settings_displayTipModel(void) {
|
||||
else if (systemSettings.tipType == Tip_Custom) {
|
||||
OLED::print("User");
|
||||
}
|
||||
OLED::setCursor(40, 8);
|
||||
OLED::setCursor(55, 8);
|
||||
#ifdef MODEL_TS100
|
||||
switch ((enum TipType)systemSettings.tipType) {
|
||||
case TS_B2:
|
||||
|
||||
@@ -555,68 +555,70 @@ static void gui_solderingMode(uint8_t jumpToSleep) {
|
||||
OLED::clearScreen();
|
||||
OLED::setFont(0);
|
||||
uint16_t tipTemp = getTipRawTemp(0);
|
||||
if (tipTemp > 32760) {
|
||||
badTipCounter++;
|
||||
if (tipTemp > 32700) {
|
||||
badTipCounter++;// Use a counter so that error has to persist for > 1 second continious so that peak errors dont trip it
|
||||
} else {
|
||||
badTipCounter = 0;
|
||||
if (systemSettings.detailedSoldering) {
|
||||
OLED::setFont(1);
|
||||
OLED::print(SolderingAdvancedPowerPrompt); // Power:
|
||||
OLED::printNumber(milliWattHistory[0] / 1000, 2);
|
||||
OLED::drawChar('.');
|
||||
OLED::printNumber(milliWattHistory[0] / 100 % 10, 1);
|
||||
OLED::drawChar('W');
|
||||
}
|
||||
//Draw in the screen details
|
||||
if (systemSettings.detailedSoldering) {
|
||||
OLED::setFont(1);
|
||||
OLED::print(SolderingAdvancedPowerPrompt); // Power:
|
||||
OLED::printNumber(milliWattHistory[0] / 1000, 2);
|
||||
OLED::drawChar('.');
|
||||
OLED::printNumber(milliWattHistory[0] / 100 % 10, 1);
|
||||
OLED::drawChar('W');
|
||||
|
||||
if (systemSettings.sensitivity && systemSettings.SleepTime) {
|
||||
OLED::print(" ");
|
||||
display_countdown(sleepThres);
|
||||
}
|
||||
|
||||
OLED::setCursor(0, 8);
|
||||
OLED::print(SleepingTipAdvancedString);
|
||||
gui_drawTipTemp(true);
|
||||
if (systemSettings.sensitivity && systemSettings.SleepTime) {
|
||||
OLED::print(" ");
|
||||
printVoltage();
|
||||
OLED::drawChar('V');
|
||||
display_countdown(sleepThres);
|
||||
}
|
||||
|
||||
OLED::setCursor(0, 8);
|
||||
OLED::print(SleepingTipAdvancedString);
|
||||
gui_drawTipTemp(true);
|
||||
OLED::print(" ");
|
||||
printVoltage();
|
||||
OLED::drawChar('V');
|
||||
} else {
|
||||
// We switch the layout direction depending on the orientation of the
|
||||
// OLED::
|
||||
if (OLED::getRotation()) {
|
||||
// battery
|
||||
gui_drawBatteryIcon();
|
||||
OLED::drawChar(' '); // Space out gap between battery <-> temp
|
||||
gui_drawTipTemp(true); // Draw current tip temp
|
||||
|
||||
// We draw boost arrow if boosting, or else gap temp <-> heat
|
||||
// indicator
|
||||
if (boostModeOn)
|
||||
OLED::drawSymbol(2);
|
||||
else
|
||||
OLED::drawChar(' ');
|
||||
|
||||
// Draw heating/cooling symbols
|
||||
OLED::drawHeatSymbol(
|
||||
milliWattsToPWM(milliWattHistory[0],
|
||||
systemSettings.voltageDiv));
|
||||
} else {
|
||||
// We switch the layout direction depending on the orientation of the
|
||||
// OLED::
|
||||
if (OLED::getRotation()) {
|
||||
// battery
|
||||
gui_drawBatteryIcon();
|
||||
OLED::drawChar(' '); // Space out gap between battery <-> temp
|
||||
gui_drawTipTemp(true); // Draw current tip temp
|
||||
// Draw heating/cooling symbols
|
||||
OLED::drawHeatSymbol(
|
||||
milliWattsToPWM(milliWattHistory[0],
|
||||
systemSettings.voltageDiv));
|
||||
// We draw boost arrow if boosting, or else gap temp <-> heat
|
||||
// indicator
|
||||
if (boostModeOn)
|
||||
OLED::drawSymbol(2);
|
||||
else
|
||||
OLED::drawChar(' ');
|
||||
gui_drawTipTemp(true); // Draw current tip temp
|
||||
|
||||
// We draw boost arrow if boosting, or else gap temp <-> heat
|
||||
// indicator
|
||||
if (boostModeOn)
|
||||
OLED::drawSymbol(2);
|
||||
else
|
||||
OLED::drawChar(' ');
|
||||
OLED::drawChar(' '); // Space out gap between battery <-> temp
|
||||
|
||||
// Draw heating/cooling symbols
|
||||
OLED::drawHeatSymbol(
|
||||
milliWattsToPWM(milliWattHistory[0],
|
||||
systemSettings.voltageDiv));
|
||||
} else {
|
||||
// Draw heating/cooling symbols
|
||||
OLED::drawHeatSymbol(
|
||||
milliWattsToPWM(milliWattHistory[0],
|
||||
systemSettings.voltageDiv));
|
||||
// We draw boost arrow if boosting, or else gap temp <-> heat
|
||||
// indicator
|
||||
if (boostModeOn)
|
||||
OLED::drawSymbol(2);
|
||||
else
|
||||
OLED::drawChar(' ');
|
||||
gui_drawTipTemp(true); // Draw current tip temp
|
||||
|
||||
OLED::drawChar(' '); // Space out gap between battery <-> temp
|
||||
|
||||
gui_drawBatteryIcon();
|
||||
}
|
||||
gui_drawBatteryIcon();
|
||||
}
|
||||
}
|
||||
|
||||
if (badTipCounter > 128) {
|
||||
OLED::print(BadTipString);
|
||||
OLED::refresh();
|
||||
|
||||
@@ -26,12 +26,6 @@ void HAL_MspInit(void) {
|
||||
/* SysTick_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(SysTick_IRQn, 15, 0);
|
||||
|
||||
/**NOJTAG: JTAG-DP Disabled and SW-DP Enabled
|
||||
*/
|
||||
//__HAL_AFIO_REMAP_SWJ_NOJTAG()
|
||||
//;
|
||||
__HAL_AFIO_REMAP_SWJ_DISABLE()
|
||||
; /*Disable swd for debug io use*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -11,9 +11,14 @@
|
||||
#if defined(STM32F100xE) || defined(STM32F101xE) || defined(STM32F101xG) || defined(STM32F103xE) || defined(STM32F103xG)
|
||||
/* #define DATA_IN_ExtSRAM */
|
||||
#endif /* STM32F100xE || STM32F101xE || STM32F101xG || STM32F103xE || STM32F103xG */
|
||||
|
||||
#ifndef LOCAL_BUILD
|
||||
#define VECT_TAB_OFFSET 0x00004000U /*!< Vector Table base offset field.
|
||||
This value must be a multiple of 0x200. */
|
||||
#else
|
||||
#define VECT_TAB_OFFSET 0x00000000U /*!< Vector Table base offset field.
|
||||
This value must be a multiple of 0x200. */
|
||||
#warning LOCAL_BUILD SETUP
|
||||
#endif
|
||||
//We offset this by 0x4000 to because of the bootloader
|
||||
/*******************************************************************************
|
||||
* Clock Definitions
|
||||
|
||||
Reference in New Issue
Block a user