UI: Adapt updateFSM() to new keyboard message format

This commit is contained in:
Federico Amedeo Izzo 2020-12-14 15:41:37 +01:00 committed by Federico Amedeo Izzo
parent 970f3553c4
commit b7d3e0b91d
1 changed files with 8 additions and 7 deletions

View File

@ -382,37 +382,38 @@ void ui_updateFSM(event_t event)
// Process pressed keys // Process pressed keys
if(event.type == EVENT_KBD) if(event.type == EVENT_KBD)
{ {
keyboard_t keys = event.payload; kbd_msg_t msg;
msg.value = event.payload;
switch(state.ui_screen) switch(state.ui_screen)
{ {
// VFO screen // VFO screen
case MAIN_VFO: case MAIN_VFO:
// Temporary VFO controls // Temporary VFO controls
if(keys & KEY_UP) if(msg.keys & KEY_UP)
{ {
// Advance TX and RX frequency of 12.5KHz // Advance TX and RX frequency of 12.5KHz
state.channel.rx_frequency += 12500; state.channel.rx_frequency += 12500;
state.channel.tx_frequency += 12500; state.channel.tx_frequency += 12500;
} }
else if(keys & KEY_DOWN) else if(msg.keys & KEY_DOWN)
{ {
// Advance TX and RX frequency of 12.5KHz // Advance TX and RX frequency of 12.5KHz
state.channel.rx_frequency -= 12500; state.channel.rx_frequency -= 12500;
state.channel.tx_frequency -= 12500; state.channel.tx_frequency -= 12500;
} }
else if(keys & KEY_ENTER) else if(msg.keys & KEY_ENTER)
// Open Menu // Open Menu
state.ui_screen = MENU_TOP; state.ui_screen = MENU_TOP;
break; break;
// Top menu screen // Top menu screen
case MENU_TOP: case MENU_TOP:
if(keys & KEY_UP) if(msg.keys & KEY_UP)
{ {
} }
else if(keys & KEY_DOWN) else if(msg.keys & KEY_DOWN)
{ {
} }
else if(keys & KEY_ESC) else if(msg.keys & KEY_ESC)
// Close Menu // Close Menu
state.ui_screen = MAIN_VFO; state.ui_screen = MAIN_VFO;
break; break;