diff --git a/lambda-test/alert-test.c b/lambda-test/alert-test.c index 5a91f8c..71f0964 100644 --- a/lambda-test/alert-test.c +++ b/lambda-test/alert-test.c @@ -108,15 +108,11 @@ assertTrue(OCR1A = 31); assertTrue(isAlertActive()); - cancelAlert(false); + cancelAlert(); assertTrue(beepCount == 0); assertTrue(oscCount == 0); assertTrue(bit_is_clear(TCCR1A, COM1A0)); - assertTrue(isAlertActive()); - - cancelAlert(true); - assertFalse(isAlertActive()); return true; diff --git a/lambda-test/command-test.c b/lambda-test/command-test.c index 48fac5a..c447ccc 100644 --- a/lambda-test/command-test.c +++ b/lambda-test/command-test.c @@ -60,7 +60,7 @@ } static bool testCycleDisplay(void) { - cancelAlert(true); + cancelAlert(); assertTrue(position == 0); runCommand("cm"); diff --git a/lambda-test/display-test.c b/lambda-test/display-test.c index 311cc3b..172a6f0 100644 --- a/lambda-test/display-test.c +++ b/lambda-test/display-test.c @@ -26,7 +26,7 @@ extern Measurement measMax; // = {0, 0, 2000}; static bool testCycle(void) { - cancelAlert(true); + cancelAlert(); position = displayPosCurrent; updatePending = false; diff --git a/lambda-test/rules-test.c b/lambda-test/rules-test.c index 1dcc8d8..1ef15d3 100644 --- a/lambda-test/rules-test.c +++ b/lambda-test/rules-test.c @@ -77,7 +77,7 @@ assertTrue(rules[0].fired); assertTrue(50 == airgate); - cancelAlert(false); + cancelAlert(); return true; } @@ -130,7 +130,7 @@ assertTrue(rules[1].fired); assertTrue(25 == airgate); - cancelAlert(false); + cancelAlert(); return true; } @@ -183,7 +183,7 @@ assertTrue(rules[2].fired); assertTrue(0 == airgate); - cancelAlert(false); + cancelAlert(); return true; } @@ -229,7 +229,7 @@ assertTrue(rules[3].fired); assertTrue(50 == airgate); - cancelAlert(false); + cancelAlert(); return true; } @@ -269,7 +269,7 @@ assertTrue(rules[4].fired); assertTrue(50 == airgate); - cancelAlert(false); + cancelAlert(); return true; } @@ -305,7 +305,7 @@ reason(meas); assertFalse(rules[5].fired); - cancelAlert(false); + cancelAlert(); return true; } @@ -333,7 +333,7 @@ assertTrue(heaterStateUp == getHeaterState()); assertTrue(rules[6].fired); - cancelAlert(false); + cancelAlert(); return true; } @@ -359,7 +359,7 @@ reason(meas); assertTrue(heaterStateReady == getHeaterState()); - cancelAlert(false); + cancelAlert(); return true; } @@ -376,7 +376,7 @@ reason(meas); assertTrue(heaterStateFault == getHeaterState()); - cancelAlert(false); + cancelAlert(); return true; } @@ -393,7 +393,7 @@ reason(meas); assertTrue(heaterStateFault == getHeaterState()); - cancelAlert(false); + cancelAlert(); return true; } @@ -414,7 +414,7 @@ reason(meas); assertTrue(heaterStateFault == getHeaterState()); - cancelAlert(false); + cancelAlert(); return true; } @@ -436,7 +436,7 @@ reason(meas); assertTrue(heaterStateOff == getHeaterState()); - cancelAlert(false); + cancelAlert(); return true; } @@ -458,7 +458,7 @@ reason(meas); assertTrue(heaterStateOff == getHeaterState()); - cancelAlert(false); + cancelAlert(); return true; } @@ -508,7 +508,7 @@ reason(meas); assertTrue(dir == burning); - cancelAlert(false); + cancelAlert(); return true; } @@ -552,7 +552,7 @@ reason(meas); assertTrue(dir == burning_down); - cancelAlert(false); + cancelAlert(); return true; } diff --git a/lambda/Makefile b/lambda/Makefile index 6810e1b..4dd53cb 100644 --- a/lambda/Makefile +++ b/lambda/Makefile @@ -11,7 +11,7 @@ MAIN = lambda.c # en: 0 (default), de: 1 -LANG = 1 +LANG = 0 LOCAL_SOURCE = usart.c interrupts.c adc.c sensors.c integers.c lcdroutines.c \ display.c alert.c command.c strings.c rules.c diff --git a/lambda/alert.c b/lambda/alert.c index 2b58d93..59371c1 100644 --- a/lambda/alert.c +++ b/lambda/alert.c @@ -73,14 +73,12 @@ alert(beeps, length, tone, line0, line1, keep); } -void cancelAlert(bool const all) { +void cancelAlert() { beepCount = 0; oscCount = 0; // turn beep off TCCR1A &= ~(1 << PIN_BEEPER_TOGGLE); - if (! keepActive || all) { - alertActive = false; - } + alertActive = false; } bool isAlertActive(void) { diff --git a/lambda/alert.h b/lambda/alert.h index b9cf38a..7111dea 100644 --- a/lambda/alert.h +++ b/lambda/alert.h @@ -40,10 +40,9 @@ PGM_P line0_P, PGM_P line1_P, bool keep); /** - * Stops beeping and blocking display updates. If all is true, also alerts with - * where keep was true are cancelled. + * Stops beeping and blocking display updates. */ -void cancelAlert(bool all); +void cancelAlert(void); /** * Returns true if an alert is active, false otherwise. diff --git a/lambda/display.c b/lambda/display.c index 6d1ad5f..20a2893 100644 --- a/lambda/display.c +++ b/lambda/display.c @@ -90,13 +90,12 @@ void cycleDisplay(void) { if (isAlertActive()) { // button pressed during alert - cancelAlert(false); - updatePending = true; - return; - } - position++; - if (position > displayPosTime) { - position = displayPosCurrent; + cancelAlert(); + } else { + position++; + if (position > displayPosTime) { + position = displayPosCurrent; + } } updatePending = true; beep(1, 1, 31); diff --git a/lambda/interrupts.h b/lambda/interrupts.h index c7d727e..436faa1 100644 --- a/lambda/interrupts.h +++ b/lambda/interrupts.h @@ -15,7 +15,7 @@ // timer0 clock prescaler/256 = 3.906 kHz @ 1 MHz #define TIMER0_PRESCALE (1 << CS02) // timer0 compare match about every 31.25 ms = 1000 ms >> 5 - #define TIMER0_COMP_MATCH 123 + #define TIMER0_COMP_MATCH 122 // timer1 clock prescaler/8 = 125 kHz @ 1MHz #define TIMER1_PRESCALE (1 << CS11) // timer1 compare match at 7.8 kHz generating a 3.9 kHz beep @@ -26,7 +26,7 @@ // timer0 clock prescaler/1024 = 7.812 kHz @ 8 MHz #define TIMER0_PRESCALE (1 << CS02) | (1 << CS00) // timer0 compare match about every 31.25 ms = 1000 ms >> 5 - #define TIMER0_COMP_MATCH 246 + #define TIMER0_COMP_MATCH 244 // timer1 clock prescaler/64 = 125 kHz @ 8MHz #define TIMER1_PRESCALE (1 << CS11) | (1 << CS10) // timer1 compare match at 7.8 kHz generating a 3.9 kHz beep diff --git a/lambda/pins.h b/lambda/pins.h index b6dc765..244c81d 100644 --- a/lambda/pins.h +++ b/lambda/pins.h @@ -39,11 +39,11 @@ /* Pins for the LCD */ #define LCD_PORT PORTD #define LCD_DDR DDRD -#define LCD_RS PD6 // prototype: PD6 -#define LCD_EN PD7 // prototype: PD7 +#define LCD_RS PD7 // prototype: PD6 +#define LCD_EN PD6 // prototype: PD7 #define LCD_DB4 PD5 -#define LCD_DB5 PD2 // prototype: PD2 +#define LCD_DB5 PD4 // prototype: PD2 #define LCD_DB6 PD3 -#define LCD_DB7 PD4 // prototype: PD4 +#define LCD_DB7 PD2 // prototype: PD4 #endif /* PINS_H_ */ diff --git a/lambda/sensors.h b/lambda/sensors.h index 0a4a4a3..5019ecc 100644 --- a/lambda/sensors.h +++ b/lambda/sensors.h @@ -13,7 +13,7 @@ #include -#define SHUNT_MILLIOHMS 111 +#define SHUNT_MILLIOHMS 100 /** * Oxygen sensor heater current limits at certain states in milliamps.