mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 19:49:19 +02:00
add uarttachoscale config
This commit is contained in:
@@ -686,6 +686,10 @@ global_settings::ConfigParse(cParser &Parser) {
|
|||||||
>> uart_conf.currentmax
|
>> uart_conf.currentmax
|
||||||
>> uart_conf.currentuart;
|
>> uart_conf.currentuart;
|
||||||
}
|
}
|
||||||
|
else if ( token == "uarttachoscale" ) {
|
||||||
|
Parser.getTokens( 1 );
|
||||||
|
Parser >> uart_conf.tachoscale;
|
||||||
|
}
|
||||||
else if( token == "uartfeature" ) {
|
else if( token == "uartfeature" ) {
|
||||||
Parser.getTokens( 4 );
|
Parser.getTokens( 4 );
|
||||||
Parser
|
Parser
|
||||||
|
|||||||
8
uart.cpp
8
uart.cpp
@@ -234,7 +234,7 @@ void uart_input::poll()
|
|||||||
// TODO: ugly! move it into structure like input_bits
|
// TODO: ugly! move it into structure like input_bits
|
||||||
auto const trainstate = t->get_state();
|
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 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 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);
|
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);
|
uint16_t current3 = (uint16_t)std::min(conf.currentuart, trainstate.hv_current[2] / conf.currentmax * conf.currentuart);
|
||||||
|
|
||||||
std::array<uint8_t, 31> buffer {
|
std::array<uint8_t, 31> buffer {
|
||||||
//byte 0
|
//byte 0-1
|
||||||
tacho,
|
SPLIT_INT16(tacho),
|
||||||
//byte 1
|
|
||||||
0,
|
|
||||||
//byte 2
|
//byte 2
|
||||||
(uint8_t)(
|
(uint8_t)(
|
||||||
trainstate.ventilator_overload << 1
|
trainstate.ventilator_overload << 1
|
||||||
|
|||||||
1
uart.h
1
uart.h
@@ -27,6 +27,7 @@ public:
|
|||||||
float hvuart = 65535.0f;
|
float hvuart = 65535.0f;
|
||||||
float currentmax = 10000.0f;
|
float currentmax = 10000.0f;
|
||||||
float currentuart = 65535.0f;
|
float currentuart = 65535.0f;
|
||||||
|
float tachoscale = 1.0f;
|
||||||
|
|
||||||
bool mainenable = true;
|
bool mainenable = true;
|
||||||
bool scndenable = true;
|
bool scndenable = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user