Add ability to start into sleep

This commit is contained in:
Ben V. Brown
2017-08-09 10:07:34 +10:00
parent 8cc7d452ce
commit 9969c66520
5 changed files with 19 additions and 10 deletions

View File

@@ -14,13 +14,15 @@ void setup();
int main(void) {
setup();/*Setup the system*/
if (systemSettings.autoStart)
if (systemSettings.autoStart == 1)
operatingMode = SOLDERING;
else if (systemSettings.autoStart == 2)
operatingMode = SLEEP;
while (1) {
Clear_Watchdog(); //reset the Watch dog timer
ProcessUI();
DrawUI();
OLED_Sync();//Write out the screen buffer
OLED_Sync(); //Write out the screen buffer
delayMs(15); //Slow the system down waiting for the iron.
if (systemSettings.OrientationMode == 2) {
@@ -28,8 +30,7 @@ int main(void) {
if (RotationChangedFlag) {
OLED_SetOrientation(!getOrientation());
RotationChangedFlag = 0;
}
else if (GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_3) == Bit_RESET) {
} else if (GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_3) == Bit_RESET) {
OLED_SetOrientation(!getOrientation());
RotationChangedFlag = 0;
//^ This is a workaround for the IRQ being set off before we have the handler setup and enabled.

View File

@@ -218,7 +218,8 @@ void ProcessUI() {
systemSettings.powerDisplay = !systemSettings.powerDisplay;
break;
case AUTOSTART:
systemSettings.autoStart = !systemSettings.autoStart;
systemSettings.autoStart++;
systemSettings.autoStart %=3;
break;
case COOLINGBLINK:
systemSettings.coolingTempBlink =
@@ -660,6 +661,7 @@ void DrawUI() {
case 0:
OLED_DrawChar(SettingFalseChar, 7);
break;
}
break;
case AUTOSTART:
@@ -671,6 +673,9 @@ void DrawUI() {
case 0:
OLED_DrawChar(SettingFalseChar, 7);
break;
case 2:
OLED_DrawChar(SettingSleepChar, 7);
break;
}
break;
case COOLINGBLINK:

View File

@@ -18,10 +18,10 @@ const char* SettingsLongNames[14] =
" Temperature Unit", " Temperature Rounding Amount",
" Temperature Display Update Rate",
" Display Orientation <A. Automatic L. Left Handed R. Right Handed>",
" Enable front key boost 450C mode when soldering",
" Temperature when in boost mode",
" Enable front key enters boost mode 450C mode when soldering",
" Temperature when in \"boost\" mode",
" Changes the arrows to a power display when soldering",
" Automatically starts the iron into soldering on power up.",
" Automatically starts the iron into soldering on power up.T=Soldering, S= Sleep mode,F=Off",
" Blink the temperature on the cooling screen while the tip is still hot." };
const char* TempCalStatus[3] = { "Cal Temp", "Cal OK ", "Cal Fail" }; //All fixed 8 chars
@@ -29,6 +29,8 @@ 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 SettingSleepChar = 'S';
const char SettingFastChar = 'F';
const char SettingMediumChar = 'M';
const char SettingSlowChar = 'S';