mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
@@ -392,7 +392,41 @@ const char SettingRightChar = 'P';
|
|||||||
const char SettingLeftChar = 'L';
|
const char SettingLeftChar = 'L';
|
||||||
const char SettingAutoChar = 'A';
|
const char SettingAutoChar = 'A';
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef LANG_HUN
|
||||||
|
const char* SettingsLongNames[16] = {
|
||||||
|
/*These are all the help text for all the settings.*/
|
||||||
|
/*No requirements on spacing or length*/
|
||||||
|
"Áramforrás. Beállítja a lekapcsolási feszültséget. <DC 10V> <S 3.3V cellánként>", //Power Source
|
||||||
|
"Alvási hőmérséklet <C>", //Sleep Temp
|
||||||
|
"Elalvási időzítő <Perc/Másodperc>", //Sleep Timeout
|
||||||
|
"Kikapcsolási időzítő <Minutes>", //Shutdown Time
|
||||||
|
"Mozgás érzékenység beállítása. <0.Ki 1.kevésbé érzékeny 9.legérzékenyebb>", //Motion Sensitivity
|
||||||
|
"Hőmérsékleti egység <C=Celsius F=Fahrenheit>", //Temp Unit
|
||||||
|
"Részletes információ megjelenítése kisebb betűméretben a készenléti képernyőn.", //Detailed Information
|
||||||
|
"Megjelenítési tájolás <A. Automatikus L. Balkezes R. Jobbkezes>", //Orientation
|
||||||
|
"Elülső gombbal lépjen boost módba, 450C forrasztás közben", //Boost enable
|
||||||
|
"Hőmérséklet \"boost\" módban", //Boost Temp
|
||||||
|
"Bekapcsolás után automatikusan lépjen forrasztás módba. T=Forrasztás, S=Alvó mód,F=Ki", //Auto start
|
||||||
|
"Villogjon a hőmérséklet hűlés közben, amíg a hegy forró.", //Cooling Blink
|
||||||
|
"Hegy hőmérsékletének kalibrálása", //Calibrate Tip
|
||||||
|
"Beállítások alaphelyzetbe állítása", //Reset Settings
|
||||||
|
"A bemeneti feszültség kalibrálása. Röviden megnyomva állítsa be, hosszan nyomja meg a kilépéshez.", //VIN Cal
|
||||||
|
"Részletes információk megjelenítése forrasztás közben", //ADV SLD
|
||||||
|
};
|
||||||
|
|
||||||
|
const char* SettingsCalibrationWarning = "Folytatás előtt győződj meg róla, hogy a hegy szobahőmérsékletű!";
|
||||||
|
const char* UVLOWarningString = "LOW VOLT"; //Fixed width 8 chars
|
||||||
|
const char* SleepingSimpleString = "Zzzz"; // Must be <= 4 chars
|
||||||
|
const char* SleepingAdvancedString = "Alvás..."; // <=17 chars
|
||||||
|
const char* WarningSimpleString = "HOT!"; //Must be <= 4 chars
|
||||||
|
const char* WarningAdvancedString = "FIGYELEM! FORRÓ HEGY!";
|
||||||
|
|
||||||
|
const char SettingTrueChar = 'T';
|
||||||
|
const char SettingFalseChar = 'F';
|
||||||
|
const char SettingRightChar = 'R';
|
||||||
|
const char SettingLeftChar = 'L';
|
||||||
|
const char SettingAutoChar = 'A';
|
||||||
|
#endif
|
||||||
//Currently the settings names are not translated
|
//Currently the settings names are not translated
|
||||||
const char* SettingsShortNames[16] = { /**/
|
const char* SettingsShortNames[16] = { /**/
|
||||||
"PWRSC ", // Power Source (DC or batt)
|
"PWRSC ", // Power Source (DC or batt)
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ uint16_t getTipInstantTemperature() {
|
|||||||
uint16_t getTipRawTemp(uint8_t instant) {
|
uint16_t getTipRawTemp(uint8_t instant) {
|
||||||
#define filterDepth1 1
|
#define filterDepth1 1
|
||||||
/*Pre filter used before PID*/
|
/*Pre filter used before PID*/
|
||||||
#define filterDepth2 32
|
#define filterDepth2 64
|
||||||
/*Post filter used for UI display*/
|
/*Post filter used for UI display*/
|
||||||
static uint16_t filterLayer1[filterDepth1];
|
static uint16_t filterLayer1[filterDepth1];
|
||||||
static uint16_t filterLayer2[filterDepth2];
|
static uint16_t filterLayer2[filterDepth2];
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ int main(void) {
|
|||||||
setTipPWM(0);
|
setTipPWM(0);
|
||||||
lcd.initialize(); //start up the LCD
|
lcd.initialize(); //start up the LCD
|
||||||
lcd.setFont(0); //default to bigger font
|
lcd.setFont(0); //default to bigger font
|
||||||
accel.initalize(); //this sets up the I2C registers and loads up the default settings
|
accel.initalize(); //this sets up the I2C registers and loads up the default settings
|
||||||
HAL_IWDG_Refresh(&hiwdg);
|
HAL_IWDG_Refresh(&hiwdg);
|
||||||
restoreSettings(); //load the settings from flash
|
restoreSettings(); //load the settings from flash
|
||||||
setCalibrationOffset(systemSettings.CalibrationOffset);
|
setCalibrationOffset(systemSettings.CalibrationOffset);
|
||||||
@@ -63,8 +63,8 @@ int main(void) {
|
|||||||
MOVTaskHandle = osThreadCreate(osThread(MOVTask), NULL);
|
MOVTaskHandle = osThreadCreate(osThread(MOVTask), NULL);
|
||||||
|
|
||||||
/* Create the objects*/
|
/* Create the objects*/
|
||||||
rotationChangedSemaphore = xSemaphoreCreateBinary(); // Used to unlock rotation thread
|
rotationChangedSemaphore = xSemaphoreCreateBinary(); // Used to unlock rotation thread
|
||||||
accelDataAvailableSemaphore = xSemaphoreCreateBinary(); // Used to unlock the movement thread
|
accelDataAvailableSemaphore = xSemaphoreCreateBinary(); // Used to unlock the movement thread
|
||||||
/* Start scheduler */
|
/* Start scheduler */
|
||||||
osKernelStart();
|
osKernelStart();
|
||||||
|
|
||||||
@@ -103,8 +103,12 @@ ButtonState getButtonState() {
|
|||||||
static uint32_t previousStateChange = 0;
|
static uint32_t previousStateChange = 0;
|
||||||
const uint16_t timeout = 400;
|
const uint16_t timeout = 400;
|
||||||
uint8_t currentState;
|
uint8_t currentState;
|
||||||
currentState = (HAL_GPIO_ReadPin(KEY_A_GPIO_Port, KEY_A_Pin) == GPIO_PIN_RESET ? 1 : 0) << 0;
|
currentState = (
|
||||||
currentState |= (HAL_GPIO_ReadPin(KEY_B_GPIO_Port, KEY_B_Pin) == GPIO_PIN_RESET ? 1 : 0) << 1;
|
HAL_GPIO_ReadPin(KEY_A_GPIO_Port, KEY_A_Pin) == GPIO_PIN_RESET ?
|
||||||
|
1 : 0) << 0;
|
||||||
|
currentState |= (
|
||||||
|
HAL_GPIO_ReadPin(KEY_B_GPIO_Port, KEY_B_Pin) == GPIO_PIN_RESET ?
|
||||||
|
1 : 0) << 1;
|
||||||
|
|
||||||
if (currentState)
|
if (currentState)
|
||||||
lastButtonTime = HAL_GetTick();
|
lastButtonTime = HAL_GetTick();
|
||||||
@@ -119,7 +123,7 @@ ButtonState getButtonState() {
|
|||||||
else if (currentState == 0x02)
|
else if (currentState == 0x02)
|
||||||
return BUTTON_B_LONG;
|
return BUTTON_B_LONG;
|
||||||
else
|
else
|
||||||
return BUTTON_NONE; // Both being held case, we dont long hold this
|
return BUTTON_NONE; // Both being held case, we dont long hold this
|
||||||
} else
|
} else
|
||||||
return BUTTON_NONE;
|
return BUTTON_NONE;
|
||||||
} else {
|
} else {
|
||||||
@@ -194,9 +198,11 @@ static bool checkVoltageForExit() {
|
|||||||
lcd.print("Undervoltage");
|
lcd.print("Undervoltage");
|
||||||
lcd.setCursor(0, 8);
|
lcd.setCursor(0, 8);
|
||||||
lcd.print("Input V: ");
|
lcd.print("Input V: ");
|
||||||
lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) / 10, 2);
|
lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) / 10,
|
||||||
|
2);
|
||||||
lcd.drawChar('.');
|
lcd.drawChar('.');
|
||||||
lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) % 10, 1);
|
lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) % 10,
|
||||||
|
1);
|
||||||
lcd.print("V");
|
lcd.print("V");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -216,7 +222,8 @@ static void gui_drawBatteryIcon() {
|
|||||||
//User is on a lithium battery
|
//User is on a lithium battery
|
||||||
//we need to calculate which of the 10 levels they are on
|
//we need to calculate which of the 10 levels they are on
|
||||||
uint8_t cellCount = systemSettings.cutoutSetting + 2;
|
uint8_t cellCount = systemSettings.cutoutSetting + 2;
|
||||||
uint16_t cellV = getInputVoltageX10(systemSettings.voltageDiv) / cellCount;
|
uint16_t cellV = getInputVoltageX10(systemSettings.voltageDiv)
|
||||||
|
/ cellCount;
|
||||||
//Should give us approx cell voltage X10
|
//Should give us approx cell voltage X10
|
||||||
//Range is 42 -> 33 = 9 steps therefore we will use battery 1-10
|
//Range is 42 -> 33 = 9 steps therefore we will use battery 1-10
|
||||||
if (cellV < 33)
|
if (cellV < 33)
|
||||||
@@ -240,33 +247,33 @@ static void gui_solderingTempAdjust() {
|
|||||||
if (buttons)
|
if (buttons)
|
||||||
lastChange = HAL_GetTick();
|
lastChange = HAL_GetTick();
|
||||||
switch (buttons) {
|
switch (buttons) {
|
||||||
case BUTTON_NONE:
|
case BUTTON_NONE:
|
||||||
//stay
|
//stay
|
||||||
break;
|
break;
|
||||||
case BUTTON_BOTH:
|
case BUTTON_BOTH:
|
||||||
//exit
|
//exit
|
||||||
return;
|
return;
|
||||||
break;
|
break;
|
||||||
case BUTTON_B_LONG:
|
case BUTTON_B_LONG:
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case BUTTON_F_LONG:
|
case BUTTON_F_LONG:
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case BUTTON_F_SHORT:
|
case BUTTON_F_SHORT:
|
||||||
if (lcd.getRotation()) {
|
if (lcd.getRotation()) {
|
||||||
systemSettings.SolderingTemp += 10; //add 10
|
systemSettings.SolderingTemp += 10; //add 10
|
||||||
} else {
|
} else {
|
||||||
systemSettings.SolderingTemp -= 10; //sub 10
|
systemSettings.SolderingTemp -= 10; //sub 10
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BUTTON_B_SHORT:
|
case BUTTON_B_SHORT:
|
||||||
if (!lcd.getRotation()) {
|
if (!lcd.getRotation()) {
|
||||||
systemSettings.SolderingTemp += 10; //add 10
|
systemSettings.SolderingTemp += 10; //add 10
|
||||||
} else {
|
} else {
|
||||||
systemSettings.SolderingTemp -= 10; //sub 10
|
systemSettings.SolderingTemp -= 10; //sub 10
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// constrain between 50-450 C
|
// constrain between 50-450 C
|
||||||
if (systemSettings.temperatureInF) {
|
if (systemSettings.temperatureInF) {
|
||||||
@@ -307,7 +314,8 @@ static void gui_settingsMenu() {
|
|||||||
settingsResetRequest = false;
|
settingsResetRequest = false;
|
||||||
bool earlyExit = false;
|
bool earlyExit = false;
|
||||||
uint32_t descriptionStart = 0;
|
uint32_t descriptionStart = 0;
|
||||||
while ((settingsMenu[currentScreen].description != NULL) && earlyExit == false) {
|
while ((settingsMenu[currentScreen].description != NULL)
|
||||||
|
&& earlyExit == false) {
|
||||||
lcd.setFont(0);
|
lcd.setFont(0);
|
||||||
lcd.clearScreen();
|
lcd.clearScreen();
|
||||||
lcd.setCursor(0, 0);
|
lcd.setCursor(0, 0);
|
||||||
@@ -318,11 +326,13 @@ static void gui_settingsMenu() {
|
|||||||
} else {
|
} else {
|
||||||
//Draw description
|
//Draw description
|
||||||
//draw string starting from descriptionOffset
|
//draw string starting from descriptionOffset
|
||||||
int16_t maxOffset = strlen(settingsMenu[currentScreen].description) + 5;
|
int16_t maxOffset = strlen(settingsMenu[currentScreen].description)
|
||||||
|
+ 5;
|
||||||
if (descriptionStart == 0)
|
if (descriptionStart == 0)
|
||||||
descriptionStart = HAL_GetTick();
|
descriptionStart = HAL_GetTick();
|
||||||
|
|
||||||
int16_t descriptionOffset = (((HAL_GetTick() - descriptionStart) / 150) % maxOffset);
|
int16_t descriptionOffset = (((HAL_GetTick() - descriptionStart)
|
||||||
|
/ 150) % maxOffset);
|
||||||
//^ Rolling offset based on time
|
//^ Rolling offset based on time
|
||||||
lcd.setCursor(12 * (7 - descriptionOffset), 0);
|
lcd.setCursor(12 * (7 - descriptionOffset), 0);
|
||||||
lcd.print(settingsMenu[currentScreen].description);
|
lcd.print(settingsMenu[currentScreen].description);
|
||||||
@@ -331,39 +341,39 @@ static void gui_settingsMenu() {
|
|||||||
ButtonState buttons = getButtonState();
|
ButtonState buttons = getButtonState();
|
||||||
|
|
||||||
switch (buttons) {
|
switch (buttons) {
|
||||||
case BUTTON_BOTH:
|
case BUTTON_BOTH:
|
||||||
earlyExit = true; //will make us exit next loop
|
earlyExit = true; //will make us exit next loop
|
||||||
|
descriptionStart = 0;
|
||||||
|
break;
|
||||||
|
case BUTTON_F_SHORT:
|
||||||
|
//increment
|
||||||
|
if (descriptionStart == 0)
|
||||||
|
settingsMenu[currentScreen].incrementHandler.func();
|
||||||
|
else
|
||||||
descriptionStart = 0;
|
descriptionStart = 0;
|
||||||
break;
|
break;
|
||||||
case BUTTON_F_SHORT:
|
case BUTTON_B_SHORT:
|
||||||
//increment
|
if (descriptionStart == 0)
|
||||||
if (descriptionStart == 0)
|
currentScreen++;
|
||||||
settingsMenu[currentScreen].incrementHandler.func();
|
else
|
||||||
else
|
descriptionStart = 0;
|
||||||
descriptionStart = 0;
|
break;
|
||||||
break;
|
case BUTTON_F_LONG:
|
||||||
case BUTTON_B_SHORT:
|
if (HAL_GetTick() - autoRepeatTimer > 200) {
|
||||||
if (descriptionStart == 0)
|
settingsMenu[currentScreen].incrementHandler.func();
|
||||||
currentScreen++;
|
autoRepeatTimer = HAL_GetTick();
|
||||||
else
|
descriptionStart = 0;
|
||||||
descriptionStart = 0;
|
}
|
||||||
break;
|
break;
|
||||||
case BUTTON_F_LONG:
|
case BUTTON_B_LONG:
|
||||||
if (HAL_GetTick() - autoRepeatTimer > 200) {
|
if (HAL_GetTick() - autoRepeatTimer > 200) {
|
||||||
settingsMenu[currentScreen].incrementHandler.func();
|
currentScreen++;
|
||||||
autoRepeatTimer = HAL_GetTick();
|
autoRepeatTimer = HAL_GetTick();
|
||||||
descriptionStart = 0;
|
descriptionStart = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BUTTON_B_LONG:
|
case BUTTON_NONE:
|
||||||
if (HAL_GetTick() - autoRepeatTimer > 200) {
|
break;
|
||||||
currentScreen++;
|
|
||||||
autoRepeatTimer = HAL_GetTick();
|
|
||||||
descriptionStart = 0;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case BUTTON_NONE:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
lcd.refresh(); //update the LCD
|
lcd.refresh(); //update the LCD
|
||||||
@@ -439,17 +449,20 @@ static int gui_SolderingSleepingMode() {
|
|||||||
ButtonState buttons = getButtonState();
|
ButtonState buttons = getButtonState();
|
||||||
if (buttons)
|
if (buttons)
|
||||||
return 0;
|
return 0;
|
||||||
if ((HAL_GetTick() - lastMovementTime < 1000) || (HAL_GetTick() - lastButtonTime < 1000))
|
if ((HAL_GetTick() - lastMovementTime < 1000)
|
||||||
|
|| (HAL_GetTick() - lastButtonTime < 1000))
|
||||||
return 0; //user moved or pressed a button, go back to soldering
|
return 0; //user moved or pressed a button, go back to soldering
|
||||||
if (checkVoltageForExit())
|
if (checkVoltageForExit())
|
||||||
return 1; //return non-zero on error
|
return 1; //return non-zero on error
|
||||||
|
|
||||||
if (systemSettings.temperatureInF)
|
if (systemSettings.temperatureInF)
|
||||||
currentlyActiveTemperatureTarget = ftoTipMeasurement(
|
currentlyActiveTemperatureTarget = ftoTipMeasurement(
|
||||||
min(systemSettings.SleepTemp, systemSettings.SolderingTemp));
|
min(systemSettings.SleepTemp,
|
||||||
|
systemSettings.SolderingTemp));
|
||||||
else
|
else
|
||||||
currentlyActiveTemperatureTarget = ctoTipMeasurement(
|
currentlyActiveTemperatureTarget = ctoTipMeasurement(
|
||||||
min(systemSettings.SleepTemp, systemSettings.SolderingTemp));
|
min(systemSettings.SleepTemp,
|
||||||
|
systemSettings.SolderingTemp));
|
||||||
//draw the lcd
|
//draw the lcd
|
||||||
uint16_t tipTemp;
|
uint16_t tipTemp;
|
||||||
if (systemSettings.temperatureInF)
|
if (systemSettings.temperatureInF)
|
||||||
@@ -471,9 +484,11 @@ static int gui_SolderingSleepingMode() {
|
|||||||
lcd.print("C");
|
lcd.print("C");
|
||||||
|
|
||||||
lcd.print(" ");
|
lcd.print(" ");
|
||||||
lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) / 10, 2);
|
lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) / 10,
|
||||||
|
2);
|
||||||
lcd.drawChar('.');
|
lcd.drawChar('.');
|
||||||
lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) % 10, 1);
|
lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) % 10,
|
||||||
|
1);
|
||||||
lcd.drawChar('V');
|
lcd.drawChar('V');
|
||||||
} else {
|
} else {
|
||||||
lcd.setFont(0);
|
lcd.setFont(0);
|
||||||
@@ -484,7 +499,7 @@ static int gui_SolderingSleepingMode() {
|
|||||||
else
|
else
|
||||||
lcd.drawSymbol(1);
|
lcd.drawSymbol(1);
|
||||||
}
|
}
|
||||||
if (systemSettings.ShutdownTime) //only allow shutdown exit if time > 0
|
if (systemSettings.ShutdownTime) //only allow shutdown exit if time > 0
|
||||||
if (lastMovementTime)
|
if (lastMovementTime)
|
||||||
if (((uint32_t) (HAL_GetTick() - lastMovementTime))
|
if (((uint32_t) (HAL_GetTick() - lastMovementTime))
|
||||||
> (uint32_t) (systemSettings.ShutdownTime * 60 * 1000)) {
|
> (uint32_t) (systemSettings.ShutdownTime * 60 * 1000)) {
|
||||||
@@ -522,31 +537,31 @@ static void gui_solderingMode() {
|
|||||||
|
|
||||||
ButtonState buttons = getButtonState();
|
ButtonState buttons = getButtonState();
|
||||||
switch (buttons) {
|
switch (buttons) {
|
||||||
case BUTTON_NONE:
|
case BUTTON_NONE:
|
||||||
//stay
|
//stay
|
||||||
boostModeOn = false;
|
boostModeOn = false;
|
||||||
break;
|
break;
|
||||||
case BUTTON_BOTH:
|
case BUTTON_BOTH:
|
||||||
//exit
|
//exit
|
||||||
return;
|
return;
|
||||||
break;
|
break;
|
||||||
case BUTTON_B_LONG:
|
case BUTTON_B_LONG:
|
||||||
return; //exit on back long hold
|
return; //exit on back long hold
|
||||||
break;
|
break;
|
||||||
case BUTTON_F_LONG:
|
case BUTTON_F_LONG:
|
||||||
//if boost mode is enabled turn it on
|
//if boost mode is enabled turn it on
|
||||||
if (systemSettings.boostModeEnabled)
|
if (systemSettings.boostModeEnabled)
|
||||||
boostModeOn = true;
|
boostModeOn = true;
|
||||||
break;
|
break;
|
||||||
case BUTTON_F_SHORT:
|
case BUTTON_F_SHORT:
|
||||||
case BUTTON_B_SHORT: {
|
case BUTTON_B_SHORT: {
|
||||||
uint16_t oldTemp = systemSettings.SolderingTemp;
|
uint16_t oldTemp = systemSettings.SolderingTemp;
|
||||||
gui_solderingTempAdjust(); //goto adjust temp mode
|
gui_solderingTempAdjust(); //goto adjust temp mode
|
||||||
if (oldTemp != systemSettings.SolderingTemp) {
|
if (oldTemp != systemSettings.SolderingTemp) {
|
||||||
saveSettings(); //only save on change
|
saveSettings(); //only save on change
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
//else we update the screen information
|
//else we update the screen information
|
||||||
lcd.setCursor(0, 0);
|
lcd.setCursor(0, 0);
|
||||||
@@ -616,15 +631,19 @@ static void gui_solderingMode() {
|
|||||||
//Update the setpoints for the temperature
|
//Update the setpoints for the temperature
|
||||||
if (boostModeOn) {
|
if (boostModeOn) {
|
||||||
if (systemSettings.temperatureInF)
|
if (systemSettings.temperatureInF)
|
||||||
currentlyActiveTemperatureTarget = ftoTipMeasurement(systemSettings.BoostTemp);
|
currentlyActiveTemperatureTarget = ftoTipMeasurement(
|
||||||
|
systemSettings.BoostTemp);
|
||||||
else
|
else
|
||||||
currentlyActiveTemperatureTarget = ctoTipMeasurement(systemSettings.BoostTemp);
|
currentlyActiveTemperatureTarget = ctoTipMeasurement(
|
||||||
|
systemSettings.BoostTemp);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (systemSettings.temperatureInF)
|
if (systemSettings.temperatureInF)
|
||||||
currentlyActiveTemperatureTarget = ftoTipMeasurement(systemSettings.SolderingTemp);
|
currentlyActiveTemperatureTarget = ftoTipMeasurement(
|
||||||
|
systemSettings.SolderingTemp);
|
||||||
else
|
else
|
||||||
currentlyActiveTemperatureTarget = ctoTipMeasurement(systemSettings.SolderingTemp);
|
currentlyActiveTemperatureTarget = ctoTipMeasurement(
|
||||||
|
systemSettings.SolderingTemp);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Undervoltage test
|
//Undervoltage test
|
||||||
@@ -634,7 +653,8 @@ static void gui_solderingMode() {
|
|||||||
|
|
||||||
lcd.refresh();
|
lcd.refresh();
|
||||||
if (systemSettings.sensitivity)
|
if (systemSettings.sensitivity)
|
||||||
if (HAL_GetTick() - lastMovementTime > sleepThres && HAL_GetTick() - lastButtonTime > sleepThres) {
|
if (HAL_GetTick() - lastMovementTime > sleepThres
|
||||||
|
&& HAL_GetTick() - lastButtonTime > sleepThres) {
|
||||||
if (gui_SolderingSleepingMode()) {
|
if (gui_SolderingSleepingMode()) {
|
||||||
return; //If the function returns non-0 then exit
|
return; //If the function returns non-0 then exit
|
||||||
}
|
}
|
||||||
@@ -669,74 +689,78 @@ void startGUITask(void const * argument) {
|
|||||||
|
|
||||||
uint8_t animationStep = 0;
|
uint8_t animationStep = 0;
|
||||||
uint8_t tempWarningState = 0;
|
uint8_t tempWarningState = 0;
|
||||||
|
|
||||||
|
HAL_IWDG_Refresh(&hiwdg);
|
||||||
|
if (showBootLogoIfavailable())
|
||||||
|
waitForButtonPressOrTimeout(2000);
|
||||||
|
HAL_IWDG_Refresh(&hiwdg);
|
||||||
if (systemSettings.autoStartMode) {
|
if (systemSettings.autoStartMode) {
|
||||||
//jump directly to the autostart mode
|
//jump directly to the autostart mode
|
||||||
if (systemSettings.autoStartMode == 1)
|
if (systemSettings.autoStartMode == 1)
|
||||||
gui_solderingMode();
|
gui_solderingMode();
|
||||||
}
|
}
|
||||||
HAL_IWDG_Refresh(&hiwdg);
|
|
||||||
if (showBootLogoIfavailable())
|
|
||||||
waitForButtonPressOrTimeout(1000);
|
|
||||||
HAL_IWDG_Refresh(&hiwdg);
|
|
||||||
#if ACCELDEBUG
|
#if ACCELDEBUG
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
HAL_IWDG_Refresh(&hiwdg);
|
HAL_IWDG_Refresh(&hiwdg);
|
||||||
osDelay(100);
|
osDelay(100);
|
||||||
}
|
}
|
||||||
|
//^ Kept here for a way to block this thread
|
||||||
#endif
|
#endif
|
||||||
//^ Kept here for a way to block this thread
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
ButtonState buttons = getButtonState();
|
ButtonState buttons = getButtonState();
|
||||||
if (tempWarningState == 2)
|
if (tempWarningState == 2)
|
||||||
buttons = BUTTON_F_SHORT;
|
buttons = BUTTON_F_SHORT;
|
||||||
switch (buttons) {
|
switch (buttons) {
|
||||||
case BUTTON_NONE:
|
case BUTTON_NONE:
|
||||||
//Do nothing
|
//Do nothing
|
||||||
break;
|
break;
|
||||||
case BUTTON_BOTH:
|
case BUTTON_BOTH:
|
||||||
//Not used yet
|
//Not used yet
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BUTTON_B_LONG:
|
case BUTTON_B_LONG:
|
||||||
//Show the version information
|
//Show the version information
|
||||||
{
|
{
|
||||||
lcd.clearScreen(); //Ensure the buffer starts clean
|
lcd.clearScreen(); //Ensure the buffer starts clean
|
||||||
lcd.setCursor(0, 0); //Position the cursor at the 0,0 (top left)
|
lcd.setCursor(0, 0); //Position the cursor at the 0,0 (top left)
|
||||||
lcd.setFont(1); //small font
|
lcd.setFont(1); //small font
|
||||||
lcd.print((char*) "V2.00"); //Print version number
|
lcd.print((char*) "V2.00"); //Print version number
|
||||||
lcd.setCursor(0, 8); //second line
|
lcd.setCursor(0, 8); //second line
|
||||||
lcd.print(__DATE__); //print the compile date
|
lcd.print(__DATE__); //print the compile date
|
||||||
lcd.refresh();
|
lcd.refresh();
|
||||||
waitForButtonPress();
|
waitForButtonPress();
|
||||||
lcd.setFont(0); //reset font
|
lcd.setFont(0); //reset font
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BUTTON_F_LONG:
|
case BUTTON_F_LONG:
|
||||||
gui_solderingTempAdjust();
|
gui_solderingTempAdjust();
|
||||||
saveSettings();
|
saveSettings();
|
||||||
break;
|
break;
|
||||||
case BUTTON_F_SHORT:
|
case BUTTON_F_SHORT:
|
||||||
lcd.setFont(0);
|
lcd.setFont(0);
|
||||||
lcd.displayOnOff(true); //turn lcd on
|
lcd.displayOnOff(true); //turn lcd on
|
||||||
gui_solderingMode(); //enter soldering mode
|
gui_solderingMode(); //enter soldering mode
|
||||||
tempWarningState = 0; //make sure warning can show
|
tempWarningState = 0; //make sure warning can show
|
||||||
break;
|
break;
|
||||||
case BUTTON_B_SHORT:
|
case BUTTON_B_SHORT:
|
||||||
lcd.setFont(0);
|
lcd.setFont(0);
|
||||||
lcd.displayOnOff(true); //turn lcd on
|
lcd.displayOnOff(true); //turn lcd on
|
||||||
gui_settingsMenu(); //enter the settings menu
|
gui_settingsMenu(); //enter the settings menu
|
||||||
saveSettings();
|
saveSettings();
|
||||||
setCalibrationOffset(systemSettings.CalibrationOffset); //ensure cal offset is applied
|
setCalibrationOffset(systemSettings.CalibrationOffset); //ensure cal offset is applied
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
currentlyActiveTemperatureTarget = 0; //ensure tip is off
|
currentlyActiveTemperatureTarget = 0; //ensure tip is off
|
||||||
|
|
||||||
if (systemSettings.sensitivity) {
|
if (systemSettings.sensitivity) {
|
||||||
if ((HAL_GetTick() - lastMovementTime) > 60000 && (HAL_GetTick() - lastButtonTime) > 60000)
|
if ((HAL_GetTick() - lastMovementTime) > 60000
|
||||||
|
&& (HAL_GetTick() - lastButtonTime) > 60000)
|
||||||
lcd.displayOnOff(false); // turn lcd off when no movement
|
lcd.displayOnOff(false); // turn lcd off when no movement
|
||||||
else if (HAL_GetTick() - lastMovementTime < 1000 || HAL_GetTick() - lastButtonTime < 1000) /*Use short time for test, and prevent lots of I2C writes for no need*/
|
else if (HAL_GetTick() - lastMovementTime < 1000
|
||||||
|
|| HAL_GetTick() - lastButtonTime < 1000) /*Use short time for test, and prevent lots of I2C writes for no need*/
|
||||||
lcd.displayOnOff(true); //turn lcd back on
|
lcd.displayOnOff(true); //turn lcd back on
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -773,9 +797,11 @@ void startGUITask(void const * argument) {
|
|||||||
}
|
}
|
||||||
lcd.setCursor(0, 8);
|
lcd.setCursor(0, 8);
|
||||||
lcd.print("Input V: ");
|
lcd.print("Input V: ");
|
||||||
lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) / 10, 2);
|
lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) / 10,
|
||||||
|
2);
|
||||||
lcd.drawChar('.');
|
lcd.drawChar('.');
|
||||||
lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) % 10, 1);
|
lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) % 10,
|
||||||
|
1);
|
||||||
lcd.print("V");
|
lcd.print("V");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -785,7 +811,7 @@ void startGUITask(void const * argument) {
|
|||||||
lcd.setCursor(0, 0);
|
lcd.setCursor(0, 0);
|
||||||
gui_drawBatteryIcon();
|
gui_drawBatteryIcon();
|
||||||
} else {
|
} else {
|
||||||
lcd.drawArea(0, 0, 84, 16, idleScreenBGF); //Needs to be flipped
|
lcd.drawArea(0, 0, 84, 16, idleScreenBGF); //Needs to be flipped
|
||||||
lcd.setCursor(84, 0);
|
lcd.setCursor(84, 0);
|
||||||
gui_drawBatteryIcon();
|
gui_drawBatteryIcon();
|
||||||
}
|
}
|
||||||
@@ -857,7 +883,7 @@ void startPIDTask(void const * argument) {
|
|||||||
|
|
||||||
setTipPWM(output);
|
setTipPWM(output);
|
||||||
} else {
|
} else {
|
||||||
setTipPWM(0); //disable the output driver if the output is set to be off elsewhere
|
setTipPWM(0); //disable the output driver if the output is set to be off elsewhere
|
||||||
integralCount = 0;
|
integralCount = 0;
|
||||||
backoffOverflow = 0;
|
backoffOverflow = 0;
|
||||||
}
|
}
|
||||||
@@ -886,7 +912,7 @@ void startMOVTask(void const * argument) {
|
|||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
int32_t threshold = 1200 + (9 * 200);
|
int32_t threshold = 1200 + (9 * 200);
|
||||||
threshold -= systemSettings.sensitivity * 200; // 200 is the step size
|
threshold -= systemSettings.sensitivity * 200; // 200 is the step size
|
||||||
accel.getAxisReadings(&tx, &ty, &tz);
|
accel.getAxisReadings(&tx, &ty, &tz);
|
||||||
|
|
||||||
datax[currentPointer] = (int32_t) tx;
|
datax[currentPointer] = (int32_t) tx;
|
||||||
@@ -959,19 +985,20 @@ void startRotationTask(void const * argument) {
|
|||||||
HAL_NVIC_EnableIRQ(EXTI9_5_IRQn);
|
HAL_NVIC_EnableIRQ(EXTI9_5_IRQn);
|
||||||
//^ We hold off enabling these until now to ensure the semaphore is available to be used first
|
//^ We hold off enabling these until now to ensure the semaphore is available to be used first
|
||||||
switch (systemSettings.OrientationMode) {
|
switch (systemSettings.OrientationMode) {
|
||||||
case 0:
|
case 0:
|
||||||
lcd.setRotation(false);
|
lcd.setRotation(false);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
lcd.setRotation(true);
|
lcd.setRotation(true);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
lcd.setRotation(false);
|
lcd.setRotation(false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if ( xSemaphoreTake( rotationChangedSemaphore, portMAX_DELAY ) == pdTRUE
|
if ( xSemaphoreTake( rotationChangedSemaphore, portMAX_DELAY ) == pdTRUE
|
||||||
|| (HAL_GPIO_ReadPin(INT_Orientation_GPIO_Port, INT_Orientation_Pin) == GPIO_PIN_RESET)) {
|
|| (HAL_GPIO_ReadPin(INT_Orientation_GPIO_Port,
|
||||||
|
INT_Orientation_Pin) == GPIO_PIN_RESET)) {
|
||||||
// a rotation event has occured
|
// a rotation event has occured
|
||||||
bool rotation = accel.getOrientation();
|
bool rotation = accel.getOrientation();
|
||||||
if (systemSettings.OrientationMode == 2)
|
if (systemSettings.OrientationMode == 2)
|
||||||
@@ -986,7 +1013,8 @@ void startRotationTask(void const * argument) {
|
|||||||
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
|
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
|
||||||
static signed long xHigherPriorityTaskWoken;
|
static signed long xHigherPriorityTaskWoken;
|
||||||
if (GPIO_Pin == INT_Orientation_Pin) {
|
if (GPIO_Pin == INT_Orientation_Pin) {
|
||||||
xSemaphoreGiveFromISR(rotationChangedSemaphore, &xHigherPriorityTaskWoken);
|
xSemaphoreGiveFromISR(rotationChangedSemaphore,
|
||||||
|
&xHigherPriorityTaskWoken);
|
||||||
} else if (GPIO_Pin == INT_Movement_Pin) {
|
} else if (GPIO_Pin == INT_Movement_Pin) {
|
||||||
//New data is available for reading from the unit
|
//New data is available for reading from the unit
|
||||||
//xSemaphoreGiveFromISR(accelDataAvailableSemaphore, &xHigherPriorityTaskWoken);
|
//xSemaphoreGiveFromISR(accelDataAvailableSemaphore, &xHigherPriorityTaskWoken);
|
||||||
|
|||||||
Reference in New Issue
Block a user