1
0
forked from me/IronOS

Merge pull request #535 from Ralim/feat/Settings-Reset-Should-Warn

Show warning message when settings are reset from a firmware update.
This commit is contained in:
Ben V. Brown
2019-12-28 12:36:42 +11:00
committed by GitHub
10 changed files with 3617 additions and 3559 deletions

View File

@@ -96,6 +96,8 @@ def getConstants():
consants.append(('SymbolCellCount', 'S'))
consants.append(('SymbolVersionNumber', 'V2.06'))
return consants
def getTipModelEnumTS80():
constants = []
constants.append("B02")
@@ -104,6 +106,7 @@ def getTipModelEnumTS80():
constants.append("User") # User
return constants
def getTipModelEnumTS100():
constants = []
constants.append("B02")
@@ -116,6 +119,7 @@ def getTipModelEnumTS100():
constants.append("User")
return constants
def getDebugMenu():
constants = []
constants.append(datetime.today().strftime('%d-%m-%y'))
@@ -198,12 +202,11 @@ def getLetterCounts(defs, lang):
return symbolCounts
def getFontMapAndTable(textList):
# the text list is sorted
# allocate out these in their order as number codes
symbolMap = {}
symbolMap['\n'] = '\\x01'
symbolMap['\n'] = '\\x01' # Force insert the newline char
index = 2 # start at 2, as 0= null terminator,1 = new line
forcedFirstSymbols = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
# enforce numbers are first
@@ -229,12 +232,14 @@ def getFontMapAndTable(textList):
print('Missing Large font element for {}'.format(sym))
exit(1)
fontLine = fontTable[sym]
fontTableStrings.append(fontLine + "//{} -> {}".format(symbolMap[sym],sym))
fontTableStrings.append(
fontLine + "//{} -> {}".format(symbolMap[sym], sym))
if sym not in fontSmallTable:
print('Missing Small font element for {}'.format(sym))
exit(1)
fontLine = fontSmallTable[sym]
fontSmallTableStrings.append(fontLine + "//{} -> {}".format(symbolMap[sym],sym))
fontSmallTableStrings.append(
fontLine + "//{} -> {}".format(symbolMap[sym], sym))
for sym in textList:
if sym not in fontTable:
@@ -242,12 +247,14 @@ def getFontMapAndTable(textList):
exit(1)
if sym not in forcedFirstSymbols:
fontLine = fontTable[sym]
fontTableStrings.append(fontLine + "//{} -> {}".format(symbolMap[sym],sym))
fontTableStrings.append(
fontLine + "//{} -> {}".format(symbolMap[sym], sym))
if sym not in fontSmallTable:
print('Missing Small font element for {}'.format(sym))
exit(1)
fontLine = fontSmallTable[sym]
fontSmallTableStrings.append(fontLine + "//{} -> {}".format(symbolMap[sym],sym))
fontSmallTableStrings.append(
fontLine + "//{} -> {}".format(symbolMap[sym], sym))
outputTable = "const uint8_t USER_FONT_12[] = {" + to_unicode("\n")
for line in fontTableStrings:
# join font table int one large string
@@ -290,7 +297,6 @@ def writeLanguage(languageCode, defs, f):
f.write(to_unicode("// ---- " + langName + " ----\n\n"))
# ----- Writing SettingsDescriptions
obj = lang['menuOptions']
f.write(to_unicode("const char* SettingsDescriptions[] = {\n"))
@@ -316,14 +322,15 @@ def writeLanguage(languageCode, defs, f):
for mod in defs['messages']:
eid = mod['id']
if eid not in obj:
sourceText = ""
if 'default' in mod:
sourceText = (mod['default'])
if eid in obj:
sourceText = (obj[eid])
translatedText = convStr(symbolConversionTable, sourceText)
f.write(
to_unicode("const char* " + eid + " = \"" +
convStr(symbolConversionTable, (mod['default'])) + "\";"+ "//{} \n".format(mod['default'])))
else:
f.write(
to_unicode("const char* " + eid + " = \"" +
convStr(symbolConversionTable, (obj[eid])) + "\";"+ "//{} \n".format(obj[eid])))
translatedText + "\";" + "//{} \n".format(sourceText.replace('\n', '_'))))
f.write(to_unicode("\n"))
@@ -352,10 +359,12 @@ def writeLanguage(languageCode, defs, f):
f.write(to_unicode("const char* TipModelStrings[] = {\n"))
f.write(to_unicode("#ifdef MODEL_TS100\n"))
for c in getTipModelEnumTS100():
f.write(to_unicode("\t \"" + convStr(symbolConversionTable, c) + "\","+ "//{} \n".format(c)))
f.write(to_unicode("\t \"" + convStr(symbolConversionTable,
c) + "\"," + "//{} \n".format(c)))
f.write(to_unicode("#else\n"))
for c in getTipModelEnumTS80():
f.write(to_unicode("\t \"" + convStr(symbolConversionTable, c) + "\","+ "//{} \n".format(c)))
f.write(to_unicode("\t \"" + convStr(symbolConversionTable,
c) + "\"," + "//{} \n".format(c)))
f.write(to_unicode("#endif\n"))
f.write(to_unicode("};\n\n"))
@@ -364,7 +373,8 @@ def writeLanguage(languageCode, defs, f):
f.write(to_unicode("const char* DebugMenu[] = {\n"))
for c in getDebugMenu():
f.write(to_unicode("\t \"" + convStr(symbolConversionTable, c) + "\","+ "//{} \n".format(c)))
f.write(to_unicode("\t \"" + convStr(symbolConversionTable,
c) + "\"," + "//{} \n".format(c)))
f.write(to_unicode("};\n\n"))
# ----- Menu Options

View File

@@ -22,7 +22,8 @@
"SolderingAdvancedPowerPrompt": "Power: ",
"OffString": "Off",
"ResetOKMessage": "Reset OK",
"YourGainMessage":"Your Gain:"
"YourGainMessage": "Your Gain:",
"SettingsResetMessage": "Settings were\nreset!"
},
"characters": {
"SettingRightChar": "R",

View File

@@ -89,6 +89,11 @@ var def =
"id": "YourGainMessage",
"maxLen": 8,
"default": "Your Gain"
},
{
"id": "SettingsResetMessage",
"maxLen": 16,
"default": "Settings were\nreset!"
}
],
"characters": [

View File

@@ -11,7 +11,7 @@
#define SETTINGS_H_
#include <stdint.h>
#include "stm32f1xx_hal.h"
#define SETTINGSVERSION ( 0x1A )
#define SETTINGSVERSION ( 0x1B )
/*Change this if you change the struct below to prevent people getting \
out of sync*/
@@ -53,7 +53,7 @@ typedef struct {
extern volatile systemSettingsType systemSettings;
void saveSettings();
void restoreSettings();
bool restoreSettings();
uint8_t lookupVoltageLevel(uint8_t level);
void resetSettings();
bool showBootLogoIfavailable();

View File

@@ -43,6 +43,7 @@ extern const char* SolderingAdvancedPowerPrompt;
extern const char* OffString;
extern const char* ResetOKMessage;
extern const char* YourGainMessage;
extern const char* SettingsResetMessage;
extern const char* SettingTrueChar;
extern const char* SettingFalseChar;

View File

@@ -6,6 +6,7 @@
#include "Setup.h"
extern uint8_t PCBVersion;
extern uint32_t currentTempTargetDegC;
extern bool settingsWereReset;
enum ButtonState {
BUTTON_NONE = 0, /* No buttons pressed / < filter time*/
BUTTON_F_SHORT = 1, /* User has pressed the front button*/

View File

@@ -702,6 +702,17 @@ void startGUITask(void const *argument __unused) {
ticks = xTaskGetTickCount(); // make timeout now so we will exit
GUIDelay();
}
if (settingsWereReset) {
//Display alert settings were reset
OLED::setFont(1);
OLED::setCursor(0, 0);
OLED::print(SettingsResetMessage);
OLED::refresh();
waitForButtonPressOrTimeout(1000);
}
if (systemSettings.autoStartMode) {
// jump directly to the autostart mode
if (systemSettings.autoStartMode == 1)

View File

@@ -25,8 +25,8 @@ void saveSettings() {
pEraseInit.PageAddress = FLASH_ADDR;
uint32_t failingAddress = 0;
HAL_IWDG_Refresh(&hiwdg);
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP | FLASH_FLAG_WRPERR | FLASH_FLAG_PGERR |
FLASH_FLAG_BSY);
__HAL_FLASH_CLEAR_FLAG(
FLASH_FLAG_EOP | FLASH_FLAG_WRPERR | FLASH_FLAG_PGERR | FLASH_FLAG_BSY);
HAL_FLASH_Unlock();
HAL_Delay(10);
HAL_IWDG_Refresh(&hiwdg);
@@ -45,7 +45,7 @@ void saveSettings() {
HAL_FLASH_Lock();
}
void restoreSettings() {
bool restoreSettings() {
// We read the flash
uint16_t *data = (uint16_t*) &systemSettings;
for (uint8_t i = 0; i < (sizeof(systemSettingsType) / 2); i++) {
@@ -57,7 +57,9 @@ void restoreSettings() {
if (systemSettings.version != SETTINGSVERSION) {
// probably not setup
resetSettings();
return true;
}
return false;
}
// Lookup function for cutoff setting -> X10 voltage
/*
@@ -75,8 +77,7 @@ uint8_t lookupVoltageLevel(uint8_t level) {
}
void resetSettings() {
memset((void*) &systemSettings, 0, sizeof(systemSettingsType));
systemSettings.SleepTemp =
150; // Temperature the iron sleeps at - default 150.0 C
systemSettings.SleepTemp = 150; // Temperature the iron sleeps at - default 150.0 C
systemSettings.SleepTime = 6; // How many seconds/minutes we wait until going
// to sleep - default 1 min
systemSettings.SolderingTemp = 320; // Default soldering temp is 320.0 C
@@ -84,8 +85,7 @@ void resetSettings() {
systemSettings.version =
SETTINGSVERSION; // Store the version number to allow for easier upgrades
systemSettings.detailedSoldering = 0; // Detailed soldering screen
systemSettings.detailedIDLE =
0; // Detailed idle screen (off for first time users)
systemSettings.detailedIDLE = 0; // Detailed idle screen (off for first time users)
systemSettings.OrientationMode = 2; // Default to automatic
systemSettings.sensitivity = 7; // Default high sensitivity
#ifdef MODEL_TS80
@@ -94,26 +94,23 @@ void resetSettings() {
#else
systemSettings.voltageDiv = 467; // Default divider from schematic
#endif
systemSettings.ShutdownTime =
10; // How many minutes until the unit turns itself off
systemSettings.boostModeEnabled =
1; // Default to having boost mode on as most people prefer it
systemSettings.ShutdownTime = 10; // How many minutes until the unit turns itself off
systemSettings.boostModeEnabled = 1; // Default to having boost mode on as most people prefer it
systemSettings.BoostTemp = 420; // default to 400C
systemSettings.autoStartMode = 0; // Auto start off for safety
systemSettings.coolingTempBlink =
0; // Blink the temperature on the cooling screen when its > 50C
systemSettings.coolingTempBlink = 0; // Blink the temperature on the cooling screen when its > 50C
systemSettings.temperatureInF = 0; // default to 0
systemSettings.descriptionScrollSpeed = 0; // default to slow
#ifdef MODEL_TS100
systemSettings.CalibrationOffset = 850; // the adc offset in uV
systemSettings.CalibrationOffset = 900; // the adc offset in uV
systemSettings.pidPowerLimit=70; // Sets the max pwm power limit
#endif
#ifdef MODEL_TS80
systemSettings.pidPowerLimit = 24; // Sets the max pwm power limit
systemSettings.CalibrationOffset = 300; // the adc offset in uV
systemSettings.CalibrationOffset = 900; // the adc offset in uV
#endif
saveSettings(); // Save defaults
}

File diff suppressed because it is too large Load Diff

View File

@@ -17,6 +17,7 @@ uint8_t PCBVersion = 0;
uint32_t currentTempTargetDegC = 0; // Current temperature target in C
uint32_t lastMovementTime = 0;
int16_t idealQCVoltage = 0;
bool settingsWereReset = false;
// FreeRTOS variables
osThreadId GUITaskHandle;
@@ -70,7 +71,7 @@ int main(void) {
systemSettings.sensitivity = 0;
}
HAL_IWDG_Refresh(&hiwdg);
restoreSettings(); // load the settings from flash
settingsWereReset = restoreSettings(); // load the settings from flash
HAL_IWDG_Refresh(&hiwdg);