mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Fix font erroring char. Add accel lockout for autostart.
Helps for the following issues: #51 #38
This commit is contained in:
@@ -175,7 +175,6 @@ const uint8_t FONT[]={
|
||||
0x00,0xE0,0xF0,0x3B,0x1B,0x18,0x18,0x1B,0x3B,0xF0,0xE0,0x00,0x00,0x0F,0x1F,0x38,0x30,0x30,0x30,0x30,0x38,0x1F,0x0F,0x00,//D6//214
|
||||
0x00,0x00,0x10,0x30,0x60,0xC0,0xC0,0x60,0x30,0x10,0x00,0x00,0x00,0x00,0x04,0x06,0x03,0x01,0x01,0x03,0x06,0x04,0x00,0x00,//D7//215
|
||||
0x00,0xF0,0xF8,0x1C,0x0C,0x8C,0xEC,0x7C,0x18,0xFC,0xF4,0x00,0x00,0x2F,0x3F,0x18,0x3E,0x37,0x31,0x30,0x38,0x1F,0x0F,0x00,//D8//216
|
||||
0x00,0xF8,0xF8,0x04,0x06,0x03,0x03,0x06,0x04,0xF8,0xF8,0x00,0x00,0x07,0x1F,0x38,0x30,0x30,0x30,0x30,0x38,0x1F,0x07,0x00,//D8//216
|
||||
0x00,0xF8,0xF8,0x01,0x03,0x06,0x04,0x00,0x00,0xF8,0xF8,0x00,0x00,0x07,0x1F,0x38,0x30,0x30,0x30,0x30,0x38,0x1F,0x07,0x00,//D9//217
|
||||
0x00,0xF8,0xF8,0x00,0x00,0x04,0x06,0x03,0x01,0xF8,0xF8,0x00,0x00,0x07,0x1F,0x38,0x30,0x30,0x30,0x30,0x38,0x1F,0x07,0x00,//DA//218
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//DB (blank)
|
||||
|
||||
@@ -10,6 +10,8 @@ extern volatile uint32_t system_Ticks;
|
||||
void delayMs(uint32_t ticks);
|
||||
extern volatile uint32_t lastMovement;
|
||||
|
||||
extern volatile uint8_t InterruptMask;//Used to mask interrupts
|
||||
|
||||
extern volatile uint8_t rawKeys;
|
||||
inline uint32_t millis() {
|
||||
return system_Ticks;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user