1
0
forked from me/IronOS

Moving more text into strings.c/.h

This commit is contained in:
Ben V. Brown
2017-08-08 10:49:15 +10:00
parent 48040acbcc
commit a10947cdac
6 changed files with 69 additions and 34 deletions

View File

@@ -11,7 +11,6 @@ void delayMs(uint32_t ticks);
extern volatile uint32_t lastMovement;
extern volatile uint8_t rawKeys;
inline uint32_t millis() {
return system_Ticks;
}

View File

@@ -12,7 +12,7 @@
#include <stdint.h>
#include "stm32f10x_flash.h"
#include "Oled.h"
#define SETTINGSVERSION 15 /*Change this if you change the struct below to prevent people getting out of sync*/
#define SETTINGSVERSION 16 /*Change this if you change the struct below to prevent people getting out of sync*/
//Display Speeds
#define DISPLAYMODE_FAST (0x00)
#define DISPLAYMODE_MEDIUM (0x01)

View File

@@ -14,5 +14,17 @@
extern const char* SettingsLongNames[13];
extern const char* SettingsShortNames[13];
extern const char* TempCalStatus[3]; //All fixed 8 chars
extern const char* UVLOWarningString; //Fixed width 8 chars
extern const char* CoolingPromptString; //Fixed width 5 chars
extern const char SettingTrueChar;
extern const char SettingFalseChar;
extern const char SettingFastChar;
extern const char SettingMediumChar;
extern const char SettingSlowChar;
extern const char SettingRightChar;
extern const char SettingLeftChar;
extern const char SettingAutoChar;
extern const char SettingTempCChar;
extern const char SettingTempFChar;
#endif /* STRINGS_H_ */

View File

@@ -24,7 +24,7 @@ uint8_t getButtons() {
//We want to check the times for the lat buttons & also the rawKeys state
//If a key has just gone down, rawKeys & KEY ==1
uint8_t out = 0;
if (millis() - AkeyChange > 100) {
if (millis() - AkeyChange > 50) {
if (LongKeys & BUT_A) {
if (rawKeys & BUT_A) {
if (millis() - AkeyChange > 800) {
@@ -61,7 +61,7 @@ uint8_t getButtons() {
}
}
}
if (millis() - BkeyChange > 100) {
if (millis() - BkeyChange > 50) {
if (LongKeys & BUT_B) {
if (rawKeys & BUT_B) {
if (millis() - BkeyChange > 800) {

View File

@@ -33,6 +33,9 @@ void ProcessUI() {
}
break;
case SOLDERING:
if ((millis() - getLastButtonPress()) < 250)
Buttons = 0;
//^ This is to make the button more delayed in timing for people to find A+B easier
//We need to check the buttons if we need to jump out
if ((Buttons == BUT_A && !systemSettings.boostModeEnabled)
|| Buttons == BUT_B) {
@@ -151,7 +154,7 @@ void ProcessUI() {
operatingMode = STARTUP; //reset back to the startup
saveSettings(); //Save the settings
} else {
++settingsPage; //move to the next option
++settingsPage; //move to the next option
}
} else if (Buttons & BUT_A) {
//B changes the value selected
@@ -167,7 +170,7 @@ void ProcessUI() {
systemSettings.SleepTemp = 500; //cant sleep higher than 300 or less than 50
break;
case SLEEP_TIME:
++systemSettings.SleepTime; //Go up 1 minute at a time
++systemSettings.SleepTime; //Go up 1 minute at a time
if (systemSettings.SleepTime > 30)
systemSettings.SleepTime = 1;//can't set time over 30 mins
//Remember that ^ is the time of no movement
@@ -473,9 +476,9 @@ void DrawUI() {
OLED_DrawChar(' ', 5);
}
if (systemSettings.displayTempInF) {
OLED_DrawChar('F', 3);
OLED_DrawChar(SettingTempFChar, 3);
} else {
OLED_DrawChar('C', 3);
OLED_DrawChar(SettingTempCChar, 3);
}
//Optionally draw the arrows, or draw the power instead
if (systemSettings.powerDisplay) {
@@ -565,23 +568,24 @@ void DrawUI() {
OLED_DrawTwoNumber(systemSettings.ShutdownTime, 6);
break;
case TEMPDISPLAY:/*Are we showing in C or F ?*/
OLED_DrawString(SettingsShortNames[TEMPDISPLAY], 7);
if (systemSettings.displayTempInF)
OLED_DrawString("TMPUNT F", 8);
OLED_DrawChar(SettingTempFChar, 7);
else
OLED_DrawString("TMPUNT C", 8);
OLED_DrawChar(SettingTempCChar, 7);
break;
case SCREENROTATION:
OLED_DrawString(SettingsShortNames[SCREENROTATION], 7);
switch (systemSettings.OrientationMode) {
case 0:
OLED_DrawChar('R', 7);
OLED_DrawChar(SettingRightChar, 7);
break;
case 1:
OLED_DrawChar('L', 7);
OLED_DrawChar(SettingLeftChar, 7);
break;
case 2:
OLED_DrawChar('A', 7);
OLED_DrawChar(SettingAutoChar, 7);
break;
}
break;
@@ -614,13 +618,13 @@ void DrawUI() {
OLED_DrawString(SettingsShortNames[DISPUPDATERATE], 7);
switch (systemSettings.displayUpdateSpeed) {
case DISPLAYMODE_FAST:
OLED_DrawChar('F', 7);
OLED_DrawChar(SettingFastChar, 7);
break;
case DISPLAYMODE_SLOW:
OLED_DrawChar('S', 7);
OLED_DrawChar(SettingSlowChar, 7);
break;
case DISPLAYMODE_MEDIUM:
OLED_DrawChar('M', 7);
OLED_DrawChar(SettingMediumChar, 7);
break;
}
@@ -631,10 +635,10 @@ void DrawUI() {
switch (systemSettings.boostModeEnabled) {
case 1:
OLED_DrawChar('T', 7);
OLED_DrawChar(SettingTrueChar, 7);
break;
case 0:
OLED_DrawChar('F', 7);
OLED_DrawChar(SettingFalseChar, 7);
break;
}
break;
@@ -646,10 +650,10 @@ void DrawUI() {
OLED_DrawString(SettingsShortNames[POWERDISPLAY], 7);
switch (systemSettings.powerDisplay) {
case 1:
OLED_DrawChar('T', 7);
OLED_DrawChar(SettingTrueChar, 7);
break;
case 0:
OLED_DrawChar('F', 7);
OLED_DrawChar(SettingFalseChar, 7);
break;
}
break;
@@ -657,10 +661,10 @@ void DrawUI() {
OLED_DrawString(SettingsShortNames[AUTOSTART], 7);
switch (systemSettings.autoStart) {
case 1:
OLED_DrawChar('T', 7);
OLED_DrawChar(SettingTrueChar, 7);
break;
case 0:
OLED_DrawChar('F', 7);
OLED_DrawChar(SettingFalseChar, 7);
break;
}
break;
@@ -702,12 +706,12 @@ void DrawUI() {
break;
case COOLING:
//We are warning the user the tip is cooling
OLED_DrawString("COOL ", 5);
OLED_DrawString(CoolingPromptString, 5);
temp = readIronTemp(0, 1, 0xFFFF); //force temp re-reading
drawTemp(temp, 5, systemSettings.temperatureRounding);
break;
case UVLOWARN:
OLED_DrawString("LOW VOLT", 8);
OLED_DrawString(UVLOWarningString, 8);
break;
case THERMOMETER:
temp = readIronTemp(0, 1, 0xFFFF); //Force a reading as heater is off
@@ -733,14 +737,7 @@ void DrawUI() {
}
break;
case TEMPCAL: {
if (StatusFlags == 0) {
OLED_DrawString("CAL TEMP", 8);
} else if (StatusFlags == 1) {
OLED_DrawString("CAL OK ", 8);
} else if (StatusFlags == 2) {
OLED_DrawString("CAL FAIL", 8);
}
OLED_DrawString(TempCalStatus[StatusFlags], 8);
}
break;

View File

@@ -23,6 +23,20 @@ const char* SettingsLongNames[13] =
" Changes the arrows to a power display when soldering",
" Automatically starts the iron into soldering on power up." };
const char* TempCalStatus[3] = { "CAL TEMP", "CAL OK ", "CAL FAIL" }; //All fixed 8 chars
const char* UVLOWarningString = "LOW VOLT"; //Fixed width 8 chars
const char* CoolingPromptString = "COOL "; //Fixed width 5 chars
const char SettingTrueChar = 'T';
const char SettingFalseChar = 'F';
const char SettingFastChar = 'F';
const char SettingMediumChar = 'F';
const char SettingSlowChar = 'F';
const char SettingRightChar = 'R';
const char SettingLeftChar = 'L';
const char SettingAutoChar = 'A';
const char SettingTempCChar = 'C';
const char SettingTempFChar = 'F';
#endif
#ifdef LANG_ES
const char* SettingsLongNames[13] =
@@ -39,8 +53,21 @@ const char* SettingsLongNames[13] =
" Activar el boton <Boost> en modo soldadura.",
" Temperatura en modo <Boost>.",
" Cambiar las flechas en pantalla por indicador de potencia en modo soldadura.",
" Automatically starts the iron into soldering on power up."};
" Iniciar directamente modo soldadura en el encendido."};
const char* TempCalStatus[3] = {"CAL TEMP", "CAL OK ", "CAL FAIL"}; //All fixed 8 chars
const char* UVLOWarningString = "LOW VOLT";//Fixed width 8 chars
const char* CoolingPromptString = "COOL ";//Fixed width 5 chars
const char SettingTrueChar = 'T';
const char SettingFalseChar = 'F';
const char SettingFastChar = 'F';
const char SettingMediumChar = 'F';
const char SettingSlowChar = 'F';
const char SettingRightChar = 'R';
const char SettingLeftChar = 'L';
const char SettingAutoChar = 'A';
const char SettingTempCChar = 'C';
const char SettingTempFChar = 'F';
#endif
const char* SettingsShortNames[13] = { "PWRSC ", "STMP ", "SLTME ", "SHTME ",