diff --git a/workspace/TS100/Makefile b/workspace/TS100/Makefile index 6c7a60c7..c9ba0ee7 100644 --- a/workspace/TS100/Makefile +++ b/workspace/TS100/Makefile @@ -1,3 +1,9 @@ + +OUTPUT_EXE=TS100_$(lang) +ifndef lang +lang:= EN +endif + # Discover the source files to build SOURCE := $(shell find . -type f -name '*.c') SOURCE_CPP := $(shell find . -type f -name '*.cpp') @@ -29,12 +35,7 @@ OPTIM=-O2 -finline-small-functions -findirect-inlining -fdiagnostics-color # global defines --------------------------------------------------------------- -# Enable ROM library -#GLOBAL_DEFINES=-DTARGET_IS_BLIZZARD_RB1 -DUART_BUFFERED -# Without ROM library -#GLOBAL_DEFINES=-D DEPRECATED -#GLOBAL_DEFINES += -D SIMULATION_BOARD -GLOBAL_DEFINES += -D STM32F103T8Ux -D STM32F1 -D STM32 -D USE_HAL_DRIVER -D STM32F103xB -D USE_RTOS_SYSTICK +GLOBAL_DEFINES += -D STM32F103T8Ux -D STM32F1 -D STM32 -D USE_HAL_DRIVER -D STM32F103xB -D USE_RTOS_SYSTICK -D LANG_$(lang) # Enable debug code generation DEBUG=-g @@ -165,22 +166,22 @@ OBJS_CPP = $(SOURCE_CPP:.cpp=.o) OBJS_S = $(S_SRCS:.s=.o) -OUTPUT_EXE=TS100 + OUT_OBJS=$(addprefix $(OUTPUT_DIR)/,$(OBJS)) OUT_OBJS_CPP=$(addprefix $(OUTPUT_DIR)/,$(OBJS_CPP)) OUT_OBJS_S=$(addprefix $(OUTPUT_DIR)/,$(OBJS_S)) OUT_HEXFILE=$(addprefix $(HEXFILE_DIR)/,$(OUTPUT_EXE)) all: $(OUT_HEXFILE).hex - + # # The rule to create the target directory # # Create hexfile -$(OUT_HEXFILE).hex : $(OUT_HEXFILE).elf - $(SIZE) -x $(OUT_HEXFILE).elf - $(OBJCOPY) $(OUT_HEXFILE).elf -O ihex $(OUT_HEXFILE).hex +%.hex : %.elf + $(SIZE) -x $^ + $(OBJCOPY) $^ -O ihex $@ $(OUT_HEXFILE).elf : $(OUT_OBJS) $(OUT_OBJS_CPP) $(OUT_OBJS_S) Makefile $(LDSCRIPT) @test -d $(@D) || mkdir -p $(@D) diff --git a/workspace/TS100/build.sh b/workspace/TS100/build.sh new file mode 100755 index 00000000..b5740819 --- /dev/null +++ b/workspace/TS100/build.sh @@ -0,0 +1,25 @@ +make clean +make -j16 lang=EN +rm -rf Objects/src +make -j16 lang=CS_CZ +rm -rf Objects/src +make -j16 lang=DE +rm -rf Objects/src +make -j16 lang=DK +rm -rf Objects/src +make -j16 lang=ES +rm -rf Objects/src +make -j16 lang=FR +rm -rf Objects/src +make -j16 lang=HR +rm -rf Objects/src +make -j16 lang=IT +rm -rf Objects/src +make -j16 lang=PL +rm -rf Objects/src +make -j16 lang=RU +rm -rf Objects/src +make -j16 lang=SE +rm -rf Objects/src +make -j16 lang=TR +rm -rf Objects/src diff --git a/workspace/TS100/inc/Translation.h b/workspace/TS100/inc/Translation.h index c660430d..ca23e6f0 100644 --- a/workspace/TS100/inc/Translation.h +++ b/workspace/TS100/inc/Translation.h @@ -32,17 +32,5 @@ extern const char SettingRightChar; extern const char SettingLeftChar; extern const char SettingAutoChar; -#define LANG_EN -//#define LANG_RU -//#define LANG_ES -//#define LANG_SE -//#define LANG_IT -//#define LANG_FR -//#define LANG_DE -//#define LANG_CS_CZ -//#define LANG_TR -//#define LANG_HR -//#define LANG_PL -//#define LANG_DK #endif /* TRANSLATION_H_ */ diff --git a/workspace/TS100/src/Translation.c b/workspace/TS100/src/Translation.c index a5ba8d96..6fcb7364 100644 --- a/workspace/TS100/src/Translation.c +++ b/workspace/TS100/src/Translation.c @@ -6,10 +6,11 @@ */ #include "Translation.h" -// TEMPLATES for short names - choose one and use it as base for your translation: +// TEMPLATES for short names - choose one and use it as base for your +// translation: -//const enum ShortNameType SettingsShortNameType = SHORT_NAME_SINGLE_LINE; -//const char* SettingsShortNames[16][2] = { +// const enum ShortNameType SettingsShortNameType = SHORT_NAME_SINGLE_LINE; +// const char* SettingsShortNames[16][2] = { // /* (<= 5) Power source (DC or batt) */ {"PWRSC"}, // /* (<= 4) Sleep temperature */ {"STMP"}, // /* (<= 4) Sleep timeout */ {"STME"}, @@ -28,24 +29,31 @@ // /* (<= 6) Advanced soldering screen enabled */ {"ADVSLD"}, //}; -//const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE; -//const char* SettingsShortNames[16][2] = { +// const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE; +// const char* SettingsShortNames[16][2] = { // /* (<= 11) Power source (DC or batt) */ {"Power", "source"}, // /* (<= 9) Sleep temperature */ {"Sleep", "temp"}, // /* (<= 9) Sleep timeout */ {"Sleep", "timeout"}, // /* (<= 11) Shutdown timeout */ {"Shutdown", "timeout"}, -// /* (<= 13) Motion sensitivity level */ {"Motion", "sensitivity"}, +// /* (<= 13) Motion sensitivity level */ {"Motion", +// "sensitivity"}, // /* (<= 13) Temperature in F and C */ {"Temperature", "units"}, -// /* (<= 13) Advanced idle display mode enabled */ {"Detailed", "idle screen"}, -// /* (<= 13) Display rotation mode */ {"Display", "orientation"}, -// /* (<= 13) Boost enabled */ {"Boost mode", "enabled"}, +// /* (<= 13) Advanced idle display mode enabled */ {"Detailed", "idle +// screen"}, +// /* (<= 13) Display rotation mode */ {"Display", +// "orientation"}, +// /* (<= 13) Boost enabled */ {"Boost mode", +// "enabled"}, // /* (<= 9) Boost temperature */ {"Boost", "temp"}, // /* (<= 13) Automatic start mode */ {"Auto", "start"}, // /* (<= 13) Cooldown blink */ {"Cooldown", "blink"}, -// /* (<= 16) Temperature calibration enter menu */ {"Calibrate", "temperature?"}, +// /* (<= 16) Temperature calibration enter menu */ {"Calibrate", +// "temperature?"}, // /* (<= 16) Settings reset command */ {"Factory", "Reset?"}, -// /* (<= 16) Calibrate input voltage */ {"Calibrate", "input voltage?"}, -// /* (<= 13) Advanced soldering screen enabled */ {"Detailed", "solder screen"}, +// /* (<= 16) Calibrate input voltage */ {"Calibrate", "input +// voltage?"}, +// /* (<= 13) Advanced soldering screen enabled */ {"Detailed", "solder +// screen"}, //}; #ifdef LANG_EN @@ -71,11 +79,11 @@ const char* SettingsLongNames[16] = /* Advanced soldering screen enabled */"Display detailed information while soldering", }; const char* SettingsCalibrationWarning = - "Please ensure the tip is at room temperature before continuing!"; -const char* UVLOWarningString = "LOW VOLT"; //Fixed width 8 chars -const char* SleepingSimpleString = "Zzzz"; // Must be <= 4 chars -const char* SleepingAdvancedString = "Sleeping..."; // <=17 chars -const char* WarningSimpleString = "HOT!"; //Must be <= 4 chars + "Please ensure the tip is at room temperature before continuing!"; +const char* UVLOWarningString = "LOW VOLT"; // Fixed width 8 chars +const char* SleepingSimpleString = "Zzzz"; // Must be <= 4 chars +const char* SleepingAdvancedString = "Sleeping..."; // <=17 chars +const char* WarningSimpleString = "HOT!"; // Must be <= 4 chars const char* WarningAdvancedString = "WARNING! TIP HOT!"; const char SettingTrueChar = 'T'; @@ -86,22 +94,26 @@ const char SettingAutoChar = 'A'; const enum ShortNameType SettingsShortNameType = SHORT_NAME_DOUBLE_LINE; const char* SettingsShortNames[16][2] = { -/* (<= 11) Power source (DC or batt) */{ "Power", "source" }, -/* (<= 9) Sleep temperature */{ "Sleep", "temp" }, -/* (<= 9) Sleep timeout */{ "Sleep", "timeout" }, -/* (<= 11) Shutdown timeout */{ "Shutdown", "timeout" }, -/* (<= 13) Motion sensitivity level */{ "Motion", "sensitivity" }, -/* (<= 13) Temperature in F and C */{ "Temperature", "units" }, -/* (<= 13) Advanced idle display mode enabled */{ "Detailed", "idle screen" }, -/* (<= 13) Display rotation mode */{ "Display", "orientation" }, -/* (<= 13) Boost enabled */{ "Boost mode", "enabled" }, -/* (<= 9) Boost temperature */{ "Boost", "temp" }, -/* (<= 13) Automatic start mode */{ "Auto", "start" }, -/* (<= 13) Cooldown blink */{ "Cooldown", "blink" }, -/* (<= 16) Temperature calibration enter menu */{ "Calibrate", "temperature?" }, -/* (<= 16) Settings reset command */{ "Factory", "Reset?" }, -/* (<= 16) Calibrate input voltage */{ "Calibrate", "input voltage?" }, -/* (<= 13) Advanced soldering screen enabled */{ "Detailed", "solder screen" }, + /* (<= 11) Power source (DC or batt) */ {"Power", "source"}, + /* (<= 9) Sleep temperature */ {"Sleep", "temp"}, + /* (<= 9) Sleep timeout */ {"Sleep", "timeout"}, + /* (<= 11) Shutdown timeout */ {"Shutdown", "timeout"}, + /* (<= 13) Motion sensitivity level */ {"Motion", "sensitivity"}, + /* (<= 13) Temperature in F and C */ {"Temperature", "units"}, + /* (<= 13) Advanced idle display mode enabled */ {"Detailed", + "idle screen"}, + /* (<= 13) Display rotation mode */ {"Display", "orientation"}, + /* (<= 13) Boost enabled */ {"Boost mode", "enabled"}, + /* (<= 9) Boost temperature */ {"Boost", "temp"}, + /* (<= 13) Automatic start mode */ {"Auto", "start"}, + /* (<= 13) Cooldown blink */ {"Cooldown", "blink"}, + /* (<= 16) Temperature calibration enter menu */ {"Calibrate", + "temperature?"}, + /* (<= 16) Settings reset command */ {"Factory", "Reset?"}, + /* (<= 16) Calibrate input voltage */ {"Calibrate", + "input voltage?"}, + /* (<= 13) Advanced soldering screen enabled */ {"Detailed", + "solder screen"}, }; #endif @@ -127,11 +139,13 @@ const char* SettingsLongNames[16] = { /* Advanced soldering screen enabled */"Показывать детальную информацию при пайке.", }; -const char* SettingsCalibrationWarning = "Убедитесь, что жало остыло до комнатной температуры, прежде чем продолжать!"; -const char* UVLOWarningString = "БАТ РАЗР"; //Fixed width 8 chars -const char* SleepingSimpleString = "Хррр";// Must be <= 4 chars -const char* SleepingAdvancedString = "Ожидание...";// <=17 chars -const char* WarningSimpleString = " АЙ!";//Must be <= 4 chars +const char* SettingsCalibrationWarning = + "Убедитесь, что жало остыло до комнатной температуры, прежде чем " + "продолжать!"; +const char* UVLOWarningString = "БАТ РАЗР"; // Fixed width 8 chars +const char* SleepingSimpleString = "Хррр"; // Must be <= 4 chars +const char* SleepingAdvancedString = "Ожидание..."; // <=17 chars +const char* WarningSimpleString = " АЙ!"; // Must be <= 4 chars const char* WarningAdvancedString = "ОСТОРОЖНО! ГОРЯЧО"; const char SettingTrueChar = '+'; @@ -148,22 +162,22 @@ const char SettingAutoChar = 'A'; const enum ShortNameType SettingsShortNameType = SHORT_NAME_SINGLE_LINE; const char* SettingsShortNames[16][2] = { - /* (<= 5) Power source (DC or batt) */{"ИстП "}, - /* (<= 4) Sleep temperature */{"Тожд"}, - /* (<= 4) Sleep timeout */{"Вожд "}, - /* (<= 5) Shutdown timeout */{"Тоткл "}, - /* (<= 6) Motion sensitivity level */{"ЧувсДв "}, - /* (<= 6) Temperature in F and C */{"ЕдТемп "}, - /* (<= 6) Advanced idle display mode enabled */{"ИнфОжд "}, - /* (<= 6) Display rotation mode */{"ПовЭкр "}, - /* (<= 6) Boost enabled */{"Турбо "}, - /* (<= 4) Boost temperature */{"Ттур "}, - /* (<= 6) Automatic start mode */{"Астарт"}, - /* (<= 6) Cooldown blink */{"Охлажд "}, - /* (<= 8) Temperature calibration enter menu */{"КалибрТ"}, - /* (<= 8) Settings reset command */{"СБРОС?"}, - /* (<= 8) Calibrate input voltage */{"КалибрU?"}, - /* (<= 6) Advanced soldering screen enabled */{"ИнфПай "}, + /* (<= 5) Power source (DC or batt) */ {"ИстП "}, + /* (<= 4) Sleep temperature */ {"Тожд"}, + /* (<= 4) Sleep timeout */ {"Вожд "}, + /* (<= 5) Shutdown timeout */ {"Тоткл "}, + /* (<= 6) Motion sensitivity level */ {"ЧувсДв "}, + /* (<= 6) Temperature in F and C */ {"ЕдТемп "}, + /* (<= 6) Advanced idle display mode enabled */ {"ИнфОжд "}, + /* (<= 6) Display rotation mode */ {"ПовЭкр "}, + /* (<= 6) Boost enabled */ {"Турбо "}, + /* (<= 4) Boost temperature */ {"Ттур "}, + /* (<= 6) Automatic start mode */ {"Астарт"}, + /* (<= 6) Cooldown blink */ {"Охлажд "}, + /* (<= 8) Temperature calibration enter menu */ {"КалибрТ"}, + /* (<= 8) Settings reset command */ {"СБРОС?"}, + /* (<= 8) Calibrate input voltage */ {"КалибрU?"}, + /* (<= 6) Advanced soldering screen enabled */ {"ИнфПай "}, }; #endif @@ -189,11 +203,12 @@ const char* SettingsLongNames[16] = { /* Advanced soldering screen enabled */"Display detailed information while soldering", }; -const char* SettingsCalibrationWarning = "Please ensure the tip is at room temperature before continuing!"; -const char* UVLOWarningString = "LOW VOLT"; //Fixed width 8 chars -const char* SleepingSimpleString = "Zzzz";// Must be <= 4 chars -const char* SleepingAdvancedString = "Sleeping...";// <=17 chars -const char* WarningSimpleString = "HOT!";//Must be <= 4 chars +const char* SettingsCalibrationWarning = + "Please ensure the tip is at room temperature before continuing!"; +const char* UVLOWarningString = "LOW VOLT"; // Fixed width 8 chars +const char* SleepingSimpleString = "Zzzz"; // Must be <= 4 chars +const char* SleepingAdvancedString = "Sleeping..."; // <=17 chars +const char* WarningSimpleString = "HOT!"; // Must be <= 4 chars const char* WarningAdvancedString = "WARNING! TIP HOT!"; const char SettingTrueChar = 'T'; @@ -204,22 +219,22 @@ const char SettingAutoChar = 'A'; const enum ShortNameType SettingsShortNameType = SHORT_NAME_SINGLE_LINE; const char* SettingsShortNames[16][2] = { - /* (<= 5) Power source (DC or batt) */{"PWRSC"}, - /* (<= 4) Sleep temperature */{"STMP"}, - /* (<= 4) Sleep timeout */{"STME"}, - /* (<= 5) Shutdown timeout */{"SHTME"}, - /* (<= 6) Motion sensitivity level */{"MSENSE"}, - /* (<= 6) Temperature in F and C */{"TMPUNT"}, - /* (<= 6) Advanced idle display mode enabled */{"ADVIDL"}, - /* (<= 6) Display rotation mode */{"DSPROT"}, - /* (<= 6) Boost enabled */{"BOOST"}, - /* (<= 4) Boost temperature */{"BTMP"}, - /* (<= 6) Automatic start mode */{"ASTART"}, - /* (<= 6) Cooldown blink */{"CLBLNK"}, - /* (<= 8) Temperature calibration enter menu */{"TMP CAL?"}, - /* (<= 8) Settings reset command */{"RESET?"}, - /* (<= 8) Calibrate input voltage */{"CAL VIN?"}, - /* (<= 6) Advanced soldering screen enabled */{"ADVSLD"}, + /* (<= 5) Power source (DC or batt) */ {"PWRSC"}, + /* (<= 4) Sleep temperature */ {"STMP"}, + /* (<= 4) Sleep timeout */ {"STME"}, + /* (<= 5) Shutdown timeout */ {"SHTME"}, + /* (<= 6) Motion sensitivity level */ {"MSENSE"}, + /* (<= 6) Temperature in F and C */ {"TMPUNT"}, + /* (<= 6) Advanced idle display mode enabled */ {"ADVIDL"}, + /* (<= 6) Display rotation mode */ {"DSPROT"}, + /* (<= 6) Boost enabled */ {"BOOST"}, + /* (<= 4) Boost temperature */ {"BTMP"}, + /* (<= 6) Automatic start mode */ {"ASTART"}, + /* (<= 6) Cooldown blink */ {"CLBLNK"}, + /* (<= 8) Temperature calibration enter menu */ {"TMP CAL?"}, + /* (<= 8) Settings reset command */ {"RESET?"}, + /* (<= 8) Calibrate input voltage */ {"CAL VIN?"}, + /* (<= 6) Advanced soldering screen enabled */ {"ADVSLD"}, }; #endif @@ -245,11 +260,12 @@ const char* SettingsLongNames[16] = { /* Advanced soldering screen enabled */"Display detailed information while soldering", }; -const char* SettingsCalibrationWarning = "Please ensure the tip is at room temperature before continuing!"; -const char* UVLOWarningString = "LOW VOLT"; //Fixed width 8 chars -const char* SleepingSimpleString = "Zzzz";// Must be <= 4 chars -const char* SleepingAdvancedString = "Sleeping...";// <=17 chars -const char* WarningSimpleString = "HOT!";//Must be <= 4 chars +const char* SettingsCalibrationWarning = + "Please ensure the tip is at room temperature before continuing!"; +const char* UVLOWarningString = "LOW VOLT"; // Fixed width 8 chars +const char* SleepingSimpleString = "Zzzz"; // Must be <= 4 chars +const char* SleepingAdvancedString = "Sleeping..."; // <=17 chars +const char* WarningSimpleString = "HOT!"; // Must be <= 4 chars const char* WarningAdvancedString = "WARNING! TIP HOT!"; const char SettingTrueChar = 'T'; @@ -260,22 +276,22 @@ const char SettingAutoChar = 'A'; const enum ShortNameType SettingsShortNameType = SHORT_NAME_SINGLE_LINE; const char* SettingsShortNames[16][2] = { - /* (<= 5) Power source (DC or batt) */{"PWRSC"}, - /* (<= 4) Sleep temperature */{"STMP"}, - /* (<= 4) Sleep timeout */{"STME"}, - /* (<= 5) Shutdown timeout */{"SHTME"}, - /* (<= 6) Motion sensitivity level */{"MSENSE"}, - /* (<= 6) Temperature in F and C */{"TMPUNT"}, - /* (<= 6) Advanced idle display mode enabled */{"ADVIDL"}, - /* (<= 6) Display rotation mode */{"DSPROT"}, - /* (<= 6) Boost enabled */{"BOOST"}, - /* (<= 4) Boost temperature */{"BTMP"}, - /* (<= 6) Automatic start mode */{"ASTART"}, - /* (<= 6) Cooldown blink */{"CLBLNK"}, - /* (<= 8) Temperature calibration enter menu */{"TMP CAL?"}, - /* (<= 8) Settings reset command */{"RESET?"}, - /* (<= 8) Calibrate input voltage */{"CAL VIN?"}, - /* (<= 6) Advanced soldering screen enabled */{"ADVSLD"}, + /* (<= 5) Power source (DC or batt) */ {"PWRSC"}, + /* (<= 4) Sleep temperature */ {"STMP"}, + /* (<= 4) Sleep timeout */ {"STME"}, + /* (<= 5) Shutdown timeout */ {"SHTME"}, + /* (<= 6) Motion sensitivity level */ {"MSENSE"}, + /* (<= 6) Temperature in F and C */ {"TMPUNT"}, + /* (<= 6) Advanced idle display mode enabled */ {"ADVIDL"}, + /* (<= 6) Display rotation mode */ {"DSPROT"}, + /* (<= 6) Boost enabled */ {"BOOST"}, + /* (<= 4) Boost temperature */ {"BTMP"}, + /* (<= 6) Automatic start mode */ {"ASTART"}, + /* (<= 6) Cooldown blink */ {"CLBLNK"}, + /* (<= 8) Temperature calibration enter menu */ {"TMP CAL?"}, + /* (<= 8) Settings reset command */ {"RESET?"}, + /* (<= 8) Calibrate input voltage */ {"CAL VIN?"}, + /* (<= 6) Advanced soldering screen enabled */ {"ADVSLD"}, }; #endif @@ -301,11 +317,13 @@ const char* SettingsLongNames[16] = { /* Advanced soldering screen enabled */"Mostra informazioni dettagliate mentre stai saldando", }; -const char* SettingsCalibrationWarning = "Assicurati che la punta si trovi a temperatura ambiente prima di continuare!"; -const char* UVLOWarningString = "LOW VOLT"; //Fixed width 8 chars -const char* SleepingSimpleString = "Zzzz";// Must be <= 4 chars -const char* SleepingAdvancedString = "Standby";// <=17 chars -const char* WarningSimpleString = "HOT!";//Must be <= 4 chars +const char* SettingsCalibrationWarning = + "Assicurati che la punta si trovi a temperatura ambiente prima di " + "continuare!"; +const char* UVLOWarningString = "LOW VOLT"; // Fixed width 8 chars +const char* SleepingSimpleString = "Zzzz"; // Must be <= 4 chars +const char* SleepingAdvancedString = "Standby"; // <=17 chars +const char* WarningSimpleString = "HOT!"; // Must be <= 4 chars const char* WarningAdvancedString = "ATTENZIONE! PUNTA CALDA!"; const char SettingTrueChar = 'A'; @@ -316,22 +334,22 @@ const char SettingAutoChar = 'A'; const enum ShortNameType SettingsShortNameType = SHORT_NAME_SINGLE_LINE; const char* SettingsShortNames[16][2] = { - /* (<= 5) Power source (DC or batt) */{"PWRSC"}, - /* (<= 4) Sleep temperature */{"STMP"}, - /* (<= 4) Sleep timeout */{"STME"}, - /* (<= 5) Shutdown timeout */{"SHTME"}, - /* (<= 6) Motion sensitivity level */{"MSENSE"}, - /* (<= 6) Temperature in F and C */{"TMPUNT"}, - /* (<= 6) Advanced idle display mode enabled */{"ADVIDL"}, - /* (<= 6) Display rotation mode */{"DSPROT"}, - /* (<= 6) Boost enabled */{"BOOST"}, - /* (<= 4) Boost temperature */{"BTMP"}, - /* (<= 6) Automatic start mode */{"ASTART"}, - /* (<= 6) Cooldown blink */{"CLBLNK"}, - /* (<= 8) Temperature calibration enter menu */{"TMP CAL?"}, - /* (<= 8) Settings reset command */{"RESET?"}, - /* (<= 8) Calibrate input voltage */{"CAL VIN?"}, - /* (<= 6) Advanced soldering screen enabled */{"ADVSLD"}, + /* (<= 5) Power source (DC or batt) */ {"PWRSC"}, + /* (<= 4) Sleep temperature */ {"STMP"}, + /* (<= 4) Sleep timeout */ {"STME"}, + /* (<= 5) Shutdown timeout */ {"SHTME"}, + /* (<= 6) Motion sensitivity level */ {"MSENSE"}, + /* (<= 6) Temperature in F and C */ {"TMPUNT"}, + /* (<= 6) Advanced idle display mode enabled */ {"ADVIDL"}, + /* (<= 6) Display rotation mode */ {"DSPROT"}, + /* (<= 6) Boost enabled */ {"BOOST"}, + /* (<= 4) Boost temperature */ {"BTMP"}, + /* (<= 6) Automatic start mode */ {"ASTART"}, + /* (<= 6) Cooldown blink */ {"CLBLNK"}, + /* (<= 8) Temperature calibration enter menu */ {"TMP CAL?"}, + /* (<= 8) Settings reset command */ {"RESET?"}, + /* (<= 8) Calibrate input voltage */ {"CAL VIN?"}, + /* (<= 6) Advanced soldering screen enabled */ {"ADVSLD"}, }; #endif @@ -357,11 +375,12 @@ const char* SettingsLongNames[16] = { /* Advanced soldering screen enabled */"Afficher des informations detaillees pendant la soudure", }; -const char* SettingsCalibrationWarning = "Please ensure the tip is at room temperature before continuing!"; -const char* UVLOWarningString = "LOW VOLT"; //Fixed width 8 chars -const char* SleepingSimpleString = "Zzzz";// Must be <= 4 chars -const char* SleepingAdvancedString = "Sleeping...";// <=17 chars -const char* WarningSimpleString = "HOT!";//Must be <= 4 chars +const char* SettingsCalibrationWarning = + "Please ensure the tip is at room temperature before continuing!"; +const char* UVLOWarningString = "LOW VOLT"; // Fixed width 8 chars +const char* SleepingSimpleString = "Zzzz"; // Must be <= 4 chars +const char* SleepingAdvancedString = "Sleeping..."; // <=17 chars +const char* WarningSimpleString = "HOT!"; // Must be <= 4 chars const char* WarningAdvancedString = "WARNING! TIP HOT!"; const char SettingTrueChar = 'T'; @@ -372,22 +391,22 @@ const char SettingAutoChar = 'A'; const enum ShortNameType SettingsShortNameType = SHORT_NAME_SINGLE_LINE; const char* SettingsShortNames[16][2] = { - /* (<= 5) Power source (DC or batt) */{"PWRSC"}, - /* (<= 4) Sleep temperature */{"STMP"}, - /* (<= 4) Sleep timeout */{"STME"}, - /* (<= 5) Shutdown timeout */{"SHTME"}, - /* (<= 6) Motion sensitivity level */{"MSENSE"}, - /* (<= 6) Temperature in F and C */{"TMPUNT"}, - /* (<= 6) Advanced idle display mode enabled */{"ADVIDL"}, - /* (<= 6) Display rotation mode */{"DSPROT"}, - /* (<= 6) Boost enabled */{"BOOST"}, - /* (<= 4) Boost temperature */{"BTMP"}, - /* (<= 6) Automatic start mode */{"ASTART"}, - /* (<= 6) Cooldown blink */{"CLBLNK"}, - /* (<= 8) Temperature calibration enter menu */{"TMP CAL?"}, - /* (<= 8) Settings reset command */{"RESET?"}, - /* (<= 8) Calibrate input voltage */{"CAL VIN?"}, - /* (<= 6) Advanced soldering screen enabled */{"ADVSLD"}, + /* (<= 5) Power source (DC or batt) */ {"PWRSC"}, + /* (<= 4) Sleep temperature */ {"STMP"}, + /* (<= 4) Sleep timeout */ {"STME"}, + /* (<= 5) Shutdown timeout */ {"SHTME"}, + /* (<= 6) Motion sensitivity level */ {"MSENSE"}, + /* (<= 6) Temperature in F and C */ {"TMPUNT"}, + /* (<= 6) Advanced idle display mode enabled */ {"ADVIDL"}, + /* (<= 6) Display rotation mode */ {"DSPROT"}, + /* (<= 6) Boost enabled */ {"BOOST"}, + /* (<= 4) Boost temperature */ {"BTMP"}, + /* (<= 6) Automatic start mode */ {"ASTART"}, + /* (<= 6) Cooldown blink */ {"CLBLNK"}, + /* (<= 8) Temperature calibration enter menu */ {"TMP CAL?"}, + /* (<= 8) Settings reset command */ {"RESET?"}, + /* (<= 8) Calibrate input voltage */ {"CAL VIN?"}, + /* (<= 6) Advanced soldering screen enabled */ {"ADVSLD"}, }; #endif @@ -413,11 +432,12 @@ const char* SettingsLongNames[16] = { /* Advanced soldering screen enabled */"Detaillierte Anzeige im Lötmodus ", }; -const char* SettingsCalibrationWarning = "Vor dem Fortfahren muss die Lötspitze vollständig abgekühlt sein!"; -const char* UVLOWarningString = "LOW VOLT"; //Fixed width 8 chars -const char* SleepingSimpleString = "Zzz ";// Must be <= 4 chars -const char* SleepingAdvancedString = "Ruhemodus...";// <=17 chars -const char* WarningSimpleString = "HEIß";//Must be <= 4 chars +const char* SettingsCalibrationWarning = + "Vor dem Fortfahren muss die Lötspitze vollständig abgekühlt sein!"; +const char* UVLOWarningString = "LOW VOLT"; // Fixed width 8 chars +const char* SleepingSimpleString = "Zzz "; // Must be <= 4 chars +const char* SleepingAdvancedString = "Ruhemodus..."; // <=17 chars +const char* WarningSimpleString = "HEIß"; // Must be <= 4 chars const char* WarningAdvancedString = "Achtung! Spitze Heiß!"; const char SettingTrueChar = 'T'; @@ -428,22 +448,22 @@ const char SettingAutoChar = 'A'; const enum ShortNameType SettingsShortNameType = SHORT_NAME_SINGLE_LINE; const char* SettingsShortNames[16][2] = { - /* (<= 5) Power source (DC or batt) */{"PWRSC"}, - /* (<= 4) Sleep temperature */{"STMP"}, - /* (<= 4) Sleep timeout */{"STME"}, - /* (<= 5) Shutdown timeout */{"SHTME"}, - /* (<= 6) Motion sensitivity level */{"MSENSE"}, - /* (<= 6) Temperature in F and C */{"TMPUNT"}, - /* (<= 6) Advanced idle display mode enabled */{"ADVIDL"}, - /* (<= 6) Display rotation mode */{"DSPROT"}, - /* (<= 6) Boost enabled */{"BOOST"}, - /* (<= 4) Boost temperature */{"BTMP"}, - /* (<= 6) Automatic start mode */{"ASTART"}, - /* (<= 6) Cooldown blink */{"CLBLNK"}, - /* (<= 8) Temperature calibration enter menu */{"TMP CAL?"}, - /* (<= 8) Settings reset command */{"RESET?"}, - /* (<= 8) Calibrate input voltage */{"CAL VIN?"}, - /* (<= 6) Advanced soldering screen enabled */{"ADVSLD"}, + /* (<= 5) Power source (DC or batt) */ {"PWRSC"}, + /* (<= 4) Sleep temperature */ {"STMP"}, + /* (<= 4) Sleep timeout */ {"STME"}, + /* (<= 5) Shutdown timeout */ {"SHTME"}, + /* (<= 6) Motion sensitivity level */ {"MSENSE"}, + /* (<= 6) Temperature in F and C */ {"TMPUNT"}, + /* (<= 6) Advanced idle display mode enabled */ {"ADVIDL"}, + /* (<= 6) Display rotation mode */ {"DSPROT"}, + /* (<= 6) Boost enabled */ {"BOOST"}, + /* (<= 4) Boost temperature */ {"BTMP"}, + /* (<= 6) Automatic start mode */ {"ASTART"}, + /* (<= 6) Cooldown blink */ {"CLBLNK"}, + /* (<= 8) Temperature calibration enter menu */ {"TMP CAL?"}, + /* (<= 8) Settings reset command */ {"RESET?"}, + /* (<= 8) Calibrate input voltage */ {"CAL VIN?"}, + /* (<= 6) Advanced soldering screen enabled */ {"ADVSLD"}, }; #endif @@ -469,11 +489,12 @@ const char* SettingsLongNames[16] = { /* Advanced soldering screen enabled */"Zobrazenie detailov pocas spajkovania ", }; -const char* SettingsCalibrationWarning = "Najprv sa prosim uistite, ze hrot ma izbovu teplotu!"; -const char* UVLOWarningString = "LOW VOLT"; //Fixed width 8 chars -const char* SleepingSimpleString = "Chrr";// Must be <= 4 chars -const char* SleepingAdvancedString = "Kludovy rezim...";// <=17 chars -const char* WarningSimpleString = "HOT!";//Must be <= 4 chars +const char* SettingsCalibrationWarning = + "Najprv sa prosim uistite, ze hrot ma izbovu teplotu!"; +const char* UVLOWarningString = "LOW VOLT"; // Fixed width 8 chars +const char* SleepingSimpleString = "Chrr"; // Must be <= 4 chars +const char* SleepingAdvancedString = "Kludovy rezim..."; // <=17 chars +const char* WarningSimpleString = "HOT!"; // Must be <= 4 chars const char* WarningAdvancedString = "Pozor! Hrot je horuci!"; const char SettingTrueChar = 'T'; @@ -484,22 +505,22 @@ const char SettingAutoChar = 'A'; const enum ShortNameType SettingsShortNameType = SHORT_NAME_SINGLE_LINE; const char* SettingsShortNames[16][2] = { - /* (<= 5) Power source (DC or batt) */{"PWRSC"}, - /* (<= 4) Sleep temperature */{"STMP"}, - /* (<= 4) Sleep timeout */{"STME"}, - /* (<= 5) Shutdown timeout */{"SHTME"}, - /* (<= 6) Motion sensitivity level */{"MSENSE"}, - /* (<= 6) Temperature in F and C */{"TMPUNT"}, - /* (<= 6) Advanced idle display mode enabled */{"ADVIDL"}, - /* (<= 6) Display rotation mode */{"DSPROT"}, - /* (<= 6) Boost enabled */{"BOOST"}, - /* (<= 4) Boost temperature */{"BTMP"}, - /* (<= 6) Automatic start mode */{"ASTART"}, - /* (<= 6) Cooldown blink */{"CLBLNK"}, - /* (<= 8) Temperature calibration enter menu */{"TMP CAL?"}, - /* (<= 8) Settings reset command */{"RESET?"}, - /* (<= 8) Calibrate input voltage */{"CAL VIN?"}, - /* (<= 6) Advanced soldering screen enabled */{"ADVSLD"}, + /* (<= 5) Power source (DC or batt) */ {"PWRSC"}, + /* (<= 4) Sleep temperature */ {"STMP"}, + /* (<= 4) Sleep timeout */ {"STME"}, + /* (<= 5) Shutdown timeout */ {"SHTME"}, + /* (<= 6) Motion sensitivity level */ {"MSENSE"}, + /* (<= 6) Temperature in F and C */ {"TMPUNT"}, + /* (<= 6) Advanced idle display mode enabled */ {"ADVIDL"}, + /* (<= 6) Display rotation mode */ {"DSPROT"}, + /* (<= 6) Boost enabled */ {"BOOST"}, + /* (<= 4) Boost temperature */ {"BTMP"}, + /* (<= 6) Automatic start mode */ {"ASTART"}, + /* (<= 6) Cooldown blink */ {"CLBLNK"}, + /* (<= 8) Temperature calibration enter menu */ {"TMP CAL?"}, + /* (<= 8) Settings reset command */ {"RESET?"}, + /* (<= 8) Calibrate input voltage */ {"CAL VIN?"}, + /* (<= 6) Advanced soldering screen enabled */ {"ADVSLD"}, }; #endif @@ -525,11 +546,12 @@ const char* SettingsLongNames[16] = { /* Advanced soldering screen enabled */"Lehimleme yaparken detaylı bilgi göster", }; -const char* SettingsCalibrationWarning = "Lütfen devam etmeden önce ucun oda sıcaklığında olduğunu garantiye alın!"; -const char* UVLOWarningString = "LOW VOLT"; //Fixed width 8 chars -const char* SleepingSimpleString = "Zzzz";// Must be <= 4 chars -const char* SleepingAdvancedString = "Uyuyor...";// <=17 chars -const char* WarningSimpleString = "HOT!";//Must be <= 4 chars +const char* SettingsCalibrationWarning = + "Lütfen devam etmeden önce ucun oda sıcaklığında olduğunu garantiye alın!"; +const char* UVLOWarningString = "LOW VOLT"; // Fixed width 8 chars +const char* SleepingSimpleString = "Zzzz"; // Must be <= 4 chars +const char* SleepingAdvancedString = "Uyuyor..."; // <=17 chars +const char* WarningSimpleString = "HOT!"; // Must be <= 4 chars const char* WarningAdvancedString = "UYARI! UÇ SICAK!"; const char SettingTrueChar = 'T'; @@ -540,22 +562,22 @@ const char SettingAutoChar = 'A'; const enum ShortNameType SettingsShortNameType = SHORT_NAME_SINGLE_LINE; const char* SettingsShortNames[16][2] = { - /* (<= 5) Power source (DC or batt) */{"PWRSC"}, - /* (<= 4) Sleep temperature */{"STMP"}, - /* (<= 4) Sleep timeout */{"STME"}, - /* (<= 5) Shutdown timeout */{"SHTME"}, - /* (<= 6) Motion sensitivity level */{"MSENSE"}, - /* (<= 6) Temperature in F and C */{"TMPUNT"}, - /* (<= 6) Advanced idle display mode enabled */{"ADVIDL"}, - /* (<= 6) Display rotation mode */{"DSPROT"}, - /* (<= 6) Boost enabled */{"BOOST"}, - /* (<= 4) Boost temperature */{"BTMP"}, - /* (<= 6) Automatic start mode */{"ASTART"}, - /* (<= 6) Cooldown blink */{"CLBLNK"}, - /* (<= 8) Temperature calibration enter menu */{"TMP CAL?"}, - /* (<= 8) Settings reset command */{"RESET?"}, - /* (<= 8) Calibrate input voltage */{"CAL VIN?"}, - /* (<= 6) Advanced soldering screen enabled */{"ADVSLD"}, + /* (<= 5) Power source (DC or batt) */ {"PWRSC"}, + /* (<= 4) Sleep temperature */ {"STMP"}, + /* (<= 4) Sleep timeout */ {"STME"}, + /* (<= 5) Shutdown timeout */ {"SHTME"}, + /* (<= 6) Motion sensitivity level */ {"MSENSE"}, + /* (<= 6) Temperature in F and C */ {"TMPUNT"}, + /* (<= 6) Advanced idle display mode enabled */ {"ADVIDL"}, + /* (<= 6) Display rotation mode */ {"DSPROT"}, + /* (<= 6) Boost enabled */ {"BOOST"}, + /* (<= 4) Boost temperature */ {"BTMP"}, + /* (<= 6) Automatic start mode */ {"ASTART"}, + /* (<= 6) Cooldown blink */ {"CLBLNK"}, + /* (<= 8) Temperature calibration enter menu */ {"TMP CAL?"}, + /* (<= 8) Settings reset command */ {"RESET?"}, + /* (<= 8) Calibrate input voltage */ {"CAL VIN?"}, + /* (<= 6) Advanced soldering screen enabled */ {"ADVSLD"}, }; #endif @@ -581,11 +603,13 @@ const char* SettingsLongNames[16] = { /* Advanced soldering screen enabled */"Prikazivanje detaljnih informacija tijekom lemljenja.", }; -const char* SettingsCalibrationWarning = "Provjerite da je vršak ohlađen na sobnu temperaturu prije nego što nastavite!"; -const char* UVLOWarningString = "NAPON!!!"; //Fixed width 8 chars -const char* SleepingSimpleString = "Zzzz";// Must be <= 4 chars -const char* SleepingAdvancedString = "Spavanje...";// <=17 chars -const char* WarningSimpleString = "VRUĆ";//Must be <= 4 chars +const char* SettingsCalibrationWarning = + "Provjerite da je vršak ohlađen na sobnu temperaturu prije nego što " + "nastavite!"; +const char* UVLOWarningString = "NAPON!!!"; // Fixed width 8 chars +const char* SleepingSimpleString = "Zzzz"; // Must be <= 4 chars +const char* SleepingAdvancedString = "Spavanje..."; // <=17 chars +const char* WarningSimpleString = "VRUĆ"; // Must be <= 4 chars const char* WarningAdvancedString = "OPREZ! Vršak je vruć!"; const char SettingTrueChar = '+'; @@ -596,53 +620,60 @@ const char SettingAutoChar = 'A'; const enum ShortNameType SettingsShortNameType = SHORT_NAME_SINGLE_LINE; const char* SettingsShortNames[16][2] = { - /* (<= 5) Power source (DC or batt) */{"PWRSC"}, - /* (<= 4) Sleep temperature */{"STMP"}, - /* (<= 4) Sleep timeout */{"STME"}, - /* (<= 5) Shutdown timeout */{"SHTME"}, - /* (<= 6) Motion sensitivity level */{"MSENSE"}, - /* (<= 6) Temperature in F and C */{"TMPUNT"}, - /* (<= 6) Advanced idle display mode enabled */{"ADVIDL"}, - /* (<= 6) Display rotation mode */{"DSPROT"}, - /* (<= 6) Boost enabled */{"BOOST"}, - /* (<= 4) Boost temperature */{"BTMP"}, - /* (<= 6) Automatic start mode */{"ASTART"}, - /* (<= 6) Cooldown blink */{"CLBLNK"}, - /* (<= 8) Temperature calibration enter menu */{"TMP CAL?"}, - /* (<= 8) Settings reset command */{"RESET?"}, - /* (<= 8) Calibrate input voltage */{"CAL VIN?"}, - /* (<= 6) Advanced soldering screen enabled */{"ADVSLD"}, + /* (<= 5) Power source (DC or batt) */ {"PWRSC"}, + /* (<= 4) Sleep temperature */ {"STMP"}, + /* (<= 4) Sleep timeout */ {"STME"}, + /* (<= 5) Shutdown timeout */ {"SHTME"}, + /* (<= 6) Motion sensitivity level */ {"MSENSE"}, + /* (<= 6) Temperature in F and C */ {"TMPUNT"}, + /* (<= 6) Advanced idle display mode enabled */ {"ADVIDL"}, + /* (<= 6) Display rotation mode */ {"DSPROT"}, + /* (<= 6) Boost enabled */ {"BOOST"}, + /* (<= 4) Boost temperature */ {"BTMP"}, + /* (<= 6) Automatic start mode */ {"ASTART"}, + /* (<= 6) Cooldown blink */ {"CLBLNK"}, + /* (<= 8) Temperature calibration enter menu */ {"TMP CAL?"}, + /* (<= 8) Settings reset command */ {"RESET?"}, + /* (<= 8) Calibrate input voltage */ {"CAL VIN?"}, + /* (<= 6) Advanced soldering screen enabled */ {"ADVSLD"}, }; #endif #ifdef LANG_CS_CZ const char* SettingsLongNames[16] = { - /*These are all the help text for all the settings.*/ - /*No requirements on spacing or length*/ - "Zdroj napajeni. Pri nizsim napeti se odpoji ", //Power Source - "Teplota v rezimu spanku",//Sleep Temp - "Cas do rezimu spanku ",//Sleep Timeout - "Cas do automatickeho vypnuti ",//Shutdown Time - "Citlivost detekce pohybu <0=Vyp, 1=Min, ... 9=Max>",//Motion Sensitivity - "Jednotky mereni teploty ",//Temp Unit - "Zobrazit podrobnosti na vychozi obrazovce ",//Detailed Information - "Otoceni displaye ",//Orientation - "Povolit boost drzenim leveho tlacitka pri pajeni ",//Boost enable - "Teplota pri boostu",//Boost Temp - "Pri startu ihned nahrivat hrot ",//Auto start - "Blikani teploty pri chladnuti, dokud je hrot horky ",//Cooling Blink - "Kalibrovat mereni teploty",//Calibrate Tip - "Obnovit tovarni nastaveni",//Reset Settings - "Kalibrovat vstupni napeti. Tlacitky upravte, podrzenim potvrdte.",//VIN Cal - "Zobrazit podrobnosti pri pajeni ",//ADV SLD + /*These are all the help text for all the settings.*/ + /*No requirements on spacing or length*/ + "Zdroj napajeni. Pri nizsim napeti se odpoji ", // Power Source + "Teplota v rezimu spanku", // Sleep Temp + "Cas do rezimu spanku ", // Sleep Timeout + "Cas do automatickeho vypnuti ", // Shutdown Time + "Citlivost detekce pohybu <0=Vyp, 1=Min, ... 9=Max>", // Motion Sensitivity + "Jednotky mereni teploty ", // Temp Unit + "Zobrazit podrobnosti na vychozi obrazovce ", // Detailed + // Information + "Otoceni displaye ", // Orientation + "Povolit boost drzenim leveho tlacitka pri pajeni ", // Boost + // enable + "Teplota pri boostu", // Boost Temp + "Pri startu ihned nahrivat hrot ", // Auto + // start + "Blikani teploty pri chladnuti, dokud je hrot horky ", // Cooling + // Blink + "Kalibrovat mereni teploty", // Calibrate Tip + "Obnovit tovarni nastaveni", // Reset Settings + "Kalibrovat vstupni napeti. Tlacitky upravte, podrzenim potvrdte.", // VIN + // Cal + "Zobrazit podrobnosti pri pajeni ", // ADV SLD }; -const char* SettingsCalibrationWarning = "Ujistete se, ze hrot ma pokojovou teplotu! "; //ending space needed -const char* UVLOWarningString = "LOW VOLT";//Fixed width 8 chars -const char* SleepingSimpleString = "Zzz ";// Must be <= 4 chars -const char* SleepingAdvancedString = "Rezim spanku...";// <=17 chars -const char* WarningSimpleString = "HOT!";//Must be <= 4 chars -const char* WarningAdvancedString = "!! HORKY HROT !!";// <= 16 chars +const char* SettingsCalibrationWarning = + "Ujistete se, ze hrot ma pokojovou teplotu! "; // ending space needed +const char* UVLOWarningString = "LOW VOLT"; // Fixed width 8 chars +const char* SleepingSimpleString = "Zzz "; // Must be <= 4 chars +const char* SleepingAdvancedString = "Rezim spanku..."; // <=17 chars +const char* WarningSimpleString = "HOT!"; // Must be <= 4 chars +const char* WarningAdvancedString = "!! HORKY HROT !!"; // <= 16 chars const char SettingTrueChar = 'Z'; const char SettingFalseChar = 'V'; @@ -656,48 +687,62 @@ const char* SettingsShortNames[16][2] = { /* (<= 9) Sleep temperature */ {"Teplota v", "r. spanku"}, /* (<= 9) Sleep timeout */ {"Cas do", "r. spanku"}, /* (<= 11) Shutdown timeout */ {"Cas do", "vypnuti"}, - /* (<= 13) Motion sensitivity level */ {"Citlivost", "det. pohybu"}, + /* (<= 13) Motion sensitivity level */ {"Citlivost", + "det. pohybu"}, /* (<= 13) Temperature in F and C */ {"Jednotky", "teploty"}, - /* (<= 13) Advanced idle display mode enabled */ {"Podrobnosti", "na vych. obr."}, + /* (<= 13) Advanced idle display mode enabled */ {"Podrobnosti", + "na vych. obr."}, /* (<= 13) Display rotation mode */ {"Otoceni", "obrazovky"}, /* (<= 13) Boost enabled */ {"Povolit", "boost"}, /* (<= 9) Boost temperature */ {"Teplota v", "r. boost"}, /* (<= 13) Automatic start mode */ {"Auto", "start"}, - /* (<= 13) Cooldown blink */ {"Blikani pri", "chladnuti"}, + /* (<= 13) Cooldown blink */ {"Blikani pri", + "chladnuti"}, /* (<= 16) Temperature calibration enter menu */ {"Kalibrovat", "teplotu?"}, /* (<= 16) Settings reset command */ {"Tovarni", "nastaveni?"}, - /* (<= 16) Calibrate input voltage */ {"Kalibrovat", "vstupni napeti?"}, - /* (<= 13) Advanced soldering screen enabled */ {"Podrobnosti", "pri pajeni"}, - }; + /* (<= 16) Calibrate input voltage */ {"Kalibrovat", + "vstupni napeti?"}, + /* (<= 13) Advanced soldering screen enabled */ {"Podrobnosti", + "pri pajeni"}, +}; #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. ", //Power Source - "Alvási hőmérséklet ",//Sleep Temp - "Elalvási időzítő ",//Sleep Timeout - "Kikapcsolási időzítő ",//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 ",//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 ",//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* 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. ", // Power Source + "Alvási hőmérséklet ", // Sleep Temp + "Elalvási időzítő ", // Sleep Timeout + "Kikapcsolási időzítő ", // 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 ", // 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 ", // 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* 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'; @@ -708,110 +753,58 @@ const char SettingAutoChar = 'A'; const enum ShortNameType SettingsShortNameType = SHORT_NAME_SINGLE_LINE; const char* SettingsShortNames[16][2] = { - /* (<= 5) Power source (DC or batt) */{"PWRSC"}, - /* (<= 4) Sleep temperature */{"STMP"}, - /* (<= 4) Sleep timeout */{"STME"}, - /* (<= 5) Shutdown timeout */{"SHTME"}, - /* (<= 6) Motion sensitivity level */{"MSENSE"}, - /* (<= 6) Temperature in F and C */{"TMPUNT"}, - /* (<= 6) Advanced idle display mode enabled */{"ADVIDL"}, - /* (<= 6) Display rotation mode */{"DSPROT"}, - /* (<= 6) Boost enabled */{"BOOST"}, - /* (<= 4) Boost temperature */{"BTMP"}, - /* (<= 6) Automatic start mode */{"ASTART"}, - /* (<= 6) Cooldown blink */{"CLBLNK"}, - /* (<= 8) Temperature calibration enter menu */{"TMP CAL?"}, - /* (<= 8) Settings reset command */{"RESET?"}, - /* (<= 8) Calibrate input voltage */{"CAL VIN?"}, - /* (<= 6) Advanced soldering screen enabled */{"ADVSLD"}, -}; -#endif - -#ifdef LANG_TR -const char* SettingsLongNames[16] = { - /*These are all the help text for all the settings.*/ - /*No requirements on spacing or length*/ - /* Power source (DC or batt) */"Güç Kaynağı. kesim geriliminı ayarlar. ", //Power Source - /* Sleep temperature */"Uyku Sıcaklığı ",//Sleep Temp - /* Sleep timeout */"Uyku Zaman Aşımı ",//Sleep Timeout - /* Shutdown timeout */"Kapatma Zaman Aşımı ",//Shutdown Time - /* Motion sensitivity level */"Hareket Hassasiyeti <0.Kapalı 1.En az duyarlı 9.En duyarlı>",//Motion Sensitivity - /* Temperature in F and C */"Sıcaklık Ünitesi ",//Temp Unit - /* Advanced idle display mode enabled */"Boş ekranda ayrıntılı bilgileri daha küçük bir yazı tipi ile göster.",//Detailed Information - /* Display rotation mode */"Görüntü Yönlendirme ",//Orientation - /* Boost enabled */"Lehimleme yaparken ön tuşa basmak Boost moduna sokar(450C)",//Boost enable - /* Boost temperature */"\"boost\" Modu Derecesi",//Boost Temp - /* Automatic start mode */"Güç verildiğinde otomatik olarak lehimleme modunda başlat. T=Lehimleme Modu, S= Uyku Modu,F=Kapalı",//Auto start - /* Cooldown blink */"Soğutma ekranında uç hala sıcakken derece yanıp sönsün.",//Cooling Blink - /* Temperature calibration enter menu */"Ucu kalibre et.",//Calibrate Tip - /* Settings reset command */"Bütün ayarları sıfırla",//Reset Settings - /* Calibrate input voltage */"VIN Kalibrasyonu. Düğmeler ayarlar, çıkmak için uzun bas.",//VIN Cal - /* Advanced soldering screen enabled */"Lehimleme yaparken detaylı bilgi göster",//ADV SLD -}; - -const char* SettingsCalibrationWarning = "Lütfen devam etmeden önce ucun oda sıcaklığında olduğunu garantiye alın!"; -const char* UVLOWarningString = "LOW VOLT"; //Fixed width 8 chars -const char* SleepingSimpleString = "Zzzz";// Must be <= 4 chars -const char* SleepingAdvancedString = "Uyuyor...";// <=17 chars -const char* WarningSimpleString = "HOT!";//Must be <= 4 chars -const char* WarningAdvancedString = "UYARI! UÇ SICAK!"; - -const char SettingTrueChar = 'T'; -const char SettingFalseChar = 'F'; -const char SettingRightChar = 'R'; -const char SettingLeftChar = 'L'; -const char SettingAutoChar = 'A'; - -const enum ShortNameType SettingsShortNameType = SHORT_NAME_SINGLE_LINE; -const char* SettingsShortNames[16][2] = { - /* (<= 5) Power source (DC or batt) */{"PWRSC"}, - /* (<= 4) Sleep temperature */{"STMP"}, - /* (<= 4) Sleep timeout */{"STME"}, - /* (<= 5) Shutdown timeout */{"SHTME"}, - /* (<= 6) Motion sensitivity level */{"MSENSE"}, - /* (<= 6) Temperature in F and C */{"TMPUNT"}, - /* (<= 6) Advanced idle display mode enabled */{"ADVIDL"}, - /* (<= 6) Display rotation mode */{"DSPROT"}, - /* (<= 6) Boost enabled */{"BOOST"}, - /* (<= 4) Boost temperature */{"BTMP"}, - /* (<= 6) Automatic start mode */{"ASTART"}, - /* (<= 6) Cooldown blink */{"CLBLNK"}, - /* (<= 8) Temperature calibration enter menu */{"TMP CAL?"}, - /* (<= 8) Settings reset command */{"RESET?"}, - /* (<= 8) Calibrate input voltage */{"CAL VIN?"}, - /* (<= 6) Advanced soldering screen enabled */{"ADVSLD"}, + /* (<= 5) Power source (DC or batt) */ {"PWRSC"}, + /* (<= 4) Sleep temperature */ {"STMP"}, + /* (<= 4) Sleep timeout */ {"STME"}, + /* (<= 5) Shutdown timeout */ {"SHTME"}, + /* (<= 6) Motion sensitivity level */ {"MSENSE"}, + /* (<= 6) Temperature in F and C */ {"TMPUNT"}, + /* (<= 6) Advanced idle display mode enabled */ {"ADVIDL"}, + /* (<= 6) Display rotation mode */ {"DSPROT"}, + /* (<= 6) Boost enabled */ {"BOOST"}, + /* (<= 4) Boost temperature */ {"BTMP"}, + /* (<= 6) Automatic start mode */ {"ASTART"}, + /* (<= 6) Cooldown blink */ {"CLBLNK"}, + /* (<= 8) Temperature calibration enter menu */ {"TMP CAL?"}, + /* (<= 8) Settings reset command */ {"RESET?"}, + /* (<= 8) Calibrate input voltage */ {"CAL VIN?"}, + /* (<= 6) Advanced soldering screen enabled */ {"ADVSLD"}, }; #endif #ifdef LANG_DK -const char* SettingsLongNames[16] = -{ - /*These are all the help text for all the settings.*/ - /*No requirements on spacing or length*/ - "Strømforsyning. Indstil Cutoff Spændingen. ", //Power Source - "Temperatura uśpienia <°C>",//Sleep Temp - "Czas uśpienia ",//Sleep Timeout - "Czas wyłączenia ",//Shutdown Time - "Czułość ruchu <0.Wyłączona 1.minimalna 9.maksymalna>",//Motion Sensitivity - "Jednostka temperatury ",//Temp Unit - "Wyświetla szczegółowe informacje za pomocą mniejszej czcionki na ekranie bezczynnośći ",//Detailed Information - "Orientacja wyświetlacza ",//Orientation - "Użyj przycisku przedniego w celu zwiększenia temperatury ",//Boost enable - "Temperatura w trybie \"boost\" ",//Boost Temp - "Automatyczne uruchamianie trybu lutowania po włączeniu zasilania. T=Lutowanie, S= Tryb Uspienia ,N=Wyłącz",//Auto start - "Temperatura na ekranie miga, gdy grot jest jeszcze gorący. ",//Cooling Blink - "Kalibracja temperatury grota lutownicy",//Calibrate Tip - "Zresetuj wszystkie ustawienia",//Reset Settings - "Kalibracja napięcia wejściowego. Krótkie naciśnięcie, aby ustawić, długie naciśnięcie, aby wyjść.",//VIN Cal - "Wyświetl szczegółowe informacje podczas lutowania ",//ADV SLD +const char* + SettingsLongNames[16] = + { + /*These are all the help text for all the settings.*/ + /*No requirements on spacing or length*/ + "Źródło zasilania. Ustaw napięcie odcięcia. ", // Power Source + "Temperatura uśpienia <°C>", // Sleep Temp + "Czas uśpienia ", // Sleep Timeout + "Czas wyłączenia ", // Shutdown Time + "Czułość ruchu <0.Wyłączona 1.minimalna 9.maksymalna>", // Motion + // Sensitivity + "Jednostka temperatury ", // Temp Unit + "Wyświetla szczegółowe informacje za pomocą mniejszej czcionki na " + "ekranie bezczynnośći ", // Detailed Information + "Orientacja wyświetlacza ", // Orientation + "Użyj przycisku przedniego w celu zwiększenia temperatury ", // Boost enable + "Temperatura w trybie \"boost\" ", // Boost Temp + "Automatyczne uruchamianie trybu lutowania po włączeniu zasilania. " + "T=Lutowanie, S= Tryb Uspienia ,N=Wyłącz", // Auto start + "Temperatura na ekranie miga, gdy grot jest jeszcze gorący. ", // Cooling Blink + "Kalibracja temperatury grota lutownicy", // Calibrate Tip + "Zresetuj wszystkie ustawienia", // Reset Settings + "Kalibracja napięcia wejściowego. Krótkie naciśnięcie, aby " + "ustawić, długie naciśnięcie, aby wyjść.", // VIN Cal + "Wyświetl szczegółowe informacje podczas lutowania ", // ADV SLD }; const char* SettingsCalibrationWarning = -"Przed kontynuowaniem upewnij się, że końcówka osiągnela temperature pokojowa!"; -const char* UVLOWarningString = "LOW VOLT"; //Fixed width 8 chars -const char* SleepingSimpleString = "Zzz!";// Must be <= 4 chars -const char* SleepingAdvancedString = "Uspienie...";// <=17 chars -const char* WarningSimpleString = "HOT!";//Must be <= 4 chars + "Przed kontynuowaniem upewnij się, że końcówka osiągnela temperature " + "pokojowa!"; +const char* UVLOWarningString = "LOW VOLT"; // Fixed width 8 chars +const char* SleepingSimpleString = "Zzz!"; // Must be <= 4 chars +const char* SleepingAdvancedString = "Uspienie..."; // <=17 chars +const char* WarningSimpleString = "HOT!"; // Must be <= 4 chars const char* WarningAdvancedString = "UWAGA! GORĄCA KOŃCÓWKA!"; const char SettingTrueChar = 'T'; @@ -879,20 +883,21 @@ const char SettingAutoChar = 'A'; const enum ShortNameType SettingsShortNameType = SHORT_NAME_SINGLE_LINE; const char* SettingsShortNames[16][2] = { - /* (<= 5) Power source (DC or batt) */{"PWRSC"}, - /* (<= 4) Sleep temperature */{"STMP"}, - /* (<= 4) Sleep timeout */{"STME"}, - /* (<= 5) Shutdown timeout */{"SHTME"}, - /* (<= 6) Motion sensitivity level */{"MSENSE"}, - /* (<= 6) Temperature in F and C */{"TMPUNT"}, - /* (<= 6) Advanced idle display mode enabled */{"ADVIDL"}, - /* (<= 6) Display rotation mode */{"DSPROT"}, - /* (<= 6) Boost enabled */{"BOOST"}, - /* (<= 4) Boost temperature */{"BTMP"}, - /* (<= 6) Automatic start mode */{"ASTART"}, - /* (<= 6) Cooldown blink */{"CLBLNK"}, - /* (<= 8) Temperature calibration enter menu */{"TMP CAL?"}, - /* (<= 8) Settings reset command */{"RESET?"}, - /* (<= 8) Calibrate input voltage */{"CAL VIN?"}, - /* (<= 6) Advanced soldering screen enabled */{"ADVSLD"},}; + /* (<= 5) Power source (DC or batt) */ {"PWRSC"}, + /* (<= 4) Sleep temperature */ {"STMP"}, + /* (<= 4) Sleep timeout */ {"STME"}, + /* (<= 5) Shutdown timeout */ {"SHTME"}, + /* (<= 6) Motion sensitivity level */ {"MSENSE"}, + /* (<= 6) Temperature in F and C */ {"TMPUNT"}, + /* (<= 6) Advanced idle display mode enabled */ {"ADVIDL"}, + /* (<= 6) Display rotation mode */ {"DSPROT"}, + /* (<= 6) Boost enabled */ {"BOOST"}, + /* (<= 4) Boost temperature */ {"BTMP"}, + /* (<= 6) Automatic start mode */ {"ASTART"}, + /* (<= 6) Cooldown blink */ {"CLBLNK"}, + /* (<= 8) Temperature calibration enter menu */ {"TMP CAL?"}, + /* (<= 8) Settings reset command */ {"RESET?"}, + /* (<= 8) Calibrate input voltage */ {"CAL VIN?"}, + /* (<= 6) Advanced soldering screen enabled */ {"ADVSLD"}, +}; #endif diff --git a/workspace/TS100/src/gui.cpp b/workspace/TS100/src/gui.cpp index c8b56d11..dbbcb826 100644 --- a/workspace/TS100/src/gui.cpp +++ b/workspace/TS100/src/gui.cpp @@ -6,9 +6,9 @@ */ #include "gui.h" -#include "string.h" -#include "hardware.h" #include "cmsis_os.h" +#include "hardware.h" +#include "string.h" static void settings_setInputVRange(void); static void settings_displayInputVRange(void); static void settings_setSleepTemp(void); @@ -44,27 +44,59 @@ static void settings_setCalibrateVIN(void); static void settings_displayCalibrateVIN(void); bool settingsResetRequest = false; -const menuitem settingsMenu[] = { /*Struct used for all settings options in the settings menu*/ -{ (const char*) SettingsLongNames[0], { settings_setInputVRange }, { settings_displayInputVRange } },/*Voltage input*/ -{ (const char*) SettingsLongNames[1], { settings_setSleepTemp }, { settings_displaySleepTemp } }, /*Sleep Temp*/ -{ (const char*) SettingsLongNames[2], { settings_setSleepTime }, { settings_displaySleepTime } }, /*Sleep Time*/ -{ (const char*) SettingsLongNames[3], { settings_setShutdownTime }, { settings_displayShutdownTime } }, /*Shutdown Time*/ -{ (const char*) SettingsLongNames[4], { settings_setSensitivity }, { settings_displaySensitivity } },/* Motion Sensitivity*/ -{ (const char*) SettingsLongNames[5], { settings_setTempF }, { settings_displayTempF } },/* Motion Sensitivity*/ -{ (const char*) SettingsLongNames[6], { settings_setAdvancedIDLEScreens }, { settings_displayAdvancedIDLEScreens } },/* Advanced screens*/ -{ (const char*) SettingsLongNames[15], { settings_setAdvancedSolderingScreens }, { settings_displayAdvancedSolderingScreens } },/* Advanced screens*/ -{ (const char*) SettingsLongNames[7], { settings_setDisplayRotation }, { settings_displayDisplayRotation } }, /*Display Rotation*/ -{ (const char*) SettingsLongNames[8], { settings_setBoostModeEnabled }, { settings_displayBoostModeEnabled } }, /*Enable Boost*/ -{ (const char*) SettingsLongNames[9], { settings_setBoostTemp }, { settings_displayBoostTemp } }, /*Boost Temp*/ -{ (const char*) SettingsLongNames[10], { settings_setAutomaticStartMode }, { settings_displayAutomaticStartMode } },/*Auto start*/ -{ (const char*) SettingsLongNames[11], { settings_setCoolingBlinkEnabled }, { settings_displayCoolingBlinkEnabled } }, /*Cooling blink warning*/ -{ (const char*) SettingsLongNames[12], { settings_setCalibrate }, { settings_displayCalibrate } }, /*Calibrate tip*/ -{ (const char*) SettingsLongNames[13], { settings_setResetSettings }, { settings_displayResetSettings } }, /*Resets settings*/ -{ (const char*) SettingsLongNames[14], { settings_setCalibrateVIN }, { settings_displayCalibrateVIN } }, /*Voltage input cal*/ -{ NULL, { NULL }, { NULL } } //end of menu marker. DO NOT REMOVE +const menuitem settingsMenu[] = { + /*Struct used for all settings options in the settings menu*/ + {(const char*)SettingsLongNames[0], + {settings_setInputVRange}, + {settings_displayInputVRange}}, /*Voltage input*/ + {(const char*)SettingsLongNames[1], + {settings_setSleepTemp}, + {settings_displaySleepTemp}}, /*Sleep Temp*/ + {(const char*)SettingsLongNames[2], + {settings_setSleepTime}, + {settings_displaySleepTime}}, /*Sleep Time*/ + {(const char*)SettingsLongNames[3], + {settings_setShutdownTime}, + {settings_displayShutdownTime}}, /*Shutdown Time*/ + {(const char*)SettingsLongNames[4], + {settings_setSensitivity}, + {settings_displaySensitivity}}, /* Motion Sensitivity*/ + {(const char*)SettingsLongNames[5], + {settings_setTempF}, + {settings_displayTempF}}, /* Motion Sensitivity*/ + {(const char*)SettingsLongNames[6], + {settings_setAdvancedIDLEScreens}, + {settings_displayAdvancedIDLEScreens}}, /* Advanced screens*/ + {(const char*)SettingsLongNames[15], + {settings_setAdvancedSolderingScreens}, + {settings_displayAdvancedSolderingScreens}}, /* Advanced screens*/ + {(const char*)SettingsLongNames[7], + {settings_setDisplayRotation}, + {settings_displayDisplayRotation}}, /*Display Rotation*/ + {(const char*)SettingsLongNames[8], + {settings_setBoostModeEnabled}, + {settings_displayBoostModeEnabled}}, /*Enable Boost*/ + {(const char*)SettingsLongNames[9], + {settings_setBoostTemp}, + {settings_displayBoostTemp}}, /*Boost Temp*/ + {(const char*)SettingsLongNames[10], + {settings_setAutomaticStartMode}, + {settings_displayAutomaticStartMode}}, /*Auto start*/ + {(const char*)SettingsLongNames[11], + {settings_setCoolingBlinkEnabled}, + {settings_displayCoolingBlinkEnabled}}, /*Cooling blink warning*/ + {(const char*)SettingsLongNames[12], + {settings_setCalibrate}, + {settings_displayCalibrate}}, /*Calibrate tip*/ + {(const char*)SettingsLongNames[13], + {settings_setResetSettings}, + {settings_displayResetSettings}}, /*Resets settings*/ + {(const char*)SettingsLongNames[14], + {settings_setCalibrateVIN}, + {settings_displayCalibrateVIN}}, /*Voltage input cal*/ + {NULL, {NULL}, {NULL}} // end of menu marker. DO NOT REMOVE }; - static void printShortDescriptionSingleLine(uint32_t shortDescIndex) { lcd.setFont(0); lcd.setCharCursor(0, 0); @@ -83,25 +115,25 @@ static void printShortDescriptionDoubleLine(uint32_t shortDescIndex) { * Prints two small lines of short description * and prepares cursor in big font after it. * @param shortDescIndex Index to of short description. - * @param cursorCharPosition Custom cursor char position to set after printing description. + * @param cursorCharPosition Custom cursor char position to set after printing + * description. */ -static void printShortDescription(uint32_t shortDescIndex, uint16_t cursorCharPosition) { - //print short description (default single line, explicit double line) - if(SettingsShortNameType == SHORT_NAME_DOUBLE_LINE) { +static void printShortDescription(uint32_t shortDescIndex, + uint16_t cursorCharPosition) { + // print short description (default single line, explicit double line) + if (SettingsShortNameType == SHORT_NAME_DOUBLE_LINE) { printShortDescriptionDoubleLine(shortDescIndex); - } - else { + } else { printShortDescriptionSingleLine(shortDescIndex); } - //prepare cursor for value + // prepare cursor for value lcd.setFont(0); lcd.setCharCursor(cursorCharPosition, 0); } - static void settings_setInputVRange(void) { - systemSettings.cutoutSetting = (systemSettings.cutoutSetting + 1) % 5; + systemSettings.cutoutSetting = (systemSettings.cutoutSetting + 1) % 5; } static void settings_displayInputVRange(void) { @@ -110,328 +142,291 @@ static void settings_displayInputVRange(void) { if (systemSettings.cutoutSetting) { lcd.drawChar('0' + 2 + systemSettings.cutoutSetting); lcd.drawChar('S'); - } - else { + } else { lcd.print("DC"); } } - static void settings_setSleepTemp(void) { - systemSettings.SleepTemp += 10; - if (systemSettings.SleepTemp > 300) - systemSettings.SleepTemp = 50; + systemSettings.SleepTemp += 10; + if (systemSettings.SleepTemp > 300) systemSettings.SleepTemp = 50; } static void settings_displaySleepTemp(void) { printShortDescription(1, 5); - lcd.printNumber(systemSettings.SleepTemp, 3); + lcd.printNumber(systemSettings.SleepTemp, 3); } - static void settings_setSleepTime(void) { - systemSettings.SleepTime++; //Go up 1 minute at a time - if (systemSettings.SleepTime >= 16) { - systemSettings.SleepTime = 1; //can't set time over 10 mins - } - //Remember that ^ is the time of no movement + systemSettings.SleepTime++; // Go up 1 minute at a time + if (systemSettings.SleepTime >= 16) { + systemSettings.SleepTime = 1; // can't set time over 10 mins + } + // Remember that ^ is the time of no movement } static void settings_displaySleepTime(void) { printShortDescription(2, 5); if (systemSettings.SleepTime < 6) { - lcd.printNumber(systemSettings.SleepTime * 10, 2); - lcd.drawChar('S'); - } - else { - lcd.printNumber(systemSettings.SleepTime - 5, 2); - lcd.drawChar('M'); - } + lcd.printNumber(systemSettings.SleepTime * 10, 2); + lcd.drawChar('S'); + } else { + lcd.printNumber(systemSettings.SleepTime - 5, 2); + lcd.drawChar('M'); + } } - static void settings_setShutdownTime(void) { - systemSettings.ShutdownTime++; - if (systemSettings.ShutdownTime > 60) { - systemSettings.ShutdownTime = 0; //wrap to off - } + systemSettings.ShutdownTime++; + if (systemSettings.ShutdownTime > 60) { + systemSettings.ShutdownTime = 0; // wrap to off + } } static void settings_displayShutdownTime(void) { printShortDescription(3, 6); - lcd.printNumber(systemSettings.ShutdownTime, 2); + lcd.printNumber(systemSettings.ShutdownTime, 2); } - static void settings_setTempF(void) { - systemSettings.temperatureInF = !systemSettings.temperatureInF; + systemSettings.temperatureInF = !systemSettings.temperatureInF; } static void settings_displayTempF(void) { printShortDescription(5, 7); - lcd.drawChar( - (systemSettings.temperatureInF) - ? 'F' - : 'C' - ); + lcd.drawChar((systemSettings.temperatureInF) ? 'F' : 'C'); } - static void settings_setSensitivity(void) { - systemSettings.sensitivity++; - systemSettings.sensitivity = systemSettings.sensitivity % 10; + systemSettings.sensitivity++; + systemSettings.sensitivity = systemSettings.sensitivity % 10; } static void settings_displaySensitivity(void) { printShortDescription(4, 7); - lcd.printNumber(systemSettings.sensitivity, 1); + lcd.printNumber(systemSettings.sensitivity, 1); } - static void settings_setAdvancedSolderingScreens(void) { - systemSettings.detailedSoldering = !systemSettings.detailedSoldering; + systemSettings.detailedSoldering = !systemSettings.detailedSoldering; } static void settings_displayAdvancedSolderingScreens(void) { printShortDescription(15, 7); - lcd.drawChar( - (systemSettings.detailedSoldering) - ? SettingTrueChar - : SettingFalseChar - ); + lcd.drawChar((systemSettings.detailedSoldering) ? SettingTrueChar + : SettingFalseChar); } - static void settings_setAdvancedIDLEScreens(void) { - systemSettings.detailedIDLE = !systemSettings.detailedIDLE; + systemSettings.detailedIDLE = !systemSettings.detailedIDLE; } static void settings_displayAdvancedIDLEScreens(void) { printShortDescription(6, 7); - lcd.drawChar( - (systemSettings.detailedIDLE) - ? SettingTrueChar - : SettingFalseChar - ); + lcd.drawChar((systemSettings.detailedIDLE) ? SettingTrueChar + : SettingFalseChar); } - static void settings_setDisplayRotation(void) { - systemSettings.OrientationMode++; - systemSettings.OrientationMode = systemSettings.OrientationMode % 3; + systemSettings.OrientationMode++; + systemSettings.OrientationMode = systemSettings.OrientationMode % 3; } static void settings_displayDisplayRotation(void) { printShortDescription(7, 7); switch (systemSettings.OrientationMode) { - case 0: - lcd.drawChar(SettingRightChar); - break; - case 1: - lcd.drawChar(SettingLeftChar); - break; - case 2: - lcd.drawChar(SettingAutoChar); - break; - } + case 0: + lcd.drawChar(SettingRightChar); + break; + case 1: + lcd.drawChar(SettingLeftChar); + break; + case 2: + lcd.drawChar(SettingAutoChar); + break; + default: + lcd.drawChar(SettingRightChar); + break; + } } - static void settings_setBoostModeEnabled(void) { - systemSettings.boostModeEnabled = !systemSettings.boostModeEnabled; + systemSettings.boostModeEnabled = !systemSettings.boostModeEnabled; } static void settings_displayBoostModeEnabled(void) { printShortDescription(8, 7); - lcd.drawChar( - (systemSettings.boostModeEnabled) - ? SettingTrueChar - : SettingFalseChar - ); + lcd.drawChar((systemSettings.boostModeEnabled) ? SettingTrueChar + : SettingFalseChar); } - static void settings_setBoostTemp(void) { - systemSettings.BoostTemp += 10; //Go up 10 at a time - if (systemSettings.temperatureInF) { - if (systemSettings.BoostTemp > 850) { - systemSettings.BoostTemp = 480; //loop back at 250 - } - } - else { - if (systemSettings.BoostTemp > 450) { - systemSettings.BoostTemp = 250; //loop back at 250 - } - } + systemSettings.BoostTemp += 10; // Go up 10 at a time + if (systemSettings.temperatureInF) { + if (systemSettings.BoostTemp > 850) { + systemSettings.BoostTemp = 480; // loop back at 250 + } + } else { + if (systemSettings.BoostTemp > 450) { + systemSettings.BoostTemp = 250; // loop back at 250 + } + } } static void settings_displayBoostTemp(void) { printShortDescription(9, 5); - lcd.printNumber(systemSettings.BoostTemp, 3); + lcd.printNumber(systemSettings.BoostTemp, 3); } - static void settings_setAutomaticStartMode(void) { - systemSettings.autoStartMode++; - systemSettings.autoStartMode %= 2; + systemSettings.autoStartMode++; + systemSettings.autoStartMode %= 2; } static void settings_displayAutomaticStartMode(void) { printShortDescription(10, 7); - lcd.drawChar( - (systemSettings.autoStartMode) - ? SettingTrueChar - : SettingFalseChar - ); + lcd.drawChar((systemSettings.autoStartMode) ? SettingTrueChar + : SettingFalseChar); } - static void settings_setCoolingBlinkEnabled(void) { - systemSettings.coolingTempBlink = !systemSettings.coolingTempBlink; + systemSettings.coolingTempBlink = !systemSettings.coolingTempBlink; } static void settings_displayCoolingBlinkEnabled(void) { printShortDescription(11, 7); - lcd.drawChar( - (systemSettings.coolingTempBlink) - ? SettingTrueChar - : SettingFalseChar - ); + lcd.drawChar((systemSettings.coolingTempBlink) ? SettingTrueChar + : SettingFalseChar); } - static void settings_setResetSettings(void) { - settingsResetRequest = !settingsResetRequest; + settingsResetRequest = !settingsResetRequest; } static void settings_displayResetSettings(void) { printShortDescription(13, 7); - lcd.drawChar( - (settingsResetRequest) - ? SettingTrueChar - : SettingFalseChar - ); + lcd.drawChar((settingsResetRequest) ? SettingTrueChar : SettingFalseChar); } static void settings_setCalibrate(void) { - //Calibrate the offset - //We split off here to confirm with the user - uint8_t maxOffset = strlen(SettingsCalibrationWarning) + 5; - uint32_t descriptionStart = HAL_GetTick(); + // Calibrate the offset + // We split off here to confirm with the user + uint8_t maxOffset = strlen(SettingsCalibrationWarning) + 5; + uint32_t descriptionStart = HAL_GetTick(); - lcd.setFont(0); - lcd.clearScreen(); - lcd.setCursor(0, 0); + lcd.setFont(0); + lcd.clearScreen(); + lcd.setCursor(0, 0); - for (;;) { - int16_t descriptionOffset = (((HAL_GetTick() - descriptionStart) / 150) % maxOffset); + for (;;) { + int16_t descriptionOffset = + (((HAL_GetTick() - descriptionStart) / 150) % maxOffset); - lcd.setCursor(12 * (7 - descriptionOffset), 0); - lcd.print(SettingsCalibrationWarning); + lcd.setCursor(12 * (7 - descriptionOffset), 0); + lcd.print(SettingsCalibrationWarning); - ButtonState buttons = getButtonState(); - switch (buttons) { - case BUTTON_F_SHORT: { - //User confirmed - //So we now perform the actual calculation - lcd.clearScreen(); - lcd.setCursor(0, 0); - lcd.print("....."); - lcd.refresh(); + ButtonState buttons = getButtonState(); + switch (buttons) { + case BUTTON_F_SHORT: { + // User confirmed + // So we now perform the actual calculation + lcd.clearScreen(); + lcd.setCursor(0, 0); + lcd.print("....."); + lcd.refresh(); - setCalibrationOffset(0); //turn off the current offset - for (uint8_t i = 0; i < 20; i++) { - getTipRawTemp(1); //cycle through the filter a fair bit to ensure we're stable. - osDelay(20); - } - osDelay(100); + setCalibrationOffset(0); // turn off the current offset + for (uint8_t i = 0; i < 20; i++) { + getTipRawTemp(1); // cycle through the filter a fair bit to ensure + // we're stable. + osDelay(20); + } + osDelay(100); - uint16_t rawTempC = tipMeasurementToC(getTipRawTemp(0)); - //We now measure the current reported tip temperature - uint16_t handleTempC = getHandleTemperature() / 10; - //We now have an error between these that we want to store as the offset - rawTempC = rawTempC - handleTempC; - systemSettings.CalibrationOffset = rawTempC; - setCalibrationOffset(rawTempC); //store the error - osDelay(100); - return; - } + uint16_t rawTempC = tipMeasurementToC(getTipRawTemp(0)); + // We now measure the current reported tip temperature + uint16_t handleTempC = getHandleTemperature() / 10; + // We now have an error between these that we want to store as the + // offset + rawTempC = rawTempC - handleTempC; + systemSettings.CalibrationOffset = rawTempC; + setCalibrationOffset(rawTempC); // store the error + osDelay(100); + return; + } - case BUTTON_BOTH: - case BUTTON_B_SHORT: - case BUTTON_F_LONG: - case BUTTON_B_LONG: - return; + case BUTTON_BOTH: + case BUTTON_B_SHORT: + case BUTTON_F_LONG: + case BUTTON_B_LONG: + return; - case BUTTON_NONE: - break; - } + case BUTTON_NONE: + break; + default: + break; + } - lcd.refresh(); - osDelay(50); - } -} - -static void settings_displayCalibrate(void) { - printShortDescription(12, 5); + lcd.refresh(); + osDelay(50); + } } +static void settings_displayCalibrate(void) { printShortDescription(12, 5); } static void settings_setCalibrateVIN(void) { - //Jump to the voltage calibration subscreen - lcd.setFont(0); - lcd.clearScreen(); - lcd.setCursor(0, 0); + // Jump to the voltage calibration subscreen + lcd.setFont(0); + lcd.clearScreen(); + lcd.setCursor(0, 0); - for (;;) { - lcd.setCursor(0, 0); - lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) / 10, 2); - lcd.print("."); - lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) % 10, 1); - lcd.print("V"); + for (;;) { + lcd.setCursor(0, 0); + lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) / 10, 2); + lcd.print("."); + lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) % 10, 1); + lcd.print("V"); - ButtonState buttons = getButtonState(); - switch (buttons) { - case BUTTON_F_SHORT: - systemSettings.voltageDiv++; - break; + ButtonState buttons = getButtonState(); + switch (buttons) { + case BUTTON_F_SHORT: + systemSettings.voltageDiv++; + break; - case BUTTON_B_SHORT: - systemSettings.voltageDiv--; - break; + case BUTTON_B_SHORT: + systemSettings.voltageDiv--; + break; - case BUTTON_BOTH: - case BUTTON_F_LONG: - case BUTTON_B_LONG: - saveSettings(); - return; + case BUTTON_BOTH: + case BUTTON_F_LONG: + case BUTTON_B_LONG: + saveSettings(); + return; - case BUTTON_NONE: - break; - } + case BUTTON_NONE: + default: + break; + } - lcd.refresh(); - osDelay(50); + lcd.refresh(); + osDelay(50); - //Cap to sensible values - if (systemSettings.voltageDiv < 90) { - systemSettings.voltageDiv = 90; - } - else if (systemSettings.voltageDiv > 130) { - systemSettings.voltageDiv = 130; - } - } + // Cap to sensible values + if (systemSettings.voltageDiv < 90) { + systemSettings.voltageDiv = 90; + } else if (systemSettings.voltageDiv > 130) { + systemSettings.voltageDiv = 130; + } + } } -static void settings_displayCalibrateVIN(void) { - printShortDescription(14, 5); -} +static void settings_displayCalibrateVIN(void) { printShortDescription(14, 5); } diff --git a/workspace/TS100/src/main.cpp b/workspace/TS100/src/main.cpp index bb3f107a..e96482c9 100644 --- a/workspace/TS100/src/main.cpp +++ b/workspace/TS100/src/main.cpp @@ -1,20 +1,20 @@ // By Ben V. Brown - V2.0 of the TS100 firmware -#include #include -#include "stm32f1xx_hal.h" -#include "cmsis_os.h" +#include #include "OLED.hpp" #include "Settings.h" #include "Translation.h" -#include "string.h" +#include "cmsis_os.h" #include "gui.h" #include "stdlib.h" +#include "stm32f1xx_hal.h" +#include "string.h" -//C++ objects +// C++ objects OLED lcd(&hi2c1); MMA8652FC accel(&hi2c1); -//File local variables +// File local variables uint16_t currentlyActiveTemperatureTarget = 0; uint32_t lastMovementTime = 0; uint32_t lastButtonTime = 0; @@ -27,1035 +27,1010 @@ osThreadId MOVTaskHandle; SemaphoreHandle_t rotationChangedSemaphore = NULL; SemaphoreHandle_t accelDataAvailableSemaphore = NULL; -void startGUITask(void const * argument); -void startPIDTask(void const * argument); -void startMOVTask(void const * argument); -void startRotationTask(void const * argument); +void startGUITask(void const *argument); +void startPIDTask(void const *argument); +void startMOVTask(void const *argument); +void startRotationTask(void const *argument); // End FreeRTOS -//Main inits hardware then hands over to the FreeRTOS kernel +// Main inits hardware then hands over to the FreeRTOS kernel int main(void) { - /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ - HAL_Init(); - Setup_HAL(); //Setup all the HAL objects - setTipPWM(0); - lcd.initialize(); //start up the LCD - lcd.setFont(0); //default to bigger font - accel.initalize(); //this sets up the I2C registers and loads up the default settings - HAL_IWDG_Refresh(&hiwdg); - restoreSettings(); //load the settings from flash - setCalibrationOffset(systemSettings.CalibrationOffset); - HAL_IWDG_Refresh(&hiwdg); - /* Create the thread(s) */ - /* definition and creation of GUITask */ - osThreadDef(GUITask, startGUITask, osPriorityBelowNormal, 0, 512); - GUITaskHandle = osThreadCreate(osThread(GUITask), NULL); + /* Reset of all peripherals, Initializes the Flash interface and the Systick. + */ + HAL_Init(); + Setup_HAL(); // Setup all the HAL objects + setTipPWM(0); + lcd.initialize(); // start up the LCD + lcd.setFont(0); // default to bigger font + accel.initalize(); // this sets up the I2C registers and loads up the default + // settings + HAL_IWDG_Refresh(&hiwdg); + restoreSettings(); // load the settings from flash + setCalibrationOffset(systemSettings.CalibrationOffset); + HAL_IWDG_Refresh(&hiwdg); + /* Create the thread(s) */ + /* definition and creation of GUITask */ + osThreadDef(GUITask, startGUITask, osPriorityBelowNormal, 0, 512); + GUITaskHandle = osThreadCreate(osThread(GUITask), NULL); - /* definition and creation of PIDTask */ - osThreadDef(PIDTask, startPIDTask, osPriorityRealtime, 0, 256); - PIDTaskHandle = osThreadCreate(osThread(PIDTask), NULL); + /* definition and creation of PIDTask */ + osThreadDef(PIDTask, startPIDTask, osPriorityRealtime, 0, 256); + PIDTaskHandle = osThreadCreate(osThread(PIDTask), NULL); - /* definition and creation of ROTTask */ - osThreadDef(ROTTask, startRotationTask, osPriorityLow, 0, 256); - ROTTaskHandle = osThreadCreate(osThread(ROTTask), NULL); - /* definition and creation of MOVTask */ - osThreadDef(MOVTask, startMOVTask, osPriorityNormal, 0, 256); - MOVTaskHandle = osThreadCreate(osThread(MOVTask), NULL); + /* definition and creation of ROTTask */ + osThreadDef(ROTTask, startRotationTask, osPriorityLow, 0, 256); + ROTTaskHandle = osThreadCreate(osThread(ROTTask), NULL); + /* definition and creation of MOVTask */ + osThreadDef(MOVTask, startMOVTask, osPriorityNormal, 0, 256); + MOVTaskHandle = osThreadCreate(osThread(MOVTask), NULL); - /* Create the objects*/ - rotationChangedSemaphore = xSemaphoreCreateBinary(); // Used to unlock rotation thread - accelDataAvailableSemaphore = xSemaphoreCreateBinary(); // Used to unlock the movement thread - /* Start scheduler */ - osKernelStart(); + /* Create the objects*/ + rotationChangedSemaphore = + xSemaphoreCreateBinary(); // Used to unlock rotation thread + accelDataAvailableSemaphore = + xSemaphoreCreateBinary(); // Used to unlock the movement thread + /* Start scheduler */ + osKernelStart(); - /* We should never get here as control is now taken by the scheduler */ - while (1) { - } + /* We should never get here as control is now taken by the scheduler */ + while (1) { + } } void GUIDelay() { - osDelay(50); //20Hz + osDelay(50); // 20Hz } void gui_drawTipTemp() { - //Draw tip temp handling unit conversion & tolerance near setpoint - uint16_t Temp = getTipRawTemp(0); + // Draw tip temp handling unit conversion & tolerance near setpoint + uint16_t Temp = getTipRawTemp(0); - if (systemSettings.temperatureInF) - Temp = tipMeasurementToF(Temp); - else - Temp = tipMeasurementToC(Temp); - //[Disabled 24/11/2017] Round if nearby - //if (abs(Temp - systemSettings.SolderingTemp) < 3) - // Temp = systemSettings.SolderingTemp; - - lcd.printNumber(Temp, 3); //Draw the tip temp out finally + if (systemSettings.temperatureInF) + Temp = tipMeasurementToF(Temp); + else + Temp = tipMeasurementToC(Temp); + //[Disabled 24/11/2017] Round if nearby + // if (abs(Temp - systemSettings.SolderingTemp) < 3) + // Temp = systemSettings.SolderingTemp; + lcd.printNumber(Temp, 3); // Draw the tip temp out finally } ButtonState getButtonState() { - /* - * Read in the buttons and then determine if a state change needs to occur - */ + /* + * Read in the buttons and then determine if a state change needs to occur + */ - /* - * If the previous state was 00 Then we want to latch the new state if different & update time - * If the previous state was !00 Then we want to search if we trigger long press (buttons still down), or if release we trigger press (downtime>filter) - */ - static uint8_t previousState = 0; - static uint32_t previousStateChange = 0; - const uint16_t timeout = 400; - uint8_t currentState; - currentState = ( - 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 the previous state was 00 Then we want to latch the new state if + * different & update time + * If the previous state was !00 Then we want to search if we trigger long + * press (buttons still down), or if release we trigger press + * (downtime>filter) + */ + static uint8_t previousState = 0; + static uint32_t previousStateChange = 0; + const uint16_t timeout = 400; + uint8_t currentState; + currentState = + (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) - lastButtonTime = HAL_GetTick(); - if (currentState == previousState) { - if (currentState == 0) - return BUTTON_NONE; - if ((HAL_GetTick() - previousStateChange) > timeout) { - // User has been holding the button down - // We want to send a buttong is held message - if (currentState == 0x01) - return BUTTON_F_LONG; - else if (currentState == 0x02) - return BUTTON_B_LONG; - else - return BUTTON_NONE; // Both being held case, we dont long hold this - } else - return BUTTON_NONE; - } else { - // A change in button state has occurred - ButtonState retVal = BUTTON_NONE; - if (currentState) { - //User has pressed a button down (nothing done on down) + if (currentState) lastButtonTime = HAL_GetTick(); + if (currentState == previousState) { + if (currentState == 0) return BUTTON_NONE; + if ((HAL_GetTick() - previousStateChange) > timeout) { + // User has been holding the button down + // We want to send a buttong is held message + if (currentState == 0x01) + return BUTTON_F_LONG; + else if (currentState == 0x02) + return BUTTON_B_LONG; + else + return BUTTON_NONE; // Both being held case, we dont long hold this + } else + return BUTTON_NONE; + } else { + // A change in button state has occurred + ButtonState retVal = BUTTON_NONE; + if (currentState) { + // User has pressed a button down (nothing done on down) - } else { - // User has released buttons - // If they previously had the buttons down we want to check if they were < long hold and trigger a press - if ((HAL_GetTick() - previousStateChange) < timeout) { - // The user didn't hold the button for long - // So we send button press + } else { + // User has released buttons + // If they previously had the buttons down we want to check if they were < + // long hold and trigger a press + if ((HAL_GetTick() - previousStateChange) < timeout) { + // The user didn't hold the button for long + // So we send button press - if (previousState == 0x01) - retVal = BUTTON_F_SHORT; - else if (previousState == 0x02) - retVal = BUTTON_B_SHORT; - else - retVal = BUTTON_BOTH; // Both being held case - } - - } - previousState = currentState; - previousStateChange = HAL_GetTick(); - return retVal; - } - return BUTTON_NONE; + if (previousState == 0x01) + retVal = BUTTON_F_SHORT; + else if (previousState == 0x02) + retVal = BUTTON_B_SHORT; + else + retVal = BUTTON_BOTH; // Both being held case + } + } + previousState = currentState; + previousStateChange = HAL_GetTick(); + return retVal; + } + return BUTTON_NONE; } static void waitForButtonPress() { - //we are just lazy and sleep until user confirms button press - //This also eats the button press event! - ButtonState buttons = getButtonState(); - while (buttons) { - buttons = getButtonState(); - GUIDelay(); - HAL_IWDG_Refresh(&hiwdg); - lcd.refresh(); - } - while (!buttons) { - buttons = getButtonState(); - GUIDelay(); - HAL_IWDG_Refresh(&hiwdg); - lcd.refresh(); - } + // we are just lazy and sleep until user confirms button press + // This also eats the button press event! + ButtonState buttons = getButtonState(); + while (buttons) { + buttons = getButtonState(); + GUIDelay(); + HAL_IWDG_Refresh(&hiwdg); + lcd.refresh(); + } + while (!buttons) { + buttons = getButtonState(); + GUIDelay(); + HAL_IWDG_Refresh(&hiwdg); + lcd.refresh(); + } } static void waitForButtonPressOrTimeout(uint32_t timeout) { - timeout += HAL_GetTick(); - //Make timeout our exit value - for (;;) { - ButtonState buttons = getButtonState(); - if (buttons) - return; - if (HAL_GetTick() > timeout) - return; - GUIDelay(); - HAL_IWDG_Refresh(&hiwdg); - - } + timeout += HAL_GetTick(); + // Make timeout our exit value + for (;;) { + ButtonState buttons = getButtonState(); + if (buttons) return; + if (HAL_GetTick() > timeout) return; + GUIDelay(); + HAL_IWDG_Refresh(&hiwdg); + } } -//returns true if undervoltage has occured +// returns true if undervoltage has occured static bool checkVoltageForExit() { - uint16_t v = getInputVoltageX10(systemSettings.voltageDiv); - if ((v < lookupVoltageLevel(systemSettings.cutoutSetting))) { - lcd.clearScreen(); - lcd.setCursor(0, 0); - if (systemSettings.detailedSoldering) { - lcd.setFont(1); - lcd.print("Undervoltage"); - lcd.setCursor(0, 8); - lcd.print("Input V: "); - lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) / 10, - 2); - lcd.drawChar('.'); - lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) % 10, - 1); - lcd.print("V"); + uint16_t v = getInputVoltageX10(systemSettings.voltageDiv); + if ((v < lookupVoltageLevel(systemSettings.cutoutSetting))) { + lcd.clearScreen(); + lcd.setCursor(0, 0); + if (systemSettings.detailedSoldering) { + lcd.setFont(1); + lcd.print("Undervoltage"); + lcd.setCursor(0, 8); + lcd.print("Input V: "); + lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) / 10, 2); + lcd.drawChar('.'); + lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) % 10, 1); + lcd.print("V"); - } else { - lcd.setFont(0); - lcd.print("DC LOW"); - } + } else { + lcd.setFont(0); + lcd.print("DC LOW"); + } - lcd.refresh(); - currentlyActiveTemperatureTarget = 0; - waitForButtonPress(); - return true; - } - return false; + lcd.refresh(); + currentlyActiveTemperatureTarget = 0; + waitForButtonPress(); + return true; + } + return false; } static void gui_drawBatteryIcon() { - if (systemSettings.cutoutSetting) { - //User is on a lithium battery - //we need to calculate which of the 10 levels they are on - uint8_t cellCount = systemSettings.cutoutSetting + 2; - uint16_t cellV = getInputVoltageX10(systemSettings.voltageDiv) - / 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 - if (cellV > 9) - cellV = 9; - lcd.drawBattery(cellV + 1); - } else - lcd.drawSymbol(16); //Draw the DC Logo - + if (systemSettings.cutoutSetting) { + // User is on a lithium battery + // we need to calculate which of the 10 levels they are on + uint8_t cellCount = systemSettings.cutoutSetting + 2; + uint16_t cellV = getInputVoltageX10(systemSettings.voltageDiv) / 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 + if (cellV > 9) cellV = 9; + lcd.drawBattery(cellV + 1); + } else + lcd.drawSymbol(16); // Draw the DC Logo } static void gui_solderingTempAdjust() { - uint32_t lastChange = HAL_GetTick(); - currentlyActiveTemperatureTarget = 0; - for (;;) { - lcd.setCursor(0, 0); - lcd.clearScreen(); - lcd.setFont(0); - ButtonState buttons = getButtonState(); - if (buttons) - lastChange = HAL_GetTick(); - switch (buttons) { - case BUTTON_NONE: - //stay - break; - case BUTTON_BOTH: - //exit - return; - break; - case BUTTON_B_LONG: + uint32_t lastChange = HAL_GetTick(); + currentlyActiveTemperatureTarget = 0; + for (;;) { + lcd.setCursor(0, 0); + lcd.clearScreen(); + lcd.setFont(0); + ButtonState buttons = getButtonState(); + if (buttons) lastChange = HAL_GetTick(); + switch (buttons) { + case BUTTON_NONE: + // stay + break; + case BUTTON_BOTH: + // exit + return; + break; + case BUTTON_B_LONG: - break; - case BUTTON_F_LONG: + break; + case BUTTON_F_LONG: - break; - case BUTTON_F_SHORT: - if (lcd.getRotation()) { - systemSettings.SolderingTemp += 10; //add 10 - } else { - systemSettings.SolderingTemp -= 10; //sub 10 - } - break; - case BUTTON_B_SHORT: - if (!lcd.getRotation()) { - systemSettings.SolderingTemp += 10; //add 10 - } else { - systemSettings.SolderingTemp -= 10; //sub 10 - } - break; - } - // constrain between 50-450 C - if (systemSettings.temperatureInF) { - if (systemSettings.SolderingTemp > 850) - systemSettings.SolderingTemp = 850; - } else { - if (systemSettings.SolderingTemp > 450) - systemSettings.SolderingTemp = 450; - } + break; + case BUTTON_F_SHORT: + if (lcd.getRotation()) { + systemSettings.SolderingTemp += 10; // add 10 + } else { + systemSettings.SolderingTemp -= 10; // sub 10 + } + break; + case BUTTON_B_SHORT: + if (!lcd.getRotation()) { + systemSettings.SolderingTemp += 10; // add 10 + } else { + systemSettings.SolderingTemp -= 10; // sub 10 + } + break; + default: + break; + } + // constrain between 50-450 C + if (systemSettings.temperatureInF) { + if (systemSettings.SolderingTemp > 850) + systemSettings.SolderingTemp = 850; + } else { + if (systemSettings.SolderingTemp > 450) + systemSettings.SolderingTemp = 450; + } - if (systemSettings.temperatureInF) { - if (systemSettings.SolderingTemp < 120) - systemSettings.SolderingTemp = 120; - } else { - if (systemSettings.SolderingTemp < 50) - systemSettings.SolderingTemp = 50; - } + if (systemSettings.temperatureInF) { + if (systemSettings.SolderingTemp < 120) + systemSettings.SolderingTemp = 120; + } else { + if (systemSettings.SolderingTemp < 50) systemSettings.SolderingTemp = 50; + } - if (HAL_GetTick() - lastChange > 1500) - return; // exit if user just doesn't press anything for a bit - lcd.drawChar('<'); - lcd.drawChar(' '); - lcd.printNumber(systemSettings.SolderingTemp, 3); - if (systemSettings.temperatureInF) - lcd.drawSymbol(0); - else - lcd.drawSymbol(1); - lcd.drawChar(' '); - lcd.drawChar('>'); - lcd.refresh(); - GUIDelay(); - } + if (HAL_GetTick() - lastChange > 1500) + return; // exit if user just doesn't press anything for a bit + lcd.drawChar('<'); + lcd.drawChar(' '); + lcd.printNumber(systemSettings.SolderingTemp, 3); + if (systemSettings.temperatureInF) + lcd.drawSymbol(0); + else + lcd.drawSymbol(1); + lcd.drawChar(' '); + lcd.drawChar('>'); + lcd.refresh(); + GUIDelay(); + } } static void gui_settingsMenu() { -//Draw the settings menu and provide iteration support etc - uint8_t currentScreen = 0; - uint32_t autoRepeatTimer = 0; - settingsResetRequest = false; - bool earlyExit = false; - uint32_t descriptionStart = 0; - while ((settingsMenu[currentScreen].incrementHandler.func != NULL) - && earlyExit == false) { - lcd.setFont(0); - lcd.clearScreen(); - lcd.setCursor(0, 0); + // Draw the settings menu and provide iteration support etc + uint8_t currentScreen = 0; + uint32_t autoRepeatTimer = 0; + settingsResetRequest = false; + bool earlyExit = false; + uint32_t descriptionStart = 0; + while ((settingsMenu[currentScreen].incrementHandler.func != NULL) && + earlyExit == false) { + lcd.setFont(0); + lcd.clearScreen(); + lcd.setCursor(0, 0); - if (HAL_GetTick() - lastButtonTime < 4000) { - settingsMenu[currentScreen].draw.func(); + if (HAL_GetTick() - lastButtonTime < 4000) { + settingsMenu[currentScreen].draw.func(); - } else { - //Draw description - //draw string starting from descriptionOffset - int16_t maxOffset = strlen(settingsMenu[currentScreen].description) - + 5; - if (descriptionStart == 0) - descriptionStart = HAL_GetTick(); + } else { + // Draw description + // draw string starting from descriptionOffset + int16_t maxOffset = strlen(settingsMenu[currentScreen].description) + 5; + if (descriptionStart == 0) descriptionStart = HAL_GetTick(); - int16_t descriptionOffset = (((HAL_GetTick() - descriptionStart) - / 10) % (maxOffset * 12)); - //^ Rolling offset based on time - lcd.setCursor(((7 * 12) - descriptionOffset), 0); - lcd.print(settingsMenu[currentScreen].description); - } + int16_t descriptionOffset = + (((HAL_GetTick() - descriptionStart) / 3) % (maxOffset * 12)); + //^ Rolling offset based on time + lcd.setCursor(((7 * 12) - descriptionOffset), 0); + lcd.print(settingsMenu[currentScreen].description); + } - ButtonState buttons = getButtonState(); + ButtonState buttons = getButtonState(); - switch (buttons) { - case BUTTON_BOTH: - 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; - break; - case BUTTON_B_SHORT: - if (descriptionStart == 0) - currentScreen++; - else - descriptionStart = 0; - break; - case BUTTON_F_LONG: - if (HAL_GetTick() - autoRepeatTimer > 200) { - settingsMenu[currentScreen].incrementHandler.func(); - autoRepeatTimer = HAL_GetTick(); - descriptionStart = 0; - } - break; - case BUTTON_B_LONG: - if (HAL_GetTick() - autoRepeatTimer > 200) { - currentScreen++; - autoRepeatTimer = HAL_GetTick(); - descriptionStart = 0; - } - break; - case BUTTON_NONE: - break; - } + switch (buttons) { + case BUTTON_BOTH: + 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; + break; + case BUTTON_B_SHORT: + if (descriptionStart == 0) + currentScreen++; + else + descriptionStart = 0; + break; + case BUTTON_F_LONG: + if (HAL_GetTick() - autoRepeatTimer > 200) { + settingsMenu[currentScreen].incrementHandler.func(); + autoRepeatTimer = HAL_GetTick(); + descriptionStart = 0; + } + break; + case BUTTON_B_LONG: + if (HAL_GetTick() - autoRepeatTimer > 200) { + currentScreen++; + autoRepeatTimer = HAL_GetTick(); + descriptionStart = 0; + } + break; + case BUTTON_NONE: + default: + break; + } - lcd.refresh(); //update the LCD - osDelay(20); - HAL_IWDG_Refresh(&hiwdg); - - } - if (settingsResetRequest) - resetSettings(); - saveSettings(); + lcd.refresh(); // update the LCD + osDelay(20); + HAL_IWDG_Refresh(&hiwdg); + } + if (settingsResetRequest) resetSettings(); + saveSettings(); } static int gui_showTipTempWarning() { - for (;;) { + for (;;) { + uint16_t tipTemp = tipMeasurementToC(getTipRawTemp(0)); + lcd.clearScreen(); + lcd.setCursor(0, 0); + if (systemSettings.detailedSoldering) { + lcd.setFont(1); + lcd.print(WarningAdvancedString); + lcd.setCursor(0, 8); + lcd.print("Tip Temp: "); - uint16_t tipTemp = tipMeasurementToC(getTipRawTemp(0)); - lcd.clearScreen(); - lcd.setCursor(0, 0); - if (systemSettings.detailedSoldering) { - lcd.setFont(1); - lcd.print(WarningAdvancedString); - lcd.setCursor(0, 8); - lcd.print("Tip Temp: "); + if (systemSettings.temperatureInF) { + lcd.printNumber(tipMeasurementToF(getTipRawTemp(0)), 3); + lcd.print("F"); + } else { + lcd.printNumber(tipMeasurementToC(getTipRawTemp(0)), 3); + lcd.print("C"); + } + } else { + lcd.setFont(0); + lcd.drawArea(0, 0, 24, 16, WarningBlock24); + lcd.setCursor(24, 0); + // lcd.print(WarningSimpleString); + lcd.print(" "); + if (systemSettings.temperatureInF) { + lcd.printNumber(tipMeasurementToF(getTipRawTemp(0)), 3); + lcd.drawSymbol(0); + } else { + lcd.printNumber(tipMeasurementToC(getTipRawTemp(0)), 3); + lcd.drawSymbol(1); + } + } + if (systemSettings.coolingTempBlink && tipTemp > 50) { + if (HAL_GetTick() % 500 < 250) lcd.clearScreen(); + } + lcd.refresh(); + ButtonState buttons = getButtonState(); + if (buttons == BUTTON_F_SHORT) + return 1; + else if (buttons == BUTTON_B_SHORT || buttons == BUTTON_BOTH) + return 0; - if (systemSettings.temperatureInF) { - lcd.printNumber(tipMeasurementToF(getTipRawTemp(0)), 3); - lcd.print("F"); - } else { - lcd.printNumber(tipMeasurementToC(getTipRawTemp(0)), 3); - lcd.print("C"); - } - } else { - lcd.setFont(0); - lcd.drawArea(0, 0, 24, 16, WarningBlock24); - lcd.setCursor(24, 0); - //lcd.print(WarningSimpleString); - lcd.print(" "); - if (systemSettings.temperatureInF) { - lcd.printNumber(tipMeasurementToF(getTipRawTemp(0)), 3); - lcd.drawSymbol(0); - } else { - lcd.printNumber(tipMeasurementToC(getTipRawTemp(0)), 3); - lcd.drawSymbol(1); - } - } - if (systemSettings.coolingTempBlink && tipTemp > 50) { - if (HAL_GetTick() % 500 < 250) - lcd.clearScreen(); - } - lcd.refresh(); - ButtonState buttons = getButtonState(); - if (buttons == BUTTON_F_SHORT) - return 1; - else if (buttons == BUTTON_B_SHORT || buttons == BUTTON_BOTH) - return 0; + if (tipTemp < 30) return 0; - if (tipTemp < 30) - return 0; - - HAL_IWDG_Refresh(&hiwdg); - GUIDelay(); - } + HAL_IWDG_Refresh(&hiwdg); + GUIDelay(); + } } static uint16_t min(uint16_t a, uint16_t b) { - if (a > b) - return b; - else - return a; + if (a > b) + return b; + else + return a; } static int gui_SolderingSleepingMode() { -//Drop to sleep temperature and display until movement or button press + // Drop to sleep temperature and display until movement or button press - for (;;) { - ButtonState buttons = getButtonState(); - if (buttons) - return 0; - if ((HAL_GetTick() - lastMovementTime < 1000) - || (HAL_GetTick() - lastButtonTime < 1000)) - return 0; //user moved or pressed a button, go back to soldering - if (checkVoltageForExit()) - return 1; //return non-zero on error + for (;;) { + ButtonState buttons = getButtonState(); + if (buttons) return 0; + if ((HAL_GetTick() - lastMovementTime < 1000) || + (HAL_GetTick() - lastButtonTime < 1000)) + return 0; // user moved or pressed a button, go back to soldering + if (checkVoltageForExit()) return 1; // return non-zero on error - if (systemSettings.temperatureInF) - currentlyActiveTemperatureTarget = ftoTipMeasurement( - min(systemSettings.SleepTemp, - systemSettings.SolderingTemp)); - else - currentlyActiveTemperatureTarget = ctoTipMeasurement( - min(systemSettings.SleepTemp, - systemSettings.SolderingTemp)); - //draw the lcd - uint16_t tipTemp; - if (systemSettings.temperatureInF) - tipTemp = tipMeasurementToF(getTipRawTemp(0)); - else - tipTemp = tipMeasurementToC(getTipRawTemp(0)); + if (systemSettings.temperatureInF) + currentlyActiveTemperatureTarget = ftoTipMeasurement( + min(systemSettings.SleepTemp, systemSettings.SolderingTemp)); + else + currentlyActiveTemperatureTarget = ctoTipMeasurement( + min(systemSettings.SleepTemp, systemSettings.SolderingTemp)); + // draw the lcd + uint16_t tipTemp; + if (systemSettings.temperatureInF) + tipTemp = tipMeasurementToF(getTipRawTemp(0)); + else + tipTemp = tipMeasurementToC(getTipRawTemp(0)); - lcd.clearScreen(); - lcd.setCursor(0, 0); - if (systemSettings.detailedSoldering) { - lcd.setFont(1); - lcd.print(SleepingAdvancedString); - lcd.setCursor(0, 8); - lcd.print("Tip:"); - lcd.printNumber(tipTemp, 3); - if (systemSettings.temperatureInF) - lcd.print("F"); - else - lcd.print("C"); + lcd.clearScreen(); + lcd.setCursor(0, 0); + if (systemSettings.detailedSoldering) { + lcd.setFont(1); + lcd.print(SleepingAdvancedString); + lcd.setCursor(0, 8); + lcd.print("Tip:"); + lcd.printNumber(tipTemp, 3); + if (systemSettings.temperatureInF) + lcd.print("F"); + else + lcd.print("C"); - lcd.print(" "); - lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) / 10, - 2); - lcd.drawChar('.'); - lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) % 10, - 1); - lcd.drawChar('V'); - } else { - lcd.setFont(0); - lcd.print(SleepingSimpleString); - lcd.printNumber(tipTemp, 3); - if (systemSettings.temperatureInF) - lcd.drawSymbol(0); - else - lcd.drawSymbol(1); - } - if (systemSettings.ShutdownTime) //only allow shutdown exit if time > 0 - if (lastMovementTime) - if (((uint32_t) (HAL_GetTick() - lastMovementTime)) - > (uint32_t) (systemSettings.ShutdownTime * 60 * 1000)) { - //shutdown - currentlyActiveTemperatureTarget = 0; - return 1; //we want to exit soldering mode - } - lcd.refresh(); - GUIDelay(); - HAL_IWDG_Refresh(&hiwdg); - - } + lcd.print(" "); + lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) / 10, 2); + lcd.drawChar('.'); + lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) % 10, 1); + lcd.drawChar('V'); + } else { + lcd.setFont(0); + lcd.print(SleepingSimpleString); + lcd.printNumber(tipTemp, 3); + if (systemSettings.temperatureInF) + lcd.drawSymbol(0); + else + lcd.drawSymbol(1); + } + if (systemSettings.ShutdownTime) // only allow shutdown exit if time > 0 + if (lastMovementTime) + if (((uint32_t)(HAL_GetTick() - lastMovementTime)) > + (uint32_t)(systemSettings.ShutdownTime * 60 * 1000)) { + // shutdown + currentlyActiveTemperatureTarget = 0; + return 1; // we want to exit soldering mode + } + lcd.refresh(); + GUIDelay(); + HAL_IWDG_Refresh(&hiwdg); + } } static void gui_solderingMode() { - /* - * * Soldering (gui_solderingMode) - * -> Main loop where we draw temp, and animations - * --> User presses buttons and they goto the temperature adjust screen - * ---> Display the current setpoint temperature - * ---> Use buttons to change forward and back on temperature - * ---> Both buttons or timeout for exiting - * --> Long hold front button to enter boost mode - * ---> Just temporarily sets the system into the alternate temperature for PID control - * --> Long hold back button to exit - * --> Double button to exit - */ - bool boostModeOn = false; - uint32_t sleepThres = 0; - if (systemSettings.SleepTime < 6) - sleepThres = systemSettings.SleepTime * 10 * 1000; - else - sleepThres = (systemSettings.SleepTime - 5) * 60 * 1000; - for (;;) { - uint16_t tipTemp = getTipRawTemp(0); + /* + * * Soldering (gui_solderingMode) + * -> Main loop where we draw temp, and animations + * --> User presses buttons and they goto the temperature adjust screen + * ---> Display the current setpoint temperature + * ---> Use buttons to change forward and back on temperature + * ---> Both buttons or timeout for exiting + * --> Long hold front button to enter boost mode + * ---> Just temporarily sets the system into the alternate temperature for + * PID control + * --> Long hold back button to exit + * --> Double button to exit + */ + bool boostModeOn = false; + uint32_t sleepThres = 0; + if (systemSettings.SleepTime < 6) + sleepThres = systemSettings.SleepTime * 10 * 1000; + else + sleepThres = (systemSettings.SleepTime - 5) * 60 * 1000; + for (;;) { + uint16_t tipTemp = getTipRawTemp(0); - ButtonState buttons = getButtonState(); - switch (buttons) { - case BUTTON_NONE: - //stay - boostModeOn = false; - break; - case BUTTON_BOTH: - //exit - return; - break; - case BUTTON_B_LONG: - return; //exit on back long hold - break; - case BUTTON_F_LONG: - //if boost mode is enabled turn it on - if (systemSettings.boostModeEnabled) - boostModeOn = true; - break; - case BUTTON_F_SHORT: - case BUTTON_B_SHORT: { - uint16_t oldTemp = systemSettings.SolderingTemp; - gui_solderingTempAdjust(); //goto adjust temp mode - if (oldTemp != systemSettings.SolderingTemp) { - saveSettings(); //only save on change - } - } - break; - } - //else we update the screen information - lcd.setCursor(0, 0); - lcd.clearScreen(); - lcd.setFont(0); - if (tipTemp > 16300) { - lcd.print("BAD TIP"); - lcd.refresh(); - currentlyActiveTemperatureTarget = 0; - waitForButtonPress(); - return; - } else { - //We switch the layout direction depending on the orientation of the lcd. - if (lcd.getRotation()) { - // battery - gui_drawBatteryIcon(); + ButtonState buttons = getButtonState(); + switch (buttons) { + case BUTTON_NONE: + // stay + boostModeOn = false; + break; + case BUTTON_BOTH: + // exit + return; + break; + case BUTTON_B_LONG: + return; // exit on back long hold + break; + case BUTTON_F_LONG: + // if boost mode is enabled turn it on + if (systemSettings.boostModeEnabled) boostModeOn = true; + break; + case BUTTON_F_SHORT: + case BUTTON_B_SHORT: { + uint16_t oldTemp = systemSettings.SolderingTemp; + gui_solderingTempAdjust(); // goto adjust temp mode + if (oldTemp != systemSettings.SolderingTemp) { + saveSettings(); // only save on change + } + } break; + default: + break; + } + // else we update the screen information + lcd.setCursor(0, 0); + lcd.clearScreen(); + lcd.setFont(0); + if (tipTemp > 16300) { + lcd.print("BAD TIP"); + lcd.refresh(); + currentlyActiveTemperatureTarget = 0; + waitForButtonPress(); + return; + } else { + // We switch the layout direction depending on the orientation of the lcd. + if (lcd.getRotation()) { + // battery + gui_drawBatteryIcon(); - lcd.drawChar(' '); // Space out gap between battery <-> temp - if (systemSettings.temperatureInF) { - gui_drawTipTemp(); //Draw current tip temp - lcd.drawSymbol(0); //deg F - } else { - gui_drawTipTemp(); //Draw current tip temp - lcd.drawSymbol(1); //deg C - } + lcd.drawChar(' '); // Space out gap between battery <-> temp + if (systemSettings.temperatureInF) { + gui_drawTipTemp(); // Draw current tip temp + lcd.drawSymbol(0); // deg F + } else { + gui_drawTipTemp(); // Draw current tip temp + lcd.drawSymbol(1); // deg C + } - //We draw boost arrow if boosting, or else gap temp <-> heat indicator - if (boostModeOn) - lcd.drawSymbol(2); - else - lcd.drawChar(' '); + // We draw boost arrow if boosting, or else gap temp <-> heat indicator + if (boostModeOn) + lcd.drawSymbol(2); + else + lcd.drawChar(' '); - // Draw heating/cooling symbols - //If tip PWM > 10% then we are 'heating' - if (getTipPWM() > 10) - lcd.drawSymbol(14); - else - lcd.drawSymbol(15); - } else { + // Draw heating/cooling symbols + // If tip PWM > 10% then we are 'heating' + if (getTipPWM() > 10) + lcd.drawSymbol(14); + else + lcd.drawSymbol(15); + } else { + // Draw heating/cooling symbols + // If tip PWM > 10% then we are 'heating' + if (getTipPWM() > 10) + lcd.drawSymbol(14); + else + lcd.drawSymbol(15); + // We draw boost arrow if boosting, or else gap temp <-> heat indicator + if (boostModeOn) + lcd.drawSymbol(2); + else + lcd.drawChar(' '); - // Draw heating/cooling symbols - //If tip PWM > 10% then we are 'heating' - if (getTipPWM() > 10) - lcd.drawSymbol(14); - else - lcd.drawSymbol(15); - //We draw boost arrow if boosting, or else gap temp <-> heat indicator - if (boostModeOn) - lcd.drawSymbol(2); - else - lcd.drawChar(' '); + if (systemSettings.temperatureInF) { + gui_drawTipTemp(); // Draw current tip temp + lcd.drawSymbol(0); // deg F + } else { + gui_drawTipTemp(); // Draw current tip temp + lcd.drawSymbol(1); // deg C + } - if (systemSettings.temperatureInF) { - gui_drawTipTemp(); //Draw current tip temp - lcd.drawSymbol(0); //deg F - } else { - gui_drawTipTemp(); //Draw current tip temp - lcd.drawSymbol(1); //deg C - } + lcd.drawChar(' '); // Space out gap between battery <-> temp - lcd.drawChar(' '); // Space out gap between battery <-> temp + gui_drawBatteryIcon(); + } + } - gui_drawBatteryIcon(); - } - } + // Update the setpoints for the temperature + if (boostModeOn) { + if (systemSettings.temperatureInF) + currentlyActiveTemperatureTarget = + ftoTipMeasurement(systemSettings.BoostTemp); + else + currentlyActiveTemperatureTarget = + ctoTipMeasurement(systemSettings.BoostTemp); - //Update the setpoints for the temperature - if (boostModeOn) { - if (systemSettings.temperatureInF) - currentlyActiveTemperatureTarget = ftoTipMeasurement( - systemSettings.BoostTemp); - else - currentlyActiveTemperatureTarget = ctoTipMeasurement( - systemSettings.BoostTemp); + } else { + if (systemSettings.temperatureInF) + currentlyActiveTemperatureTarget = + ftoTipMeasurement(systemSettings.SolderingTemp); + else + currentlyActiveTemperatureTarget = + ctoTipMeasurement(systemSettings.SolderingTemp); + } - } else { - if (systemSettings.temperatureInF) - currentlyActiveTemperatureTarget = ftoTipMeasurement( - systemSettings.SolderingTemp); - else - currentlyActiveTemperatureTarget = ctoTipMeasurement( - systemSettings.SolderingTemp); - } - - //Undervoltage test - if (checkVoltageForExit()) { - return; - } - - lcd.refresh(); - if (systemSettings.sensitivity) - if (HAL_GetTick() - lastMovementTime > sleepThres - && HAL_GetTick() - lastButtonTime > sleepThres) { - if (gui_SolderingSleepingMode()) { - return; //If the function returns non-0 then exit - } - } - GUIDelay(); - HAL_IWDG_Refresh(&hiwdg); - } + // Undervoltage test + if (checkVoltageForExit()) { + return; + } + lcd.refresh(); + if (systemSettings.sensitivity) + if (HAL_GetTick() - lastMovementTime > sleepThres && + HAL_GetTick() - lastButtonTime > sleepThres) { + if (gui_SolderingSleepingMode()) { + return; // If the function returns non-0 then exit + } + } + GUIDelay(); + HAL_IWDG_Refresh(&hiwdg); + } } #define ACCELDEBUG 0 /* StartGUITask function */ -void startGUITask(void const * argument) { - /* - * Main program states: - * - * * Soldering (gui_solderingMode) - * -> Main loop where we draw temp, and animations - * --> User presses buttons and they goto the temperature adjust screen - * ---> Display the current setpoint temperature - * ---> Use buttons to change forward and back on temperature - * ---> Both buttons or timeout for exiting - * --> Long hold front button to enter boost mode - * ---> Just temporarily sets the system into the alternate temperature for PID control - * --> Long hold back button to exit - * --> Double button to exit - * * Settings Menu (gui_settingsMenu) - * -> Show setting name - * --> If no button press for > 3 Seconds, scroll description - * -> If user presses back button, adjust the setting - * -> Currently the same as 1.x (future to make more depth based) - */ +void startGUITask(void const *argument) { + /* + * Main program states: + * + * * Soldering (gui_solderingMode) + * -> Main loop where we draw temp, and animations + * --> User presses buttons and they goto the temperature adjust screen + * ---> Display the current setpoint temperature + * ---> Use buttons to change forward and back on temperature + * ---> Both buttons or timeout for exiting + * --> Long hold front button to enter boost mode + * ---> Just temporarily sets the system into the alternate temperature for + * PID control + * --> Long hold back button to exit + * --> Double button to exit + * * Settings Menu (gui_settingsMenu) + * -> Show setting name + * --> If no button press for > 3 Seconds, scroll description + * -> If user presses back button, adjust the setting + * -> Currently the same as 1.x (future to make more depth based) + */ - uint8_t animationStep = 0; - uint8_t tempWarningState = 0; + uint8_t animationStep = 0; + uint8_t tempWarningState = 0; - HAL_IWDG_Refresh(&hiwdg); - if (showBootLogoIfavailable()) - waitForButtonPressOrTimeout(2000); - HAL_IWDG_Refresh(&hiwdg); - if (systemSettings.autoStartMode) { - //jump directly to the autostart mode - if (systemSettings.autoStartMode == 1) - gui_solderingMode(); - } + HAL_IWDG_Refresh(&hiwdg); + if (showBootLogoIfavailable()) waitForButtonPressOrTimeout(2000); + HAL_IWDG_Refresh(&hiwdg); + if (systemSettings.autoStartMode) { + // jump directly to the autostart mode + if (systemSettings.autoStartMode == 1) gui_solderingMode(); + } #if ACCELDEBUG - for (;;) { - HAL_IWDG_Refresh(&hiwdg); - osDelay(100); - } - //^ Kept here for a way to block this thread + for (;;) { + HAL_IWDG_Refresh(&hiwdg); + osDelay(100); + } +//^ Kept here for a way to block this thread #endif - for (;;) { - ButtonState buttons = getButtonState(); - if (tempWarningState == 2) - buttons = BUTTON_F_SHORT; - switch (buttons) { - case BUTTON_NONE: - //Do nothing - break; - case BUTTON_BOTH: - //Not used yet - break; + for (;;) { + ButtonState buttons = getButtonState(); + if (tempWarningState == 2) buttons = BUTTON_F_SHORT; + switch (buttons) { + case BUTTON_NONE: + // Do nothing + break; + case BUTTON_BOTH: + // Not used yet + break; - case BUTTON_B_LONG: - //Show the version information - { - lcd.clearScreen(); //Ensure the buffer starts clean - lcd.setCursor(0, 0); //Position the cursor at the 0,0 (top left) - lcd.setFont(1); //small font - lcd.print((char*) "V2.01"); //Print version number - lcd.setCursor(0, 8); //second line - lcd.print(__DATE__); //print the compile date - lcd.refresh(); - waitForButtonPress(); - lcd.setFont(0); //reset font + case BUTTON_B_LONG: + // Show the version information + { + lcd.clearScreen(); // Ensure the buffer starts clean + lcd.setCursor(0, 0); // Position the cursor at the 0,0 (top left) + lcd.setFont(1); // small font + lcd.print((char *)"V2.01"); // Print version number + lcd.setCursor(0, 8); // second line + lcd.print(__DATE__); // print the compile date + lcd.refresh(); + waitForButtonPress(); + lcd.setFont(0); // reset font + } + break; + case BUTTON_F_LONG: + gui_solderingTempAdjust(); + saveSettings(); + break; + case BUTTON_F_SHORT: + lcd.setFont(0); + lcd.displayOnOff(true); // turn lcd on + gui_solderingMode(); // enter soldering mode + tempWarningState = 0; // make sure warning can show + break; + case BUTTON_B_SHORT: + lcd.setFont(0); + lcd.displayOnOff(true); // turn lcd on + gui_settingsMenu(); // enter the settings menu + saveSettings(); + setCalibrationOffset( + systemSettings.CalibrationOffset); // ensure cal offset is applied + break; + default: + break; + } + currentlyActiveTemperatureTarget = 0; // ensure tip is off - } - break; - case BUTTON_F_LONG: - gui_solderingTempAdjust(); - saveSettings(); - break; - case BUTTON_F_SHORT: - lcd.setFont(0); - lcd.displayOnOff(true); //turn lcd on - gui_solderingMode(); //enter soldering mode - tempWarningState = 0; //make sure warning can show - break; - case BUTTON_B_SHORT: - lcd.setFont(0); - lcd.displayOnOff(true); //turn lcd on - gui_settingsMenu(); //enter the settings menu - saveSettings(); - setCalibrationOffset(systemSettings.CalibrationOffset); //ensure cal offset is applied - break; - } - currentlyActiveTemperatureTarget = 0; //ensure tip is off + if (systemSettings.sensitivity) { + if ((HAL_GetTick() - lastMovementTime) > 60000 && + (HAL_GetTick() - lastButtonTime) > 60000) + 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*/ + lcd.displayOnOff(true); // turn lcd back on + } + uint16_t tipTemp = tipMeasurementToC(getTipRawTemp(0)); + if (tipTemp > 600) tipTemp = 0; + if (tipTemp > 50) { + if (tempWarningState == 0) { + currentlyActiveTemperatureTarget = 0; // ensure tip is off + lcd.displayOnOff(true); // force LCD on + if (gui_showTipTempWarning() == 1) { + tempWarningState = 2; // we can re-enter the warning + } else + tempWarningState = 1; + } + } else + tempWarningState = 0; + // Clear the lcd buffer + lcd.clearScreen(); + lcd.setCursor(0, 0); + if (systemSettings.detailedIDLE) { + lcd.setFont(1); + if (tipTemp > 470) { + lcd.print("Tip Disconnected!"); + } else { + lcd.print("Tip:"); + if (systemSettings.temperatureInF) + lcd.printNumber(tipMeasurementToF(getTipRawTemp(0)), 3); + else + lcd.printNumber(tipMeasurementToC(getTipRawTemp(0)), 3); + lcd.print(" "); + lcd.print("Set:"); + lcd.printNumber(systemSettings.SolderingTemp, 3); + } + lcd.setCursor(0, 8); + lcd.print("Input V: "); + lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) / 10, 2); + lcd.drawChar('.'); + lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) % 10, 1); + lcd.print("V"); - if (systemSettings.sensitivity) { - if ((HAL_GetTick() - lastMovementTime) > 60000 - && (HAL_GetTick() - lastButtonTime) > 60000) - 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*/ - lcd.displayOnOff(true); //turn lcd back on + } else { + lcd.setFont(0); + if (lcd.getRotation()) { + lcd.drawArea(12, 0, 84, 16, idleScreenBG); + lcd.setCursor(0, 0); + gui_drawBatteryIcon(); + } else { + lcd.drawArea(0, 0, 84, 16, idleScreenBGF); // Needs to be flipped + lcd.setCursor(84, 0); + gui_drawBatteryIcon(); + } + } - } - uint16_t tipTemp = tipMeasurementToC(getTipRawTemp(0)); - if (tipTemp > 600) - tipTemp = 0; - if (tipTemp > 50) { - if (tempWarningState == 0) { - currentlyActiveTemperatureTarget = 0; //ensure tip is off - lcd.displayOnOff(true); //force LCD on - if (gui_showTipTempWarning() == 1) { - tempWarningState = 2; //we can re-enter the warning - } else - tempWarningState = 1; - } - } else - tempWarningState = 0; - // Clear the lcd buffer - lcd.clearScreen(); - lcd.setCursor(0, 0); - if (systemSettings.detailedIDLE) { - lcd.setFont(1); - if (tipTemp > 470) { - lcd.print("Tip Disconnected!"); - } else { - lcd.print("Tip:"); - if (systemSettings.temperatureInF) - lcd.printNumber(tipMeasurementToF(getTipRawTemp(0)), 3); - else - lcd.printNumber(tipMeasurementToC(getTipRawTemp(0)), 3); - lcd.print(" "); - lcd.print("Set:"); - lcd.printNumber(systemSettings.SolderingTemp, 3); - } - lcd.setCursor(0, 8); - lcd.print("Input V: "); - lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) / 10, - 2); - lcd.drawChar('.'); - lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) % 10, - 1); - lcd.print("V"); - - } else { - lcd.setFont(0); - if (lcd.getRotation()) { - lcd.drawArea(12, 0, 84, 16, idleScreenBG); - lcd.setCursor(0, 0); - gui_drawBatteryIcon(); - } else { - lcd.drawArea(0, 0, 84, 16, idleScreenBGF); //Needs to be flipped - lcd.setCursor(84, 0); - gui_drawBatteryIcon(); - } - - } - - lcd.refresh(); - animationStep++; - HAL_IWDG_Refresh(&hiwdg); - GUIDelay(); - - } + lcd.refresh(); + animationStep++; + HAL_IWDG_Refresh(&hiwdg); + GUIDelay(); + } } /* StartPIDTask function */ -void startPIDTask(void const * argument) { - /* - * We take the current tip temperature & evaluate the next step for the tip control PWM - * Tip temperature is measured by getTipTemperature(1) so we get instant result - * This comes in Cx10 format - * We then control the tip temperature to aim for the setpoint in the settings struct - * - */ - int32_t integralCount = 0; - int32_t derivativeLastValue = 0; - int32_t kp, ki, kd, kb; - int32_t backoffOverflow = 0; - kp = 20; - ki = 50; - kd = 40; - kb = 0; - // REMEBER ^^^^ These constants are backwards - // They act as dividers, so to 'increase' a P term, you make the number smaller. - const int32_t itermMax = 40; - for (;;) { - uint16_t rawTemp = getTipRawTemp(1); //get instantaneous reading - if (currentlyActiveTemperatureTarget) { - //Compute the PID loop in here - //Because our values here are quite large for all measurements (0-16k ~= 33 counts per C) - //P I & D are divisors, so inverse logic applies (beware) +void startPIDTask(void const *argument) { + /* + * We take the current tip temperature & evaluate the next step for the tip + * control PWM + * Tip temperature is measured by getTipTemperature(1) so we get instant + * result + * This comes in Cx10 format + * We then control the tip temperature to aim for the setpoint in the settings + * struct + * + */ + int32_t integralCount = 0; + int32_t derivativeLastValue = 0; + int32_t kp, ki, kd, kb; + int32_t backoffOverflow = 0; + kp = 20; + ki = 50; + kd = 40; + kb = 0; + // REMEBER ^^^^ These constants are backwards + // They act as dividers, so to 'increase' a P term, you make the number + // smaller. + const int32_t itermMax = 40; + for (;;) { + uint16_t rawTemp = getTipRawTemp(1); // get instantaneous reading + if (currentlyActiveTemperatureTarget) { + // Compute the PID loop in here + // Because our values here are quite large for all measurements (0-16k ~= + // 33 counts per C) + // P I & D are divisors, so inverse logic applies (beware) - int32_t rawTempError = currentlyActiveTemperatureTarget - rawTemp; - int32_t ierror = (rawTempError / ki); - integralCount += ierror; - if (integralCount > (itermMax / 2)) - integralCount = itermMax / 2; //prevent too much lead - else if (integralCount < -itermMax) - integralCount = itermMax; + int32_t rawTempError = currentlyActiveTemperatureTarget - rawTemp; + int32_t ierror = (rawTempError / ki); + integralCount += ierror; + if (integralCount > (itermMax / 2)) + integralCount = itermMax / 2; // prevent too much lead + else if (integralCount < -itermMax) + integralCount = itermMax; - int32_t dInput = (rawTemp - derivativeLastValue); + int32_t dInput = (rawTemp - derivativeLastValue); - /*Compute PID Output*/ - int32_t output = (rawTempError / kp); - if (ki) - output += integralCount; - if (kd) - output -= (dInput / kd); - if (kb) - output -= backoffOverflow / kb; + /*Compute PID Output*/ + int32_t output = (rawTempError / kp); + if (ki) output += integralCount; + if (kd) output -= (dInput / kd); + if (kb) output -= backoffOverflow / kb; - if (output > 100) { - backoffOverflow = output; - output = 100; //saturate - } else if (output < 0) { - backoffOverflow = output; - output = 0; - } else - backoffOverflow = 0; - if (currentlyActiveTemperatureTarget < rawTemp) { - output = 0; - integralCount = 0; - backoffOverflow = 0; - derivativeLastValue = 0; - } - setTipPWM(output); - } else { - setTipPWM(0); //disable the output driver if the output is set to be off elsewhere - integralCount = 0; - backoffOverflow = 0; - derivativeLastValue = 0; - } - derivativeLastValue = rawTemp; //store for next loop - HAL_IWDG_Refresh(&hiwdg); - osDelay(100); // 10 Hz temp loop - } + if (output > 100) { + backoffOverflow = output; + output = 100; // saturate + } else if (output < 0) { + backoffOverflow = output; + output = 0; + } else + backoffOverflow = 0; + if (currentlyActiveTemperatureTarget < rawTemp) { + output = 0; + integralCount = 0; + backoffOverflow = 0; + derivativeLastValue = 0; + } + setTipPWM(output); + } else { + setTipPWM(0); // disable the output driver if the output is set to be off + // elsewhere + integralCount = 0; + backoffOverflow = 0; + derivativeLastValue = 0; + } + derivativeLastValue = rawTemp; // store for next loop + HAL_IWDG_Refresh(&hiwdg); + osDelay(100); // 10 Hz temp loop + } } #define MOVFilter 8 -void startMOVTask(void const * argument) { - osDelay(4000); //wait for accel to stabilize - int16_t datax[MOVFilter]; - int16_t datay[MOVFilter]; - int16_t dataz[MOVFilter]; - uint8_t currentPointer = 0; - memset(datax, 0, MOVFilter * sizeof(int16_t)); - memset(datay, 0, MOVFilter * sizeof(int16_t)); - memset(dataz, 0, MOVFilter * sizeof(int16_t)); - int16_t tx, ty, tz; - int32_t avgx, avgy, avgz; - if (systemSettings.sensitivity > 9) - systemSettings.sensitivity = 9; +void startMOVTask(void const *argument) { + osDelay(4000); // wait for accel to stabilize + int16_t datax[MOVFilter]; + int16_t datay[MOVFilter]; + int16_t dataz[MOVFilter]; + uint8_t currentPointer = 0; + memset(datax, 0, MOVFilter * sizeof(int16_t)); + memset(datay, 0, MOVFilter * sizeof(int16_t)); + memset(dataz, 0, MOVFilter * sizeof(int16_t)); + int16_t tx, ty, tz; + int32_t avgx, avgy, avgz; + if (systemSettings.sensitivity > 9) systemSettings.sensitivity = 9; #if ACCELDEBUG - uint32_t max = 0; + uint32_t max = 0; #endif - for (;;) { - int32_t threshold = 1200 + (9 * 200); - threshold -= systemSettings.sensitivity * 200; // 200 is the step size - accel.getAxisReadings(&tx, &ty, &tz); + for (;;) { + int32_t threshold = 1200 + (9 * 200); + threshold -= systemSettings.sensitivity * 200; // 200 is the step size + accel.getAxisReadings(&tx, &ty, &tz); - datax[currentPointer] = (int32_t) tx; - datay[currentPointer] = (int32_t) ty; - dataz[currentPointer] = (int32_t) tz; - currentPointer = (currentPointer + 1) % MOVFilter; + datax[currentPointer] = (int32_t)tx; + datay[currentPointer] = (int32_t)ty; + dataz[currentPointer] = (int32_t)tz; + currentPointer = (currentPointer + 1) % MOVFilter; #if ACCELDEBUG - //Debug for Accel + // Debug for Accel - avgx = avgy = avgz = 0; - for (uint8_t i = 0; i < MOVFilter; i++) { - avgx += datax[i]; - avgy += datay[i]; - avgz += dataz[i]; - } - avgx /= MOVFilter; - avgy /= MOVFilter; - avgz /= MOVFilter; - lcd.setFont(1); - lcd.setCursor(0, 0); - lcd.printNumber(abs(avgx - (int32_t) tx), 5); - lcd.print(" "); - lcd.printNumber(abs(avgy - (int32_t) ty), 5); - if ((abs(avgx - tx) + abs(avgy - ty) + abs(avgz - tz)) > max) - max = (abs(avgx - tx) + abs(avgy - ty) + abs(avgz - tz)); - lcd.setCursor(0, 8); - lcd.printNumber(max, 5); - lcd.print(" "); + avgx = avgy = avgz = 0; + for (uint8_t i = 0; i < MOVFilter; i++) { + avgx += datax[i]; + avgy += datay[i]; + avgz += dataz[i]; + } + avgx /= MOVFilter; + avgy /= MOVFilter; + avgz /= MOVFilter; + lcd.setFont(1); + lcd.setCursor(0, 0); + lcd.printNumber(abs(avgx - (int32_t)tx), 5); + lcd.print(" "); + lcd.printNumber(abs(avgy - (int32_t)ty), 5); + if ((abs(avgx - tx) + abs(avgy - ty) + abs(avgz - tz)) > max) + max = (abs(avgx - tx) + abs(avgy - ty) + abs(avgz - tz)); + lcd.setCursor(0, 8); + lcd.printNumber(max, 5); + lcd.print(" "); - lcd.printNumber((abs(avgx - tx) + abs(avgy - ty) + abs(avgz - tz)), 5); - lcd.refresh(); - if (HAL_GPIO_ReadPin(KEY_A_GPIO_Port, KEY_A_Pin) == GPIO_PIN_RESET) - max = 0; + lcd.printNumber((abs(avgx - tx) + abs(avgy - ty) + abs(avgz - tz)), 5); + lcd.refresh(); + if (HAL_GPIO_ReadPin(KEY_A_GPIO_Port, KEY_A_Pin) == GPIO_PIN_RESET) max = 0; #endif - //Only run the actual processing if the sensitivity is set (aka we are enabled) - if (systemSettings.sensitivity) { - //calculate averages - avgx = avgy = avgz = 0; - for (uint8_t i = 0; i < MOVFilter; i++) { - avgx += datax[i]; - avgy += datay[i]; - avgz += dataz[i]; - } - avgx /= MOVFilter; - avgy /= MOVFilter; - avgz /= MOVFilter; + // Only run the actual processing if the sensitivity is set (aka we are + // enabled) + if (systemSettings.sensitivity) { + // calculate averages + avgx = avgy = avgz = 0; + for (uint8_t i = 0; i < MOVFilter; i++) { + avgx += datax[i]; + avgy += datay[i]; + avgz += dataz[i]; + } + avgx /= MOVFilter; + avgy /= MOVFilter; + avgz /= MOVFilter; - //So now we have averages, we want to look if these are different by more than the threshold - int32_t error = (abs(avgx - tx) + abs(avgy - ty) + abs(avgz - tz)); - //If error has occured then we update the tick timer - if (error > threshold) { - lastMovementTime = HAL_GetTick(); - } - } + // So now we have averages, we want to look if these are different by more + // than the threshold + int32_t error = (abs(avgx - tx) + abs(avgy - ty) + abs(avgz - tz)); + // If error has occured then we update the tick timer + if (error > threshold) { + lastMovementTime = HAL_GetTick(); + } + } - osDelay(100); //Slow down update rate - - } + osDelay(100); // Slow down update rate + } } /* StartRotationTask function */ -void startRotationTask(void const * argument) { - /* - * This task is used to manage rotation of the LCD screen & button re-mapping - * - */ - osDelay(1000); //wait for accel to stabilize - HAL_NVIC_SetPriority(EXTI3_IRQn, 5, 0); - HAL_NVIC_EnableIRQ(EXTI3_IRQn); - HAL_NVIC_SetPriority(EXTI9_5_IRQn, 5, 0); - HAL_NVIC_EnableIRQ(EXTI9_5_IRQn); -//^ We hold off enabling these until now to ensure the semaphore is available to be used first - switch (systemSettings.OrientationMode) { - case 0: - lcd.setRotation(false); - break; - case 1: - lcd.setRotation(true); - break; - case 2: - lcd.setRotation(false); - break; - } - for (;;) { - if ( xSemaphoreTake( rotationChangedSemaphore, portMAX_DELAY ) == pdTRUE - || (HAL_GPIO_ReadPin(INT_Orientation_GPIO_Port, - INT_Orientation_Pin) == GPIO_PIN_RESET)) { - // a rotation event has occured - bool rotation = accel.getOrientation(); - if (systemSettings.OrientationMode == 2) - lcd.setRotation(rotation); // link the data through - } - osDelay(300); - - } +void startRotationTask(void const *argument) { + /* + * This task is used to manage rotation of the LCD screen & button re-mapping + * + */ + osDelay(1000); // wait for accel to stabilize + HAL_NVIC_SetPriority(EXTI3_IRQn, 5, 0); + HAL_NVIC_EnableIRQ(EXTI3_IRQn); + HAL_NVIC_SetPriority(EXTI9_5_IRQn, 5, 0); + HAL_NVIC_EnableIRQ(EXTI9_5_IRQn); + //^ We hold off enabling these until now to ensure the semaphore is available + // to be used first + switch (systemSettings.OrientationMode) { + case 0: + lcd.setRotation(false); + break; + case 1: + lcd.setRotation(true); + break; + case 2: + lcd.setRotation(false); + break; + default: + break; + } + for (;;) { + if (xSemaphoreTake(rotationChangedSemaphore, portMAX_DELAY) == pdTRUE || + (HAL_GPIO_ReadPin(INT_Orientation_GPIO_Port, INT_Orientation_Pin) == + GPIO_PIN_RESET)) { + // a rotation event has occured + bool rotation = accel.getOrientation(); + if (systemSettings.OrientationMode == 2) + lcd.setRotation(rotation); // link the data through + } + osDelay(300); + } } -//Handler called by HAL when a EXTI occurs, but after IRQ bit is cleared +// Handler called by HAL when a EXTI occurs, but after IRQ bit is cleared void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) { - static signed long xHigherPriorityTaskWoken; - if (GPIO_Pin == INT_Orientation_Pin) { - xSemaphoreGiveFromISR(rotationChangedSemaphore, - &xHigherPriorityTaskWoken); - } else if (GPIO_Pin == INT_Movement_Pin) { - //New data is available for reading from the unit - //xSemaphoreGiveFromISR(accelDataAvailableSemaphore, &xHigherPriorityTaskWoken); - - } + static signed long xHigherPriorityTaskWoken; + if (GPIO_Pin == INT_Orientation_Pin) { + xSemaphoreGiveFromISR(rotationChangedSemaphore, &xHigherPriorityTaskWoken); + } else if (GPIO_Pin == INT_Movement_Pin) { + // New data is available for reading from the unit + // xSemaphoreGiveFromISR(accelDataAvailableSemaphore, + // &xHigherPriorityTaskWoken); + } } -#define FLASH_LOGOADDR (0x8000000|0xB800) /*second last page of flash set aside for logo image*/ +#define FLASH_LOGOADDR \ + (0x8000000 | 0xB800) /*second last page of flash set aside for logo image*/ bool showBootLogoIfavailable() { -//check if the header is there (0xAA,0x55,0xF0,0x0D) -//If so display logo - uint16_t temp[98]; + // check if the header is there (0xAA,0x55,0xF0,0x0D) + // If so display logo + uint16_t temp[98]; - for (uint8_t i = 0; i < (98); i++) { - temp[i] = *(uint16_t *) (FLASH_LOGOADDR + (i * 2)); - } - uint8_t temp8[98 * 2]; - for (uint8_t i = 0; i < 98; i++) { - temp8[i * 2] = temp[i] >> 8; - temp8[i * 2 + 1] = temp[i] & 0xFF; + for (uint8_t i = 0; i < (98); i++) { + temp[i] = *(uint16_t *)(FLASH_LOGOADDR + (i * 2)); + } + uint8_t temp8[98 * 2]; + for (uint8_t i = 0; i < 98; i++) { + temp8[i * 2] = temp[i] >> 8; + temp8[i * 2 + 1] = temp[i] & 0xFF; + } - } - - if (temp8[0] != 0xAA) - return false; - if (temp8[1] != 0x55) - return false; - if (temp8[2] != 0xF0) - return false; - if (temp8[3] != 0x0D) - return false; - - lcd.drawArea(0, 0, 96, 16, (uint8_t*) (temp8 + 4)); - lcd.refresh(); - return true; + if (temp8[0] != 0xAA) return false; + if (temp8[1] != 0x55) return false; + if (temp8[2] != 0xF0) return false; + if (temp8[3] != 0x0D) return false; + lcd.drawArea(0, 0, 96, 16, (uint8_t *)(temp8 + 4)); + lcd.refresh(); + return true; }