Add ability to start into sleep
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
#include <stdint.h>
|
||||
#include "stm32f10x_flash.h"
|
||||
#include "Oled.h"
|
||||
#define SETTINGSVERSION 16 /*Change this if you change the struct below to prevent people getting out of sync*/
|
||||
#define SETTINGSVERSION 17 /*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)
|
||||
@@ -35,7 +35,7 @@ typedef struct {
|
||||
uint8_t displayTempInF:1; //If we need to convert the C reading to F
|
||||
uint8_t OrientationMode:2; //If true we want to invert the display for lefties
|
||||
uint8_t sensitivity:5; //Sensitivity of accelerometer (5 bits)
|
||||
uint8_t autoStart:1; //Should the unit automatically jump straight into soldering mode when power is applied
|
||||
uint8_t autoStart:2; //Should the unit automatically jump straight into soldering mode when power is applied
|
||||
uint8_t ShutdownTime:6; //Time until unit shuts down if left alone
|
||||
uint8_t displayUpdateSpeed:2; //How fast the display updates / temp showing mode
|
||||
uint8_t temperatureRounding:2; //Rounding mode for the temperature
|
||||
|
||||
@@ -19,6 +19,7 @@ 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 SettingSleepChar;
|
||||
extern const char SettingFastChar;
|
||||
extern const char SettingMediumChar;
|
||||
extern const char SettingSlowChar;
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user