mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 08:09:19 +02:00
increase uart odometer precision
This commit is contained in:
@@ -607,7 +607,7 @@ TTrain::get_state() const {
|
|||||||
static_cast<float>( mvOccupied->BrakePress ),
|
static_cast<float>( mvOccupied->BrakePress ),
|
||||||
fHVoltage,
|
fHVoltage,
|
||||||
{ fHCurrent[ ( mvControlled->TrainType & dt_EZT ) ? 0 : 1 ], fHCurrent[ 2 ], fHCurrent[ 3 ] },
|
{ fHCurrent[ ( mvControlled->TrainType & dt_EZT ) ? 0 : 1 ], fHCurrent[ 2 ], fHCurrent[ 3 ] },
|
||||||
(float)mvOccupied->DistCounter
|
mvOccupied->DistCounter
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
2
Train.h
2
Train.h
@@ -99,7 +99,7 @@ class TTrain
|
|||||||
float brake_pressure;
|
float brake_pressure;
|
||||||
float hv_voltage;
|
float hv_voltage;
|
||||||
std::array<float, 3> hv_current;
|
std::array<float, 3> hv_current;
|
||||||
float distance;
|
double distance;
|
||||||
};
|
};
|
||||||
typedef std::tuple<std::string, std::shared_ptr<python_rt>, std::unique_ptr<python_screen_viewer>> screen_entry;
|
typedef std::tuple<std::string, std::shared_ptr<python_rt>, std::unique_ptr<python_screen_viewer>> screen_entry;
|
||||||
typedef std::vector<screen_entry> screen_map;
|
typedef std::vector<screen_entry> screen_map;
|
||||||
|
|||||||
2
uart.cpp
2
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 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 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);
|
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<uint8_t, 31> buffer {
|
std::array<uint8_t, 31> buffer {
|
||||||
//byte 0-1
|
//byte 0-1
|
||||||
|
|||||||
Reference in New Issue
Block a user