Rebalance ram
This commit is contained in:
@@ -69,7 +69,7 @@ int main(void) {
|
||||
|
||||
/* Create the thread(s) */
|
||||
/* definition and creation of GUITask */
|
||||
osThreadDef(GUITask, startGUITask, osPriorityBelowNormal, 0, 4 * 1024 / 4);
|
||||
osThreadDef(GUITask, startGUITask, osPriorityBelowNormal, 0, 5 * 1024 / 4);
|
||||
GUITaskHandle = osThreadCreate(osThread(GUITask), NULL);
|
||||
|
||||
/* definition and creation of PIDTask */
|
||||
@@ -77,7 +77,7 @@ int main(void) {
|
||||
PIDTaskHandle = osThreadCreate(osThread(PIDTask), NULL);
|
||||
if (PCBVersion < 3) {
|
||||
/* definition and creation of MOVTask */
|
||||
osThreadDef(MOVTask, startMOVTask, osPriorityNormal, 0, 2 * 1024 / 4);
|
||||
osThreadDef(MOVTask, startMOVTask, osPriorityNormal, 0, 3 * 1024 / 4);
|
||||
MOVTaskHandle = osThreadCreate(osThread(MOVTask), NULL);
|
||||
}
|
||||
|
||||
@@ -266,36 +266,36 @@ static void gui_drawBatteryIcon() {
|
||||
// we need to calculate which of the 10 levels they are on
|
||||
uint8_t cellCount = systemSettings.cutoutSetting + 2;
|
||||
uint16_t cellV = getInputVoltageX10(systemSettings.voltageDiv, 0)
|
||||
/ cellCount;
|
||||
/ cellCount;
|
||||
// Should give us approx cell voltage X10
|
||||
// Range is 42 -> 33 = 9 steps therefore we will use battery 1-10
|
||||
if (cellV < 33)
|
||||
cellV = 33;
|
||||
cellV -= 33;// Should leave us a number of 0-9
|
||||
cellV = 33;
|
||||
cellV -= 33; // Should leave us a number of 0-9
|
||||
if (cellV > 9)
|
||||
cellV = 9;
|
||||
cellV = 9;
|
||||
OLED::drawBattery(cellV + 1);
|
||||
} else
|
||||
OLED::drawSymbol(15); // Draw the DC Logo
|
||||
OLED::drawSymbol(15); // Draw the DC Logo
|
||||
#else
|
||||
// On TS80 we replace this symbol with the voltage we are operating on
|
||||
// If <9V then show single digit, if not show duals
|
||||
uint8_t V = getInputVoltageX10(systemSettings.voltageDiv, 0);
|
||||
if (V % 10 >= 5)
|
||||
V = V / 10 + 1; // round up
|
||||
else
|
||||
V = V / 10;
|
||||
if (V >= 10) {
|
||||
int16_t xPos = OLED::getCursorX();
|
||||
OLED::setFont(1);
|
||||
OLED::printNumber(1, 1);
|
||||
OLED::setCursor(xPos, 8);
|
||||
OLED::printNumber(V % 10, 1);
|
||||
OLED::setFont(0);
|
||||
OLED::setCursor(xPos + 12, 0); // need to reset this as if we drew a wide char
|
||||
} else {
|
||||
OLED::printNumber(V, 1);
|
||||
}
|
||||
// On TS80 we replace this symbol with the voltage we are operating on
|
||||
// If <9V then show single digit, if not show duals
|
||||
uint8_t V = getInputVoltageX10(systemSettings.voltageDiv, 0);
|
||||
if (V % 10 >= 5)
|
||||
V = V / 10 + 1;// round up
|
||||
else
|
||||
V = V / 10;
|
||||
if (V >= 10) {
|
||||
int16_t xPos = OLED::getCursorX();
|
||||
OLED::setFont(1);
|
||||
OLED::printNumber(1, 1);
|
||||
OLED::setCursor(xPos, 8);
|
||||
OLED::printNumber(V % 10, 1);
|
||||
OLED::setFont(0);
|
||||
OLED::setCursor(xPos + 12, 0); // need to reset this as if we drew a wide char
|
||||
} else {
|
||||
OLED::printNumber(V, 1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
static void gui_solderingTempAdjust() {
|
||||
@@ -367,7 +367,7 @@ static void gui_solderingTempAdjust() {
|
||||
#ifdef MODEL_TS80
|
||||
if (!OLED::getRotation())
|
||||
#else
|
||||
if (OLED::getRotation())
|
||||
if (OLED::getRotation())
|
||||
#endif
|
||||
OLED::drawChar('-');
|
||||
else
|
||||
@@ -383,7 +383,7 @@ static void gui_solderingTempAdjust() {
|
||||
#ifdef MODEL_TS80
|
||||
if (!OLED::getRotation())
|
||||
#else
|
||||
if (OLED::getRotation())
|
||||
if (OLED::getRotation())
|
||||
#endif
|
||||
OLED::drawChar('+');
|
||||
else
|
||||
@@ -410,7 +410,7 @@ static int gui_SolderingSleepingMode() {
|
||||
|| (xTaskGetTickCount() - lastButtonTime < 100))
|
||||
return 0; // user moved or pressed a button, go back to soldering
|
||||
#ifdef MODEL_TS100
|
||||
if (checkVoltageForExit())
|
||||
if (checkVoltageForExit())
|
||||
return 1; // return non-zero on error
|
||||
#endif
|
||||
if (systemSettings.temperatureInF) {
|
||||
@@ -501,6 +501,7 @@ static void gui_solderingMode(uint8_t jumpToSleep) {
|
||||
* --> Double button to exit
|
||||
*/
|
||||
bool boostModeOn = false;
|
||||
uint8_t badTipCounter = 0;
|
||||
uint32_t sleepThres = 0;
|
||||
if (systemSettings.SleepTime < 6)
|
||||
sleepThres = systemSettings.SleepTime * 10 * 100;
|
||||
@@ -549,14 +550,10 @@ static void gui_solderingMode(uint8_t jumpToSleep) {
|
||||
OLED::clearScreen();
|
||||
OLED::setFont(0);
|
||||
uint16_t tipTemp = getTipRawTemp(0);
|
||||
if (tipTemp > 32752) {
|
||||
OLED::print(BadTipString);
|
||||
OLED::refresh();
|
||||
currentlyActiveTemperatureTarget = 0;
|
||||
waitForButtonPress();
|
||||
currentlyActiveTemperatureTarget = 0;
|
||||
return;
|
||||
if (tipTemp > 32760) {
|
||||
badTipCounter++;
|
||||
} else {
|
||||
badTipCounter = 0;
|
||||
if (systemSettings.detailedSoldering) {
|
||||
OLED::setFont(1);
|
||||
OLED::print(SolderingAdvancedPowerPrompt); // Power:
|
||||
@@ -615,6 +612,14 @@ static void gui_solderingMode(uint8_t jumpToSleep) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (badTipCounter > 128) {
|
||||
OLED::print(BadTipString);
|
||||
OLED::refresh();
|
||||
currentlyActiveTemperatureTarget = 0;
|
||||
waitForButtonPress();
|
||||
currentlyActiveTemperatureTarget = 0;
|
||||
return;
|
||||
}
|
||||
OLED::refresh();
|
||||
|
||||
// Update the setpoints for the temperature
|
||||
@@ -671,7 +676,7 @@ __DATE__, "Heap: ", "HWMG: ", "HWMP: ", "HWMM: ", "Time: ", "Move: ", "RTip: ",
|
||||
"Tm ", "Ralim-",
|
||||
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
||||
void showVersion(void) {
|
||||
uint8_t screen = 0;
|
||||
@@ -681,9 +686,9 @@ void showVersion(void) {
|
||||
OLED::setCursor(0, 0); // Position the cursor at the 0,0 (top left)
|
||||
OLED::setFont(1); // small font
|
||||
#ifdef MODEL_TS100
|
||||
OLED::print((char *) "V2.06 TS100"); // Print version number
|
||||
OLED::print((char *) "V2.06 TS100"); // Print version number
|
||||
#else
|
||||
OLED::print((char *) "V2.06 TS80"); // Print version number
|
||||
OLED::print((char *) "V2.06 TS80"); // Print version number
|
||||
#endif
|
||||
OLED::setCursor(0, 8); // second line
|
||||
OLED::print(HEADERS[screen]);
|
||||
@@ -870,7 +875,7 @@ void startGUITask(void const *argument __unused) {
|
||||
#ifdef MODEL_TS80
|
||||
if (!OLED::getRotation()) {
|
||||
#else
|
||||
if (OLED::getRotation()) {
|
||||
if (OLED::getRotation()) {
|
||||
#endif
|
||||
OLED::drawArea(12, 0, 84, 16, idleScreenBG);
|
||||
OLED::setCursor(0, 0);
|
||||
@@ -891,7 +896,7 @@ void startGUITask(void const *argument __unused) {
|
||||
#ifdef MODEL_TS80
|
||||
if (!OLED::getRotation()) {
|
||||
#else
|
||||
if (OLED::getRotation()) {
|
||||
if (OLED::getRotation()) {
|
||||
#endif
|
||||
// in right handed mode we want to draw over the first part
|
||||
OLED::fillArea(55, 0, 41, 16, 0); // clear the area for the temp
|
||||
@@ -920,14 +925,14 @@ void startPIDTask(void const *argument __unused) {
|
||||
*/
|
||||
setTipMilliWatts(0); // disable the output driver if the output is set to be off
|
||||
#ifdef MODEL_TS80
|
||||
idealQCVoltage = calculateMaxVoltage(systemSettings.cutoutSetting);
|
||||
idealQCVoltage = calculateMaxVoltage(systemSettings.cutoutSetting);
|
||||
#endif
|
||||
uint8_t rawC = ctoTipMeasurement(101) - ctoTipMeasurement(100); // 1*C change in raw.
|
||||
|
||||
#ifdef MODEL_TS80
|
||||
//Set power management code to the tip resistance in ohms * 10
|
||||
setupPower(calculateTipR() / 100);
|
||||
size_t lastPowerPulse = 0;
|
||||
//Set power management code to the tip resistance in ohms * 10
|
||||
setupPower(calculateTipR() / 100);
|
||||
size_t lastPowerPulse = 0;
|
||||
#else
|
||||
setupPower(85);
|
||||
|
||||
@@ -944,10 +949,11 @@ void startPIDTask(void const *argument __unused) {
|
||||
if (currentlyActiveTemperatureTarget) {
|
||||
// Cap the max set point to 450C
|
||||
if (currentlyActiveTemperatureTarget > ctoTipMeasurement(450)) {
|
||||
//Maximum allowed output
|
||||
currentlyActiveTemperatureTarget = ctoTipMeasurement(450);
|
||||
}
|
||||
if (currentlyActiveTemperatureTarget > 32500) {
|
||||
currentlyActiveTemperatureTarget = 32500;
|
||||
} else if (currentlyActiveTemperatureTarget > 32400) {
|
||||
//Cap to max adc reading
|
||||
currentlyActiveTemperatureTarget = 32400;
|
||||
}
|
||||
|
||||
// As we get close to our target, temp noise causes the system
|
||||
@@ -1033,9 +1039,9 @@ void startMOVTask(void const *argument __unused) {
|
||||
#ifdef MODEL_TS80
|
||||
startQC(systemSettings.voltageDiv);
|
||||
while (pidTaskNotification == 0)
|
||||
osDelay(20); // To ensure we return after idealQCVoltage/tip resistance
|
||||
osDelay(20); // To ensure we return after idealQCVoltage/tip resistance
|
||||
|
||||
seekQC(idealQCVoltage, systemSettings.voltageDiv); // this will move the QC output to the preferred voltage to start with
|
||||
seekQC(idealQCVoltage, systemSettings.voltageDiv);// this will move the QC output to the preferred voltage to start with
|
||||
|
||||
#else
|
||||
osDelay(250); // wait for accelerometer to stabilize
|
||||
@@ -1121,9 +1127,9 @@ void startMOVTask(void const *argument __unused) {
|
||||
|
||||
osDelay(100); // Slow down update rate
|
||||
#ifdef MODEL_TS80
|
||||
if (currentlyActiveTemperatureTarget) {
|
||||
seekQC(idealQCVoltage, systemSettings.voltageDiv); // Run the QC seek again to try and compensate for cable V drop
|
||||
}
|
||||
if (currentlyActiveTemperatureTarget) {
|
||||
seekQC(idealQCVoltage, systemSettings.voltageDiv); // Run the QC seek again to try and compensate for cable V drop
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -1185,9 +1191,13 @@ void HAL_I2C_MemTxCpltCallback(I2C_HandleTypeDef *hi2c __unused) {
|
||||
FRToSI2C::CpltCallback();
|
||||
}
|
||||
void HAL_I2C_ErrorCallback(I2C_HandleTypeDef *hi2c __unused) {
|
||||
asm("bkpt");
|
||||
|
||||
FRToSI2C::CpltCallback();
|
||||
}
|
||||
void HAL_I2C_AbortCpltCallback(I2C_HandleTypeDef *hi2c __unused) {
|
||||
asm("bkpt");
|
||||
|
||||
FRToSI2C::CpltCallback();
|
||||
}
|
||||
void HAL_I2C_MemRxCpltCallback(I2C_HandleTypeDef *hi2c __unused) {
|
||||
@@ -1195,6 +1205,7 @@ void HAL_I2C_MemRxCpltCallback(I2C_HandleTypeDef *hi2c __unused) {
|
||||
}
|
||||
void vApplicationStackOverflowHook(xTaskHandle *pxTask __unused,
|
||||
signed portCHAR *pcTaskName __unused) {
|
||||
asm("bkpt");
|
||||
// We dont have a good way to handle a stack overflow at this point in time
|
||||
NVIC_SystemReset();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user