From 2e823b659467ee95fcd20ca9df70ae31ecb1db57 Mon Sep 17 00:00:00 2001 From: mkninc Date: Wed, 26 Jul 2017 01:18:41 +0200 Subject: [PATCH] Quick fix for multiple definition of structs (#33) --- workspace/ts100/inc/Modes.h | 8 ++++---- workspace/ts100/inc/PID.h | 4 ++-- workspace/ts100/inc/Settings.h | 6 ++++-- workspace/ts100/src/Modes.c | 4 ++++ workspace/ts100/src/PID.c | 3 +++ workspace/ts100/src/Settings.c | 3 +++ 6 files changed, 20 insertions(+), 8 deletions(-) diff --git a/workspace/ts100/inc/Modes.h b/workspace/ts100/inc/Modes.h index 5bee11c3..9a24b328 100644 --- a/workspace/ts100/inc/Modes.h +++ b/workspace/ts100/inc/Modes.h @@ -17,7 +17,7 @@ #include "Settings.h" #include "Analog.h" #include -enum { +typedef enum { STARTUP, //we are sitting on the prompt to push a button SOLDERING, //Normal operating mode TEMP_ADJ, //Adjust the set temperature @@ -29,10 +29,10 @@ enum { DCINDISP, //Disp the input voltage && Cal the DCin voltage divider TEMPCAL, //Cal tip temp offset -} operatingMode; +} operatingModeEnum; #define SETTINGSOPTIONSCOUNT 10 /*Number of settings in the settings menu*/ -enum { +typedef enum { UVCO = 0, SLEEP_TEMP, SLEEP_TIME, @@ -44,7 +44,7 @@ enum { LEFTY, BOOSTMODE, BOOSTTEMP, -} settingsPage; +} settingsPageEnum; void ProcessUI(); void DrawUI(); diff --git a/workspace/ts100/inc/PID.h b/workspace/ts100/inc/PID.h index 3527c6d8..4f6105a9 100644 --- a/workspace/ts100/inc/PID.h +++ b/workspace/ts100/inc/PID.h @@ -12,9 +12,9 @@ #include "Analog.h" #include "Interrupt.h" -struct { +typedef struct { uint32_t kp, ki, kd; //PID values -} pidSettings; +} pidSettingsType; int32_t computePID(uint16_t setpoint); void setupPID(void); diff --git a/workspace/ts100/inc/Settings.h b/workspace/ts100/inc/Settings.h index 7df12186..a3b6fea7 100644 --- a/workspace/ts100/inc/Settings.h +++ b/workspace/ts100/inc/Settings.h @@ -25,7 +25,7 @@ /* * This struct must be a multiple of 2 bytes as it is saved / restored from flash in uint16_t chunks */ -struct { +typedef struct { uint16_t SolderingTemp; //current set point for the iron uint32_t SleepTemp; //temp to drop to in sleep uint8_t version; //Used to track if a reset is needed on firmware upgrade @@ -42,7 +42,9 @@ struct { uint16_t tempCalibration; //Temperature calibration value uint16_t voltageDiv; //Voltage divisor factor uint16_t BoostTemp; //Boost mode set point for the iron -} systemSettings; +} systemSettingsType; + +extern systemSettingsType systemSettings; void saveSettings(); void restoreSettings(); diff --git a/workspace/ts100/src/Modes.c b/workspace/ts100/src/Modes.c index 6b6ebac6..1c30efb4 100644 --- a/workspace/ts100/src/Modes.c +++ b/workspace/ts100/src/Modes.c @@ -17,6 +17,10 @@ const char *SettingsLongNames[] = { " Temperature when in boost mode" }; uint8_t StatusFlags = 0; uint32_t temporaryTempStorage = 0; + +operatingModeEnum operatingMode; +settingsPageEnum settingsPage; + //This does the required processing and state changes void ProcessUI() { uint8_t Buttons = getButtons(); //read the buttons status diff --git a/workspace/ts100/src/PID.c b/workspace/ts100/src/PID.c index 97601d3a..37b11551 100644 --- a/workspace/ts100/src/PID.c +++ b/workspace/ts100/src/PID.c @@ -7,6 +7,9 @@ #include "PID.h" #define MAXPIDOUTPUT 50000 + +pidSettingsType pidSettings; + //This function computes the new value for the ON time of the system //This is the return value from this function int32_t computePID(uint16_t setpoint) { diff --git a/workspace/ts100/src/Settings.c b/workspace/ts100/src/Settings.c index 2f68ad65..707a1e80 100644 --- a/workspace/ts100/src/Settings.c +++ b/workspace/ts100/src/Settings.c @@ -10,6 +10,9 @@ #include "Settings.h" #define FLASH_ADDR (0x8000000|0xBC00)/*Flash start OR'ed with the maximum amount of flash - 1024 bytes*/ #define FLASH_LOGOADDR (0x8000000|0xB800) /*second last page of flash set aside for logo image*/ + +systemSettingsType systemSettings; + void saveSettings() { //First we erase the flash FLASH_Unlock(); //unlock flash writing