Skip to content

Commit

Permalink
Display Vset when required by train interface
Browse files Browse the repository at this point in the history
  • Loading branch information
cesarBLG committed Dec 5, 2024
1 parent e54de35 commit c25e34c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DMI/monitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ float Vsbi;
float Vebi;
float Vrelease;
float Vest;
float Vset;
float Vset=-1;
float Dtarg;
float TTI = 20;
float TTP = 20;
Expand Down
2 changes: 1 addition & 1 deletion DMI/speed/gauge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ void drawImperialIndicator()
}
void drawSetSpeed()
{
if (Vset == 0) return;
if (Vset < 0) return;
float an = speedToAngle(useImperialSystem ? Vset * KMH_TO_MPH : Vset);

platform->set_color(White);
Expand Down
3 changes: 2 additions & 1 deletion EVC/DMI/dmi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ void start_dmi()
platform->delay(100).then(dmi_update_func).detach();
}
extern double V_set;
extern int V_set_display;
extern double TTI;
extern double TTP;
extern bool EB_command;
Expand Down Expand Up @@ -447,7 +448,7 @@ void dmi_update_func()
j2["Status"] = j;
j2["ActiveWindow"] = active_window_dmi;
send_command("json", j2.dump());
send_command("setVset", to_string(V_set * 3.6));
send_command("setVset", to_string(((V_set > 0 && V_set_display == -1) || V_set_display == 1) ? V_set * 3.6 : -1));
/*
send_command("setGeoPosition", valid_geo_reference ? to_string(valid_geo_reference->get_position(d_estfront)) : "-1");
auto m = mode;
Expand Down
10 changes: 10 additions & 0 deletions EVC/OR_interface/interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
using std::string;
extern double V_est;
double V_set;
int V_set_display = -1;
extern int data_entry_type;
extern int data_entry_type_tiu;
extern bool bot_driver;
Expand Down Expand Up @@ -194,6 +195,14 @@ void SetParameters()
};
manager.AddParameter(p);

p = new ORserver::Parameter("etcs::set_speed_display");
p->SetValue = [](string val) {
if (val == "1" || val == "true") V_set_display = 1;
else if (val != "") V_set_display = 0;
else V_set_display = -1;
};
manager.AddParameter(p);

p = new ORserver::Parameter("cruise_speed");
p->SetValue = [](string val) {
V_set = stod(val)/3.6;
Expand Down Expand Up @@ -434,6 +443,7 @@ void start_or_iface()
register_parameter("etcs::data_entry_type");
register_parameter("etcs::telegram");
register_parameter("cruise_speed");
register_parameter("etcs::set_speed_display");
register_parameter("etcs::dmi::feedback");
register_parameter("master_key");
register_parameter("controller::direction");
Expand Down

0 comments on commit c25e34c

Please sign in to comment.