diff --git a/Train.cpp b/Train.cpp index 6c4c2b00..ab2f0517 100644 --- a/Train.cpp +++ b/Train.cpp @@ -607,7 +607,7 @@ TTrain::get_state() const { static_cast( mvOccupied->BrakePress ), fHVoltage, { fHCurrent[ ( mvControlled->TrainType & dt_EZT ) ? 0 : 1 ], fHCurrent[ 2 ], fHCurrent[ 3 ] }, - (float)mvOccupied->DistCounter + mvOccupied->DistCounter }; } diff --git a/Train.h b/Train.h index 4c0cc7c2..2717be94 100644 --- a/Train.h +++ b/Train.h @@ -99,7 +99,7 @@ class TTrain float brake_pressure; float hv_voltage; std::array hv_current; - float distance; + double distance; }; typedef std::tuple, std::unique_ptr> screen_entry; typedef std::vector screen_map; diff --git a/uart.cpp b/uart.cpp index 90d8e9a8..c1b85e10 100644 --- a/uart.cpp +++ b/uart.cpp @@ -244,7 +244,7 @@ void uart_input::poll() uint16_t current1 = (uint16_t)std::min(conf.currentuart, trainstate.hv_current[0] / conf.currentmax * conf.currentuart); uint16_t current2 = (uint16_t)std::min(conf.currentuart, trainstate.hv_current[1] / conf.currentmax * conf.currentuart); uint16_t current3 = (uint16_t)std::min(conf.currentuart, trainstate.hv_current[2] / conf.currentmax * conf.currentuart); - uint32_t odometer = trainstate.distance * 1000.0f; + uint32_t odometer = trainstate.distance * 10000.0; std::array buffer { //byte 0-1