fix for LCD row tracking, fix for "phantom" keypress at powerup

This commit is contained in:
Jeff Wang 2019-04-04 03:01:21 -04:00
parent 4734fe5a0e
commit 240dd570ae
4 changed files with 7 additions and 4 deletions

View File

@ -97,6 +97,9 @@ void KeyInit(void){
last_count[i][j] = COUNT_LIM_LOW; last_count[i][j] = COUNT_LIM_LOW;
} }
} }
//no new key
NewKeyPressed = -1;
} }
static void raw_scan(void){ static void raw_scan(void){

View File

@ -224,7 +224,7 @@ short TERMIO_PutChar(unsigned char letter) {
} else { } else {
LCD_OutChar(letter); LCD_OutChar(letter);
col++; col++;
if (col > MAX_CHARS_PER_LINE) { if (col >= MAX_CHARS_PER_LINE) {
if (row == 0) { if (row == 0) {
to_row(1); to_row(1);
} else { } else {

View File

@ -101,7 +101,7 @@ short TERMIO_PutChar(unsigned char letter) {
lcd_buf[lcd_row][lcd_col] = letter; lcd_buf[lcd_row][lcd_col] = letter;
} }
lcd_col++; lcd_col++;
if (lcd_col > MAX_CHARS_PER_LINE) { if (lcd_col >= MAX_CHARS_PER_LINE) {
if (lcd_row == 0) { if (lcd_row == 0) {
to_row(1); to_row(1);
} else { } else {

View File

@ -28,7 +28,7 @@ static const char KEY_MAP[20] = {
#ifdef DESKTOP #ifdef DESKTOP
QSemaphore KeysAvailable(1); QSemaphore KeysAvailable(0);
QSemaphore LcdAvailable(1); QSemaphore LcdAvailable(1);
#endif #endif
@ -160,9 +160,9 @@ int main()
#endif #endif
latch_on(); latch_on();
Timer0Init(); // display refresh & switch read
LCD_Open(); LCD_Open();
KeyInit(); KeyInit();
Timer0Init(); // display refresh & switch read
BACKLIGHT_ON(); //turn on led backlight BACKLIGHT_ON(); //turn on led backlight
ExpBuf[0] = 0; ExpBuf[0] = 0;