diff options
author | Maximilien Cuony <maximilien@theglu.org> | 2016-06-12 21:14:22 +0200 |
---|---|---|
committer | Maximilien Cuony <maximilien@theglu.org> | 2016-06-12 21:14:22 +0200 |
commit | 71964aa1b61d77c32fec47b9bbdd33a3c1916f03 (patch) | |
tree | e05f0011f62621bc5a2a62cda778021a29a66a37 /src/simulator | |
parent | b39bf5c3d10e082ba3ff6dc45e347aa324091b9f (diff) | |
download | glutte-o-matic-71964aa1b61d77c32fec47b9bbdd33a3c1916f03.tar.gz glutte-o-matic-71964aa1b61d77c32fec47b9bbdd33a3c1916f03.tar.bz2 glutte-o-matic-71964aa1b61d77c32fec47b9bbdd33a3c1916f03.zip |
Add input voltage
Diffstat (limited to 'src/simulator')
-rw-r--r-- | src/simulator/src/GPIO/analog_input.c | 7 | ||||
-rw-r--r-- | src/simulator/src/Gui/gui.c | 18 |
2 files changed, 16 insertions, 9 deletions
diff --git a/src/simulator/src/GPIO/analog_input.c b/src/simulator/src/GPIO/analog_input.c index 1031c36..a37c0d5 100644 --- a/src/simulator/src/GPIO/analog_input.c +++ b/src/simulator/src/GPIO/analog_input.c @@ -25,7 +25,7 @@ #include "GPIO/analog.h" #include <math.h> -float measured_voltage = 12.045f; +extern float gui_measured_voltage; void analog_init(void) { @@ -33,8 +33,5 @@ void analog_init(void) float analog_measure_12v(void) { - float voltage = 2.0f * measured_voltage; - voltage = roundf(voltage); - voltage = voltage / 2.0f; - return voltage; + return gui_measured_voltage; } diff --git a/src/simulator/src/Gui/gui.c b/src/simulator/src/Gui/gui.c index 00f1dc4..c6a6e7f 100644 --- a/src/simulator/src/Gui/gui.c +++ b/src/simulator/src/Gui/gui.c @@ -155,8 +155,6 @@ int gui_in_replie_n = 1; static const char *replie_status[] = {"RepliƩ", "In vent"}; int gui_in_fax_n = 1; - - int in_button = 0; int in_qrp_n = 1; int in_1750_n = 1; @@ -165,10 +163,20 @@ int in_u = 0; int in_d = 0; int in_fax_n = 1; + +/** + * FSM + **/ const char * gui_last_fsm_states[] = {"", "", "", "", "", "", "", "", "", ""}; int gui_last_fsm_states_timestamps[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +/** + * Voltage + **/ +float gui_measured_voltage = 12.0f; + + int auto_scroll_uart = 1; int auto_scroll_cw = 1; @@ -680,7 +688,7 @@ void main_gui() { } nk_end(ctx); - if (nk_begin(ctx, &layout, "Input", nk_rect(670, 50, 200, 320), NK_WINDOW_BORDER|NK_WINDOW_MOVABLE|NK_WINDOW_MINIMIZABLE|NK_WINDOW_TITLE)) { + if (nk_begin(ctx, &layout, "Input", nk_rect(670, 50, 200, 330), NK_WINDOW_BORDER|NK_WINDOW_MOVABLE|NK_WINDOW_MINIMIZABLE|NK_WINDOW_TITLE)) { nk_layout_row_dynamic(ctx, 25, 3); @@ -803,7 +811,9 @@ void main_gui() { nk_layout_row_dynamic(ctx, 18, 2); nk_label_colored(ctx, "REPLIE_n", NK_TEXT_LEFT, c); gui_in_replie_n = nk_combo(ctx, replie_status, LEN(replie_status), gui_in_replie_n, 30); - nk_label(ctx, "", NK_TEXT_LEFT); + + nk_label_colored(ctx, "Voltage", NK_TEXT_LEFT, c); + nk_property_float(ctx, "V", 0.0f, &gui_measured_voltage, 24.0f, 0.5f, 0.5f); } |