Skip to content

Commit

Permalink
Enable SWD back, Add Off mode for Sleep
Browse files Browse the repository at this point in the history
  • Loading branch information
Ralim committed Mar 30, 2018
1 parent fe5ee91 commit 8eadb98
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 31 deletions.
6 changes: 4 additions & 2 deletions workspace/TS100/.cproject
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="fr.ac6.managedbuild.targetPlatform.gnu.cross.317155453" isAbstract="false" osList="all" superClass="fr.ac6.managedbuild.targetPlatform.gnu.cross"/>
<builder buildPath="${workspace_loc:/TS100}/Debug" id="fr.ac6.managedbuild.builder.gnu.cross.910934658" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="fr.ac6.managedbuild.builder.gnu.cross"/>
<tool id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.319926124" name="MCU GCC Compiler" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler">
<option id="fr.ac6.managedbuild.gnu.c.compiler.option.optimization.level.1178790692" name="Optimization Level" superClass="fr.ac6.managedbuild.gnu.c.compiler.option.optimization.level" useByScannerDiscovery="false" value="fr.ac6.managedbuild.gnu.c.optimization.level.debug" valueType="enumerated"/>
<option id="fr.ac6.managedbuild.gnu.c.compiler.option.optimization.level.1178790692" name="Optimization Level" superClass="fr.ac6.managedbuild.gnu.c.compiler.option.optimization.level" useByScannerDiscovery="false" value="fr.ac6.managedbuild.gnu.c.optimization.level.size" valueType="enumerated"/>
<option id="gnu.c.compiler.option.debugging.level.1214895662" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.max" valueType="enumerated"/>
<option id="gnu.c.compiler.option.include.paths.1766485383" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/inc&quot;"/>
Expand All @@ -44,11 +44,12 @@
<listOptionValue builtIn="false" value="USE_RTOS_SYSTICK"/>
</option>
<option id="gnu.c.compiler.option.dialect.std.565083189" name="Language standard" superClass="gnu.c.compiler.option.dialect.std" useByScannerDiscovery="true" value="gnu.c.compiler.dialect.default" valueType="enumerated"/>
<option id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.fdata.338139343" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.fdata" useByScannerDiscovery="false" value="true" valueType="boolean"/>
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.c.176392389" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.c"/>
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.s.893418158" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.s"/>
</tool>
<tool id="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.1941847243" name="MCU G++ Compiler" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler">
<option id="fr.ac6.managedbuild.gnu.cpp.compiler.option.optimization.level.1283353237" name="Optimization Level" superClass="fr.ac6.managedbuild.gnu.cpp.compiler.option.optimization.level" useByScannerDiscovery="false" value="fr.ac6.managedbuild.gnu.cpp.optimization.level.debug" valueType="enumerated"/>
<option id="fr.ac6.managedbuild.gnu.cpp.compiler.option.optimization.level.1283353237" name="Optimization Level" superClass="fr.ac6.managedbuild.gnu.cpp.compiler.option.optimization.level" useByScannerDiscovery="false" value="fr.ac6.managedbuild.gnu.cpp.optimization.level.size" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.debugging.level.224874042" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.include.paths.1749257477" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/inc&quot;"/>
Expand All @@ -70,6 +71,7 @@
<listOptionValue builtIn="false" value="USE_RTOS_SYSTICK"/>
</option>
<option id="gnu.cpp.compiler.option.dialect.std.1681974405" name="Language standard" superClass="gnu.cpp.compiler.option.dialect.std" useByScannerDiscovery="true" value="gnu.cpp.compiler.dialect.default" valueType="enumerated"/>
<option id="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.fdata.1463726438" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.fdata" useByScannerDiscovery="false" value="true" valueType="boolean"/>
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.input.cpp.149685854" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.input.cpp"/>
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.input.s.1092052043" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.input.s"/>
</tool>
Expand Down
1 change: 1 addition & 0 deletions workspace/TS100/inc/Translation.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ extern const char* IdleTipString;
extern const char* IdleSetString;
extern const char* TipDisconnectedString;
extern const char* SolderingAdvancedPowerPrompt;
extern const char* OffString;

extern const char SettingTrueChar;
extern const char SettingFalseChar;
Expand Down
2 changes: 1 addition & 1 deletion workspace/TS100/inc/main.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

extern OLED lcd;
extern MMA8652FC accel;

extern uint8_t PCBVersion;
enum ButtonState {
BUTTON_NONE = 0, /* No buttons pressed / < filter time*/
BUTTON_F_SHORT = 1, /* User has pressed the front button*/
Expand Down
2 changes: 1 addition & 1 deletion workspace/TS100/src/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void restoreSettings() {
*/
uint8_t lookupVoltageLevel(uint8_t level) {
if (level == 0)
return 100; //10V since iron does not function effectively below this
return 90; //9V since iron does not function effectively below this
else
return (level * 33) + (33 * 2);
}
Expand Down
17 changes: 17 additions & 0 deletions workspace/TS100/src/Translation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ const char* IdleTipString = "Tip:"; // IdleTipString+IdleSet
const char* IdleSetString = " Set:"; // preferably start with a space; IdleTipString+IdleSetString <= 10
const char* TipDisconnectedString = "TIP DISCONNECTED"; // <=16 chars
const char* SolderingAdvancedPowerPrompt = "Power: "; // <=12 chars
const char* OffString ="Off";// 3 chars max

const char SettingRightChar = 'R';
const char SettingLeftChar = 'L';
Expand Down Expand Up @@ -176,6 +177,7 @@ const char* IdleTipString = "Връх:"; // IdleTipString+
const char* IdleSetString = " Set:"; // preferably start with a space; IdleTipString+IdleSetString <= 10
const char* TipDisconnectedString = "ВРЪХ ЛОША ВРЪЗКА"; // <=16 chars
const char* SolderingAdvancedPowerPrompt = "Захранване: "; // <=12 chars
const char* OffString ="Off";// 3 chars max

const char SettingRightChar = 'R';
const char SettingLeftChar = 'L';
Expand Down Expand Up @@ -258,6 +260,7 @@ const char* IdleTipString = "Tip:"; // IdleTipString+IdleSe
const char* IdleSetString = " Set:"; // preferably start with a space; IdleTipString+IdleSetString <= 10
const char* TipDisconnectedString = "TIP DISCONNECTED"; // <=16 chars
const char* SolderingAdvancedPowerPrompt = "Power: "; // <=12 chars
const char* OffString ="Off";// 3 chars max

/*
* #TODO change support for multibyte constants here
Expand Down Expand Up @@ -345,6 +348,7 @@ const char* IdleTipString = "Tip:"; // IdleTipString+IdleSe
const char* IdleSetString = " Set:"; // preferably start with a space; IdleTipString+IdleSetString <= 10
const char* TipDisconnectedString = "TIP DISCONNECTED"; // <=16 chars
const char* SolderingAdvancedPowerPrompt = "Power: "; // <=12 chars
const char* OffString ="Off";// 3 chars max

const char SettingRightChar = 'D'; // D is "Derecha" = Right
const char SettingLeftChar = 'I'; // I is "Izquierda" = Left
Expand Down Expand Up @@ -425,6 +429,7 @@ const char* IdleTipString = "Tip:"; // IdleTipString+IdleSe
const char* IdleSetString = " Set:"; // preferably start with a space; IdleTipString+IdleSetString <= 10
const char* TipDisconnectedString = "TIP DISCONNECTED"; // <=16 chars
const char* SolderingAdvancedPowerPrompt = "Power: "; // <=12 chars
const char* OffString ="Off";// 3 chars max

const char SettingRightChar = 'R';
const char SettingLeftChar = 'L';
Expand Down Expand Up @@ -506,6 +511,7 @@ const char* IdleTipString = "Punta:"; // IdleTipString+IdleSetS
const char* IdleSetString = "/"; // preferably start with a space; IdleTipString+IdleSetString <= 10
const char* TipDisconnectedString = "PUNTA ASSENTE"; // <=16 chars
const char* SolderingAdvancedPowerPrompt = "Potenza:"; // <=12 chars
const char* OffString ="Off";// 3 chars max

const char SettingRightChar = 'D';
const char SettingLeftChar = 'S';
Expand Down Expand Up @@ -587,6 +593,7 @@ const char* IdleTipString = "PANNE:"; // IdleTipString+IdleS
const char* IdleSetString = " Set:"; // preferably start with a space; IdleTipString+IdleSetString <= 10
const char* TipDisconnectedString = "PANNE DEBRANCH"; // <=16 chars
const char* SolderingAdvancedPowerPrompt = "Puissance: "; // <= 12 chars
const char* OffString ="Off";// 3 chars max

const char SettingRightChar = 'D';
const char SettingLeftChar = 'G';
Expand Down Expand Up @@ -668,6 +675,7 @@ const char* IdleTipString = "Ist:"; // IdleTipString+IdleSe
const char* IdleSetString = " Soll:"; // preferably start with a space; IdleTipString+IdleSetString <= 10
const char* TipDisconnectedString = "Spitze fehlt"; // <=16 chars
const char* SolderingAdvancedPowerPrompt = "Leistung: "; // <= 12 chars
const char* OffString ="Off";// 3 chars max

const char SettingRightChar = 'R';
const char SettingLeftChar = 'L';
Expand Down Expand Up @@ -748,6 +756,7 @@ const char* IdleTipString = "Tip:"; // IdleTipString+IdleSe
const char* IdleSetString = " Set:"; // preferably start with a space; IdleTipString+IdleSetString <= 10
const char* TipDisconnectedString = "TIP DISCONNECTED"; // <=16 chars
const char* SolderingAdvancedPowerPrompt = "Power: "; // <=12 chars
const char* OffString ="Off";// 3 chars max

const char SettingRightChar = 'R';
const char SettingLeftChar = 'L';
Expand Down Expand Up @@ -828,6 +837,7 @@ const char* IdleTipString = "Tip:"; // IdleTipString+IdleSet
const char* IdleSetString = " Set:"; // preferably start with a space; IdleTipString+IdleSetString <= 10
const char* TipDisconnectedString = "TIP DISCONNECTED"; // <=16 chars
const char* SolderingAdvancedPowerPrompt = "Power: "; // <=12 chars
const char* OffString ="Off";// 3 chars max

const char SettingRightChar = 'R';
const char SettingLeftChar = 'L';
Expand Down Expand Up @@ -908,6 +918,7 @@ const char* IdleTipString = "Vrh: "; // IdleTipString+IdleSet
const char* IdleSetString = " / "; // preferably start with a space; IdleTipString+IdleSetString <= 10
const char* TipDisconnectedString = "VRH NIJE SPOJEN!"; // <=16 chars
const char* SolderingAdvancedPowerPrompt = "Snaga: "; // <=12 chars
const char* OffString ="Off";// 3 chars max

const char SettingRightChar = 'D';
const char SettingLeftChar = 'L';
Expand Down Expand Up @@ -986,6 +997,7 @@ const char* IdleTipString = "Hrot:"; // IdleTipString+IdleSet
const char* IdleSetString = " Cíl:"; // preferably start with a space; IdleTipString+IdleSetString <= 10
const char* TipDisconnectedString = "HROT NEPŘIPOJEN"; // <=16 chars
const char* SolderingAdvancedPowerPrompt = "Ohřev: "; // <=12 chars
const char* OffString ="Off";// 3 chars max

const char SettingRightChar = 'P';
const char SettingLeftChar = 'L';
Expand Down Expand Up @@ -1070,6 +1082,7 @@ const char* IdleTipString = "Tip:"; // IdleTipString+IdleSet
const char* IdleSetString = " Set:"; // preferably start with a space; IdleTipString+IdleSetString <= 10
const char* TipDisconnectedString = "TIP DISCONNECTED"; // <=16 chars
const char* SolderingAdvancedPowerPrompt = "Power: "; // <=12 chars
const char* OffString ="Off";// 3 chars max

const char SettingRightChar = 'R';
const char SettingLeftChar = 'L';
Expand Down Expand Up @@ -1150,6 +1163,7 @@ const char* IdleTipString = "Tip:"; // IdleTipString+IdleSet
const char* IdleSetString = " Set:"; // preferably start with a space; IdleTipString+IdleSetString <= 10
const char* TipDisconnectedString = "TIP DISCONNECTED"; // <=16 chars
const char* SolderingAdvancedPowerPrompt = "Power: "; // <=12 chars
const char* OffString ="Off";// 3 chars max

const char SettingRightChar = 'H';
const char SettingLeftChar = 'V';
Expand Down Expand Up @@ -1230,6 +1244,7 @@ const char* IdleTipString = "Tip:"; // IdleTipString+IdleSet
const char* IdleSetString = " Set:"; // preferably start with a space; IdleTipString+IdleSetString <= 10
const char* TipDisconnectedString = "TIP DISCONNECTED"; // <=16 chars
const char* SolderingAdvancedPowerPrompt = "Power: "; // <=12 chars
const char* OffString ="Off";// 3 chars max

const char SettingRightChar = 'P';
const char SettingLeftChar = 'L';
Expand Down Expand Up @@ -1310,6 +1325,7 @@ const char* IdleTipString = "Ponta:"; // IdleTipString+IdleSetSt
const char* IdleSetString = " Aj:"; // preferably start with a space; IdleTipString+IdleSetString <= 10
const char* TipDisconnectedString = "SEM PONTA"; // <=16 chars
const char* SolderingAdvancedPowerPrompt = "Power: "; // <=12 chars
const char* OffString ="Off";// 3 chars max

const char SettingRightChar = 'D';
const char SettingLeftChar = 'C';
Expand Down Expand Up @@ -1390,6 +1406,7 @@ const char* IdleTipString = "Ant:"; // IdleTipString+Idle
const char* IdleSetString = " Nust:"; // preferably start with a space; IdleTipString+IdleSetString <= 10
const char* TipDisconnectedString = "ANTGAL ATJUNGTAS"; // <=16 chars
const char* SolderingAdvancedPowerPrompt = "Maitinimas: "; // <=12 chars
const char* OffString ="Off";// 3 chars max

const char SettingRightChar = 'D';
const char SettingLeftChar = 'K';
Expand Down
57 changes: 32 additions & 25 deletions workspace/TS100/src/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,15 +228,11 @@ static int userConfirmation(const char* message) {
int16_t lastOffset = -1;
bool lcdRefresh = true;


for (;;) {

int16_t messageOffset =
((xTaskGetTickCount() - messageStart)
/ (systemSettings.descriptionScrollSpeed == 1 ?
1 : 2));
messageOffset %= messageWidth; //Roll around at the end

int16_t messageOffset = ((xTaskGetTickCount() - messageStart)
/ (systemSettings.descriptionScrollSpeed == 1 ? 1 : 2));
messageOffset %= messageWidth; //Roll around at the end

if (lastOffset != messageOffset) {
lcd.clearScreen();
Expand Down Expand Up @@ -302,15 +298,18 @@ static void settings_displaySleepTemp(void) {
static void settings_setSleepTime(void) {
systemSettings.SleepTime++; // Go up 1 minute at a time
if (systemSettings.SleepTime >= 16) {
systemSettings.SleepTime = 1; // can't set time over 10 mins
systemSettings.SleepTime = 0; // can't set time over 10 mins
}
// Remember that ^ is the time of no movement
if (PCBVersion == 3)
systemSettings.SleepTime = 0; //Disable sleep on no accel
}

static void settings_displaySleepTime(void) {
printShortDescription(2, 5);

if (systemSettings.SleepTime < 6) {
if (systemSettings.SleepTime == 0) {
lcd.print(OffString);
} else if (systemSettings.SleepTime < 6) {
lcd.printNumber(systemSettings.SleepTime * 10, 2);
lcd.drawChar('S');
} else {
Expand All @@ -324,11 +323,18 @@ static void settings_setShutdownTime(void) {
if (systemSettings.ShutdownTime > 60) {
systemSettings.ShutdownTime = 0; // wrap to off
}
if (PCBVersion == 3)
systemSettings.ShutdownTime = 0; //Disable shutdown on no accel
}

static void settings_displayShutdownTime(void) {
printShortDescription(3, 6);
lcd.printNumber(systemSettings.ShutdownTime, 2);
printShortDescription(3, 5);
if (systemSettings.ShutdownTime == 0) {
lcd.print(OffString);
} else {
lcd.printNumber(systemSettings.ShutdownTime, 2);
lcd.drawChar('M');
}
}

static void settings_setTempF(void) {
Expand Down Expand Up @@ -388,18 +394,18 @@ static void settings_setDisplayRotation(void) {
systemSettings.OrientationMode++;
systemSettings.OrientationMode = systemSettings.OrientationMode % 3;
switch (systemSettings.OrientationMode) {
case 0:
lcd.setRotation(false);
break;
case 1:
lcd.setRotation(true);
break;
case 2:
//do nothing on auto
break;
default:
break;
}
case 0:
lcd.setRotation(false);
break;
case 1:
lcd.setRotation(true);
break;
case 2:
//do nothing on auto
break;
default:
break;
}
}

static void settings_displayDisplayRotation(void) {
Expand Down Expand Up @@ -719,7 +725,8 @@ void gui_Menu(const menuitem* menu) {

if ((PRESS_ACCEL_INTERVAL_MAX - autoRepeatAcceleration)
< PRESS_ACCEL_INTERVAL_MIN) {
autoRepeatAcceleration = PRESS_ACCEL_INTERVAL_MAX - PRESS_ACCEL_INTERVAL_MIN;
autoRepeatAcceleration = PRESS_ACCEL_INTERVAL_MAX
- PRESS_ACCEL_INTERVAL_MIN;
}

if (lcdRefresh) {
Expand Down
3 changes: 3 additions & 0 deletions workspace/TS100/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ int main(void) {
lcd.setFont(0); // default to bigger font
//Testing for new weird board version
uint8_t buffer[1];
HAL_IWDG_Refresh(&hiwdg);
if (HAL_I2C_Mem_Read(&hi2c1, 29 << 1, 0x0F, I2C_MEMADD_SIZE_8BIT, buffer, 1,
1000) == HAL_OK) {
PCBVersion = 1;
Expand All @@ -59,6 +60,8 @@ int main(void) {
accel2.initalize(); //startup the accelerometer
} else {
PCBVersion = 3;
systemSettings.SleepTime=0;
systemSettings.ShutdownTime=0;//No accel -> disable sleep
}
HAL_IWDG_Refresh(&hiwdg);
restoreSettings(); // load the settings from flash
Expand Down
4 changes: 2 additions & 2 deletions workspace/TS100/src/stm32f1xx_hal_msp.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ void HAL_MspInit(void) {

/**NOJTAG: JTAG-DP Disabled and SW-DP Enabled
*/
// __HAL_AFIO_REMAP_SWJ_NOJTAG()
__HAL_AFIO_REMAP_SWJ_DISABLE(); /*Disable swd for debug io use*/
__HAL_AFIO_REMAP_SWJ_NOJTAG();
// __HAL_AFIO_REMAP_SWJ_DISABLE(); /*Disable swd for debug io use*/


}
Expand Down

0 comments on commit 8eadb98

Please sign in to comment.