16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-18 06:39:18 +02:00

(uart, commands) add possibility to set radio channel and volume via uart

This commit is contained in:
Marcin Nowak
2022-09-29 10:46:00 +02:00
committed by Milek7
parent 041ebcf0b9
commit 412800ea23
8 changed files with 65 additions and 13 deletions

View File

@@ -485,6 +485,25 @@ void uart_input::poll()
// TODO: pass correct entity id once the missing systems are in place
0 );
}
if( true == conf.radiochannelenable ) {
relay.post(
user_command::radiochannelset,
static_cast<int8_t>(buffer[12] & 0xF),
0,
GLFW_PRESS,
0
);
}
if( true == conf.radiovolumeenable ) {
int8_t requested_volume = static_cast<int8_t>((buffer[12] & 0xF0) >> 4);
relay.post(
user_command::radiovolumeset,
requested_volume == 0xF ? 1.0 : requested_volume * (1.0 / 15.0),
0,
GLFW_PRESS,
0
);
}
old_packet = buffer;
}