16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-09-01 06:59:18 +02:00

Add independent dynamic brake support (eg. Vectron) to UART controllers

This commit is contained in:
Ryba04
2026-08-16 21:34:22 +02:00
parent 1357afb9e1
commit 72f932e5d9
3 changed files with 18 additions and 1 deletions

View File

@@ -224,7 +224,8 @@ struct global_settings {
{"train", &uart_conf.trainenable},
{"local", &uart_conf.localenable},
{"radiovolume", &uart_conf.radiovolumeenable},
{"radiochannel", &uart_conf.radiochannelenable}
{"radiochannel", &uart_conf.radiochannelenable},
{"dynamicbrake", &uart_conf.dynamicenable},
};
#endif
#ifdef WITH_ZMQ

View File

@@ -506,6 +506,19 @@ void uart_input::poll()
0
);
}
if (true == conf.dynamicenable)
{
// dynamic brake 8 bit
double const position{(float)(buffer[13] - conf.dynamicbrakemin) / (conf.dynamicbrakemax - conf.dynamicbrakemin)};
relay.post(
user_command::dynamicbrakecontrollerset,
position,
0,
GLFW_PRESS,
0
);
}
old_packet = buffer;
}

View File

@@ -53,6 +53,8 @@ public:
float lvmax = 150.0f;
float lvuart = 65535.0f;
float tachoscale = 1.0f;
float dynamicbrakemin = 0.0f;
float dynamicbrakemax = 255.0f;
bool mainenable = true;
bool scndenable = true;
@@ -60,6 +62,7 @@ public:
bool localenable = true;
bool radiovolumeenable = false;
bool radiochannelenable = false;
bool dynamicenable = false;
bool debug = false;