From cc61b8c00ce8f8d8ad3a036833e0c12a8fdab0f4 Mon Sep 17 00:00:00 2001 From: milek7 Date: Thu, 28 Sep 2017 21:42:17 +0200 Subject: [PATCH] uart changes --- uart.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/uart.cpp b/uart.cpp index d5db2953..1497998e 100644 --- a/uart.cpp +++ b/uart.cpp @@ -37,6 +37,10 @@ uart_input::uart_input() uart_input::~uart_input() { + std::array buffer = { 0 }; + sp_blocking_write(port, (void*)buffer.data(), buffer.size(), 0); + sp_drain(port); + sp_close(port); sp_free_port(port); } @@ -135,7 +139,7 @@ void uart_input::poll() { // TODO: ugly! move it into structure like input_bits - uint8_t buzzer = (uint8_t)t->get_alarm(); + uint8_t buzzer = Global::iPause ? 0 : (uint8_t)t->get_alarm(); uint8_t tacho = (uint8_t)t->get_tacho(); uint16_t tank_press = (uint16_t)std::min(conf.tankuart, t->get_tank_pressure() * 0.1f / conf.tankmax * conf.tankuart); uint16_t pipe_press = (uint16_t)std::min(conf.pipeuart, t->get_pipe_pressure() * 0.1f / conf.pipemax * conf.pipeuart);