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

Add wiper animation

This commit is contained in:
2025-03-06 22:51:24 +01:00
parent d832ce3d96
commit b5172e940b
10 changed files with 330 additions and 6 deletions

View File

@@ -609,6 +609,17 @@ struct TDEScheme
double Umax = 0.0; /*napiecie maksymalne*/
double Imax = 0.0; /*prad maksymalny*/
};
struct TWiperScheme
{
uint8_t byteSum = 0; // suma bitowa pracujacych wycieraczek
double WiperSpeed = 0.0; // predkosc wycieraczki
double interval = 0.0; // interwal pracy wycieraczki
double outBackDelay = 0.0; // czas po jakim wycieraczka zacznie wracac z konca do poczatku
};
typedef TWiperScheme TWiperSchemeTable[16];
typedef TDEScheme TDESchemeTable[33]; /*tablica rezystorow rozr.*/
struct TShuntScheme
{
@@ -1135,6 +1146,9 @@ class TMoverParameters
bool LocHandleTimeTraxx = false; /*hamulec dodatkowy typu traxx*/
double MBPM = 1.0; /*masa najwiekszego cisnienia*/
int wiperSwitchPos = 0; // pozycja przelacznika wycieraczek
double WiperAngle = {45.0}; // kat pracy wycieraczek
std::shared_ptr<TBrake> Hamulec;
std::shared_ptr<TDriverHandle> Handle;
std::shared_ptr<TDriverHandle> LocHandle;
@@ -1361,6 +1375,9 @@ class TMoverParameters
bool Flat = false;
double Vhyp = 1.0;
TDESchemeTable DElist;
TWiperSchemeTable WiperList;
int WiperListSize;
double Vadd = 1.0;
TMPTRelayTable MPTRelay;
int RelayType = 0;
@@ -2048,6 +2065,7 @@ private:
void LoadFIZ_UCList(std::string const &Input);
void LoadFIZ_DList( std::string const &Input );
void LoadFIZ_FFList( std::string const &Input );
void LoadFIZ_WiperList(std::string const &Input);
void LoadFIZ_LightsList( std::string const &Input );
void LoadFIZ_CompressorList(std::string const &Input);
void LoadFIZ_PowerParamsDecode( TPowerParameters &Powerparameters, std::string const Prefix, std::string const &Input );
@@ -2069,6 +2087,7 @@ private:
bool readPmaxList(std::string const &line);
bool readFFList( std::string const &line );
bool readWWList( std::string const &line );
bool readWiperList( std::string const &line );
bool readLightsList( std::string const &Input );
bool readCompressorList(std::string const &Input);
void BrakeValveDecode( std::string const &s ); //Q 20160719

View File

@@ -8927,7 +8927,7 @@ bool startBPT;
bool startMPT, startMPT0;
bool startRLIST, startUCLIST;
bool startDIZELMOMENTUMLIST, startDIZELV2NMAXLIST, startHYDROTCLIST, startPMAXLIST;
bool startDLIST, startFFLIST, startWWLIST;
bool startDLIST, startFFLIST, startWWLIST, startWiperList;
bool startLIGHTSLIST;
bool startCOMPRESSORLIST;
int LISTLINE;
@@ -9279,6 +9279,25 @@ bool TMoverParameters::readFFList( std::string const &line ) {
return true;
}
// parsowanie wiperList
bool TMoverParameters::readWiperList(std::string const& line)
{
cParser parser(line);
if (false == parser.getTokens(4, false))
{
WriteLog("Read WiperList: arguments missing in line " + std::to_string(LISTLINE + 1));
return false;
}
int idx = LISTLINE++;
if (idx >= sizeof(WiperList) / sizeof(TWiperScheme))
{
WriteLog("Read WiperList: number of entries exceeded capacity of the data table");
return false;
}
parser >> WiperList[idx].byteSum >> WiperList[idx].WiperSpeed >> WiperList[idx].interval >> WiperList[idx].outBackDelay;
return true;
}
// parsowanie WWList
bool TMoverParameters::readWWList( std::string const &line ) {
@@ -9462,6 +9481,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
startPMAXLIST = false;
startFFLIST = false;
startWWLIST = false;
startWiperList = false;
startLIGHTSLIST = false;
startCOMPRESSORLIST = false;
std::string file = TypeName + ".fiz";
@@ -9562,6 +9582,13 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
startFFLIST = false;
continue;
}
if (issection("endwl", inputline))
{
// skonczylismy czytac liste konfiguracji wycieraczek
startBPT = false;
startWiperList = false;
continue;
}
if( issection( "END-WWL", inputline ) ) {
startBPT = false;
startWWLIST = false;
@@ -9853,9 +9880,22 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
{
startBPT = false;
startWWLIST = true; LISTLINE = 0;
continue;
}
if (issection("WiperList:", inputline))
{
startBPT = false;
fizlines.emplace("WiperList", inputline);
startWiperList = true;
LISTLINE = 0;
LoadFIZ_WiperList(inputline);
continue;
}
if( issection( "LightsList:", inputline ) ) {
startBPT = false;
fizlines.emplace( "LightsList", inputline );
@@ -9922,6 +9962,11 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
readWWList( inputline );
continue;
}
if (true == startWiperList)
{
readWiperList(inputline);
continue;
}
if( true == startLIGHTSLIST ) {
readLightsList( inputline );
continue;
@@ -11277,6 +11322,13 @@ void TMoverParameters::LoadFIZ_FFList( std::string const &Input ) {
extract_value( RlistSize, "Size", Input, "" );
}
void TMoverParameters::LoadFIZ_WiperList(std::string const &Input)
{
extract_value(WiperListSize, "Size", Input, "");
extract_value(WiperAngle, "Angle", Input, "");
}
void TMoverParameters::LoadFIZ_LightsList( std::string const &Input ) {
extract_value( LightsPosNo, "Size", Input, "" );