Fix font erroring char. Add accel lockout for autostart.

Helps for the following issues:
#51
#38
This commit is contained in:
Ben V. Brown
2017-08-11 16:31:04 +10:00
parent ea1b0e2ae3
commit c5c1171112
5 changed files with 18 additions and 6 deletions

View File

@@ -9,6 +9,7 @@ volatile uint8_t rawKeys;
volatile uint8_t LongKeys;
volatile uint32_t lastMovement; //millis() at last movement event
volatile uint8_t RotationChangedFlag;
volatile uint8_t InterruptMask;
//Delay in milliseconds using systemTick
void delayMs(uint32_t ticks) {
@@ -35,7 +36,7 @@ uint8_t getButtons() {
out = (BUT_A | BUT_B);
AkeyChange = millis();
BkeyChange = millis();
rawKeys=0;
rawKeys = 0;
}
LongKeys = 0;
} else {
@@ -172,7 +173,8 @@ void EXTI9_5_IRQHandler(void) {
BkeyChange = millis();
EXTI_ClearITPendingBit(EXTI_Line6);
} else if (EXTI_GetITStatus(EXTI_Line5) != RESET) { //Movement Event
lastMovement = millis();
if (!InterruptMask)
lastMovement = millis();
EXTI_ClearITPendingBit(EXTI_Line5);
}

View File

@@ -18,6 +18,10 @@ int main(void) {
operatingMode = SOLDERING;
else if (systemSettings.autoStart == 2)
operatingMode = SLEEP;
if (systemSettings.autoStart) {
InterruptMask = 1; //set the mask
lastMovement = 0;
}
while (1) {
Clear_Watchdog(); //reset the Watch dog timer
ProcessUI();
@@ -36,12 +40,17 @@ int main(void) {
//^ This is a workaround for the IRQ being set off before we have the handler setup and enabled.
}
}
if (GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_5) == Bit_RESET) {
if ((GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_5) == Bit_RESET)&&!InterruptMask) {
lastMovement = millis();
//This is a workaround for the line staying low as the user is still moving. (ie sensitivity is too high for their amount of movement)
}
delayMs(15); //Slow the system down waiting for the iron.
if (systemSettings.autoStart && (millis() > 10000) && InterruptMask) {
//If the user has setup the device to auto enter a startup mode, we normally have the interrupts on motion masked for the inital 10 seconds to prevent waking up during initalization
//This allows us to re-enable these interrupts.
InterruptMask = 0;
}
}
}
void setup() {

View File

@@ -269,14 +269,14 @@ void ProcessUI() {
operatingMode = SOLDERING;
Oled_DisplayOn();
return;
} else if (systemSettings.sensitivity) {
} else if (systemSettings.sensitivity&& !InterruptMask) {
if (millis() - getLastMovement() < 1000) {//moved in the last second
operatingMode = SOLDERING; //Goto active mode again
Oled_DisplayOn();
return;
}
}
if (systemSettings.sensitivity) {
if (systemSettings.sensitivity ) {
//Check if we should shutdown
if ((millis() - getLastMovement()
> (systemSettings.ShutdownTime * 60000))