Skip to content

Commit

Permalink
V1.09 - Add display update mode
Browse files Browse the repository at this point in the history
Adds the following modes for display update:
Fast (old style)
Slow (1Hz)
Rounded (Only shows to 10C increments)
None (No temp, just symbol)
  • Loading branch information
Ralim committed Jul 7, 2017
1 parent 13603d8 commit f3156e8
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 16 deletions.
2 changes: 2 additions & 0 deletions workspace/ts100/inc/Modes.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ enum {
TEMPCAL, //Cal tip temp offset

} operatingMode;
#define SETTINGSOPTIONSCOUNT 8 /*Number of settings in the settings menu*/

enum {
UVCO = 0,
Expand All @@ -38,6 +39,7 @@ enum {
MOTIONDETECT,
MOTIONSENSITIVITY,
TEMPDISPLAY,
DISPLAYMODE,
LEFTY,
} settingsPage;

Expand Down
14 changes: 9 additions & 5 deletions workspace/ts100/inc/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@
#define SETTINGS_H_
#include <stdint.h>
#include "stm32f10x_flash.h"
#define SETTINGSVERSION 0x05 /*Change this if you change the struct below to prevent people getting out of sync*/
#define SETTINGSOPTIONSCOUNT 7 /*Number of settings in the settings menu*/
#define MOTION_HIGH (0x00)
#define MOTION_MED (0x10)
#define MOTION_LOW (0x20)
#define SETTINGSVERSION 0x06 /*Change this if you change the struct below to prevent people getting out of sync*/
#define MOTION_HIGH (0x00)
#define MOTION_MED (0x10)
#define MOTION_LOW (0x20)
#define DISPLAYMODE_FAST (0x00)
#define DISPLAYMODE_SLOW (0x01)
#define DISPLAYMODE_ROUND (0x02)
#define DISPLAYMODE_NONE (0x03)
/*
* This struct must be a multiple of 2 bytes as it is saved / restored from flash in uint16_t chunks
*/
Expand All @@ -30,6 +33,7 @@ struct {
uint8_t flipDisplay:1; //If true we want to invert the display for lefties
uint8_t sensitivity:7; //Sensitivity of accelerometer
uint8_t ShutdownTime:7; //Time until unit shuts down if left alone
uint8_t displayUpdateMode:2; //How fast the display updates / temp showing mode
uint16_t tempCalibration; //Temperature calibration value
uint16_t voltageDiv; //Voltage divisor factor
} systemSettings;
Expand Down
2 changes: 1 addition & 1 deletion workspace/ts100/src/Main.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void setup() {
readIronTemp(systemSettings.tempCalibration, 0,0); //load the default calibration value
Init_Oled(systemSettings.flipDisplay); //Init the OLED display

OLED_DrawString("VER 1.08", 8); //
OLED_DrawString("VER 1.09", 8); //
delayMs(800); //Pause to show version number
Start_Watchdog(1000); //start the system watch dog as 1 second timeout
}
62 changes: 53 additions & 9 deletions workspace/ts100/src/Modes.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,10 @@ void ProcessUI() {
settingsPage = 0; //reset
operatingMode = STARTUP; //reset back to the startup
saveSettings(); //Save the settings
} else
} else {
++settingsPage; //move to the next option

}
} else if (Buttons & BUT_B) {
resetLastButtonPress();
//B changes the value selected
Expand Down Expand Up @@ -124,6 +126,7 @@ void ProcessUI() {
case MOTIONDETECT:
systemSettings.movementEnabled =
!systemSettings.movementEnabled;

break;
case TEMPDISPLAY:
systemSettings.displayTempInF = !systemSettings.displayTempInF;
Expand All @@ -132,11 +135,17 @@ void ProcessUI() {
systemSettings.flipDisplay = !systemSettings.flipDisplay;
break;
case MOTIONSENSITIVITY:

systemSettings.sensitivity += 0x10;
if (systemSettings.sensitivity > 0x20)
systemSettings.sensitivity = 0; //reset to high on wrap

break;
case DISPLAYMODE:
systemSettings.displayUpdateMode++;
systemSettings.displayUpdateMode =
systemSettings.displayUpdateMode % 4;
break;
default:
break;
}
Expand Down Expand Up @@ -288,6 +297,7 @@ void drawTemp(uint16_t temp, uint8_t x) {
* Performs all the OLED drawing for the current operating mode
*/
void DrawUI() {
static uint32_t lastSolderingDrawTime = 0;
uint16_t temp = readIronTemp(0, 0, 0xFFFF);
switch (operatingMode) {
case STARTUP:
Expand All @@ -305,26 +315,42 @@ void DrawUI() {
case SOLDERING:
//The user is soldering
{
drawTemp(temp, 0);
OLED_DrawChar(' ', 3);
if (systemSettings.displayUpdateMode == DISPLAYMODE_FAST
|| (systemSettings.displayUpdateMode == DISPLAYMODE_SLOW
&& (millis() - lastSolderingDrawTime > 1000))) {
drawTemp(temp, 0);
} else if (systemSettings.displayUpdateMode == DISPLAYMODE_ROUND) {
drawTemp((temp / 100) * 100, 0);

} else if (systemSettings.displayUpdateMode == DISPLAYMODE_NONE) {
OLED_DrawChar(' ', 0);
OLED_DrawChar(' ', 1);
OLED_DrawChar(' ', 2);
}
//Now draw symbols
OLED_DrawChar(' ', 3);
OLED_BlankSlot(6 * 12 + 16, 24 - 16);//blank out the tail after the arrows
OLED_BlankSlot(4 * 12 + 16, 24 - 16);//blank out the tail after the temp
if (getIronTimer() == 0) {
OLED_DrawSymbol(6, 5);
} else {
if (getIronTimer() < 900) {
if (getIronTimer() < 1000) {
OLED_DrawSymbol(6, 7);
} else { //we are heating
//OLED_DrawChar('H', 5);
OLED_DrawSymbol(6, 6);
}
}
if (systemSettings.displayTempInF) {
OLED_DrawSymbol(4, 1);
if (!(systemSettings.displayUpdateMode == DISPLAYMODE_NONE)) {
if (systemSettings.displayTempInF) {
OLED_DrawSymbol(4, 1);
} else {
OLED_DrawSymbol(4, 0);
}
} else {
OLED_DrawSymbol(4, 0);
OLED_DrawChar(' ', 4);
OLED_DrawChar(' ', 5);
}

}
break;
case TEMP_ADJ:
Expand Down Expand Up @@ -395,7 +421,25 @@ void DrawUI() {
}

break;

case DISPLAYMODE:
//We are prompting the user about their display mode preferences
{
switch (systemSettings.displayUpdateMode) {
case DISPLAYMODE_FAST:
OLED_DrawString("DISPMD F", 8);
break;
case DISPLAYMODE_SLOW:
OLED_DrawString("DISPMD S", 8);
break;
case DISPLAYMODE_ROUND:
OLED_DrawString("DISPMD R", 8);
break;
case DISPLAYMODE_NONE:
OLED_DrawString("DISPMD N", 8);
break;
}
}
break;
default:
break;
}
Expand Down
2 changes: 1 addition & 1 deletion workspace/ts100/ts100.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
<name>ts100</name>
<mcuId>stm32f103t8ux</mcuId>
<dbgIF>SWD</dbgIF>
<dbgDEV>ST-LinkV2</dbgDEV>
<dbgDEV>ST-Link</dbgDEV>
</board>
</targetDefinitions>

0 comments on commit f3156e8

Please sign in to comment.