mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-18 22:39:18 +02:00
add uarttachoscale config
This commit is contained in:
8
uart.cpp
8
uart.cpp
@@ -234,7 +234,7 @@ void uart_input::poll()
|
||||
// TODO: ugly! move it into structure like input_bits
|
||||
auto const trainstate = t->get_state();
|
||||
|
||||
uint8_t tacho = Global.iPause ? 0 : trainstate.velocity;
|
||||
uint16_t tacho = Global.iPause ? 0 : (trainstate.velocity * conf.tachoscale);
|
||||
uint16_t tank_press = (uint16_t)std::min(conf.tankuart, trainstate.reservoir_pressure * 0.1f / conf.tankmax * conf.tankuart);
|
||||
uint16_t pipe_press = (uint16_t)std::min(conf.pipeuart, trainstate.pipe_pressure * 0.1f / conf.pipemax * conf.pipeuart);
|
||||
uint16_t brake_press = (uint16_t)std::min(conf.brakeuart, trainstate.brake_pressure * 0.1f / conf.brakemax * conf.brakeuart);
|
||||
@@ -244,10 +244,8 @@ void uart_input::poll()
|
||||
uint16_t current3 = (uint16_t)std::min(conf.currentuart, trainstate.hv_current[2] / conf.currentmax * conf.currentuart);
|
||||
|
||||
std::array<uint8_t, 31> buffer {
|
||||
//byte 0
|
||||
tacho,
|
||||
//byte 1
|
||||
0,
|
||||
//byte 0-1
|
||||
SPLIT_INT16(tacho),
|
||||
//byte 2
|
||||
(uint8_t)(
|
||||
trainstate.ventilator_overload << 1
|
||||
|
||||
Reference in New Issue
Block a user