@@ -44,7 +44,7 @@ void StartUp_Accelerometer(uint8_t sensitivity) {
|
|||||||
I2C_RegisterWrite( CTRL_REG2, 0x40); // Reset all registers to POR values
|
I2C_RegisterWrite( CTRL_REG2, 0x40); // Reset all registers to POR values
|
||||||
delayMs(2); // ~1ms delay
|
delayMs(2); // ~1ms delay
|
||||||
I2C_RegisterWrite(FF_MT_CFG_REG, 0x78); // Enable motion detection for X and Y axis, latch enabled
|
I2C_RegisterWrite(FF_MT_CFG_REG, 0x78); // Enable motion detection for X and Y axis, latch enabled
|
||||||
uint8_t sens = 9 * 6 + 3;
|
uint8_t sens = 9 * 6 + 5;
|
||||||
sens -= 6 * sensitivity;
|
sens -= 6 * sensitivity;
|
||||||
|
|
||||||
I2C_RegisterWrite(FF_MT_THS_REG, 0x80 | sens); // Set threshold
|
I2C_RegisterWrite(FF_MT_THS_REG, 0x80 | sens); // Set threshold
|
||||||
|
|||||||
@@ -74,15 +74,20 @@ void ProcessUI() {
|
|||||||
StatusFlags = 0;
|
StatusFlags = 0;
|
||||||
}
|
}
|
||||||
//We need to check the timer for movement in case we need to goto idle
|
//We need to check the timer for movement in case we need to goto idle
|
||||||
if (systemSettings.sensitivity)
|
if (systemSettings.sensitivity) {
|
||||||
if (millis() - getLastMovement()
|
uint32_t timeout = 0;
|
||||||
> (systemSettings.SleepTime * 60000)) {
|
if (systemSettings.SleepTime < 6)
|
||||||
if (millis() - getLastButtonPress()
|
timeout = 1000 * 10 * systemSettings.SleepTime;
|
||||||
> (systemSettings.SleepTime * 60000)) {
|
else
|
||||||
|
timeout = 60 * 1000 * (systemSettings.SleepTime - 5);
|
||||||
|
|
||||||
|
if (millis() - getLastMovement() > (timeout)) {
|
||||||
|
if (millis() - getLastButtonPress() > (timeout)) {
|
||||||
operatingMode = SLEEP;
|
operatingMode = SLEEP;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
uint16_t voltage = readDCVoltage(systemSettings.voltageDiv); //get X10 voltage
|
uint16_t voltage = readDCVoltage(systemSettings.voltageDiv); //get X10 voltage
|
||||||
if ((voltage) < lookupVoltageLevel(systemSettings.cutoutSetting)) {
|
if ((voltage) < lookupVoltageLevel(systemSettings.cutoutSetting)) {
|
||||||
operatingMode = UVLOWARN;
|
operatingMode = UVLOWARN;
|
||||||
@@ -170,7 +175,7 @@ void ProcessUI() {
|
|||||||
break;
|
break;
|
||||||
case SLEEP_TIME:
|
case SLEEP_TIME:
|
||||||
++systemSettings.SleepTime; //Go up 1 minute at a time
|
++systemSettings.SleepTime; //Go up 1 minute at a time
|
||||||
if (systemSettings.SleepTime > 30)
|
if (systemSettings.SleepTime > 16)
|
||||||
systemSettings.SleepTime = 1;//can't set time over 30 mins
|
systemSettings.SleepTime = 1;//can't set time over 30 mins
|
||||||
//Remember that ^ is the time of no movement
|
//Remember that ^ is the time of no movement
|
||||||
break;
|
break;
|
||||||
@@ -566,8 +571,17 @@ void DrawUI() {
|
|||||||
OLED_DrawThreeNumber(systemSettings.SleepTemp / 10, 5);
|
OLED_DrawThreeNumber(systemSettings.SleepTemp / 10, 5);
|
||||||
break;
|
break;
|
||||||
case SLEEP_TIME:
|
case SLEEP_TIME:
|
||||||
OLED_DrawString(SettingsShortNames[SLEEP_TIME], 6);
|
Clear_Screen();
|
||||||
OLED_DrawTwoNumber(systemSettings.SleepTime, 6);
|
OLED_DrawString(SettingsShortNames[SLEEP_TIME], 5);
|
||||||
|
//Draw in the timescale
|
||||||
|
if (systemSettings.SleepTime < 6) {
|
||||||
|
OLED_DrawChar('S', 7);
|
||||||
|
OLED_DrawTwoNumber(systemSettings.SleepTime * 10, 5);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
OLED_DrawChar('M', 7);
|
||||||
|
OLED_DrawTwoNumber(systemSettings.SleepTime - 5, 5);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case SHUTDOWN_TIME:
|
case SHUTDOWN_TIME:
|
||||||
OLED_DrawString(SettingsShortNames[SHUTDOWN_TIME], 6);
|
OLED_DrawString(SettingsShortNames[SHUTDOWN_TIME], 6);
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ uint8_t lookupVoltageLevel(uint8_t level) {
|
|||||||
void resetSettings() {
|
void resetSettings() {
|
||||||
|
|
||||||
systemSettings.SleepTemp = 1500;//Temperature the iron sleeps at - default 150.0 C
|
systemSettings.SleepTemp = 1500;//Temperature the iron sleeps at - default 150.0 C
|
||||||
systemSettings.SleepTime = 1;//How many minutes we wait until going to sleep - default 1 min
|
systemSettings.SleepTime = 6;//How many seconds/minutes we wait until going to sleep - default 1 min
|
||||||
systemSettings.SolderingTemp = 3200; //Default soldering temp is 320.0 C
|
systemSettings.SolderingTemp = 3200; //Default soldering temp is 320.0 C
|
||||||
systemSettings.cutoutSetting = 0; //default to no cut-off voltage
|
systemSettings.cutoutSetting = 0; //default to no cut-off voltage
|
||||||
systemSettings.version = SETTINGSVERSION;//Store the version number to allow for easier upgrades
|
systemSettings.version = SETTINGSVERSION;//Store the version number to allow for easier upgrades
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ const char* CoolingPromptString = "Cool "; //Fixed width 5 chars
|
|||||||
const char SettingTrueChar = 'T';
|
const char SettingTrueChar = 'T';
|
||||||
const char SettingFalseChar = 'F';
|
const char SettingFalseChar = 'F';
|
||||||
const char SettingSleepChar = 'S';
|
const char SettingSleepChar = 'S';
|
||||||
|
|
||||||
const char SettingFastChar = 'F';
|
const char SettingFastChar = 'F';
|
||||||
const char SettingMediumChar = 'M';
|
const char SettingMediumChar = 'M';
|
||||||
const char SettingSlowChar = 'S';
|
const char SettingSlowChar = 'S';
|
||||||
@@ -64,6 +63,7 @@ const char* UVLOWarningString = "LOW VOLT";//Fixed width 8 chars
|
|||||||
const char* CoolingPromptString = "COOL ";//Fixed width 5 chars
|
const char* CoolingPromptString = "COOL ";//Fixed width 5 chars
|
||||||
const char SettingTrueChar = 'T';
|
const char SettingTrueChar = 'T';
|
||||||
const char SettingFalseChar = 'F';
|
const char SettingFalseChar = 'F';
|
||||||
|
const char SettingSleepChar = 'S';
|
||||||
const char SettingFastChar = 'F';
|
const char SettingFastChar = 'F';
|
||||||
const char SettingMediumChar = 'M';
|
const char SettingMediumChar = 'M';
|
||||||
const char SettingSlowChar = 'S';
|
const char SettingSlowChar = 'S';
|
||||||
@@ -74,6 +74,6 @@ const char SettingTempCChar = 'C';
|
|||||||
const char SettingTempFChar = 'F';
|
const char SettingTempFChar = 'F';
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char* SettingsShortNames[14] = { "PWRSC ", "STMP ", "SLTME ", "SHTME ",
|
const char* SettingsShortNames[14] = { "PWRSC ", "STMP ", "STME ", "SHTME ",
|
||||||
"MSENSE ", "TMPUNT ", "TMPRND ", "TMPSPD ", "DSPROT ", "BOOST ",
|
"MSENSE ", "TMPUNT ", "TMPRND ", "TMPSPD ", "DSPROT ", "BOOST ",
|
||||||
"BTMP ", "PWRDSP ", "ASTART ", "CLBLNK " };
|
"BTMP ", "PWRDSP ", "ASTART ", "CLBLNK " };
|
||||||
|
|||||||
Reference in New Issue
Block a user