From bcc15559c20352c70cd5b41b4df926313e1afb26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9E=D0=BB=D0=B5=D0=B3=20=D0=91=D0=BE=D1=80=D0=BE=D0=B4?= =?UTF-8?q?=D0=B8=D0=BD?= Date: Mon, 26 Aug 2024 23:21:17 +0200 Subject: [PATCH] update --- button.c | 7 +++++++ button.h | 1 + contr.c | 15 ++++++++------- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/button.c b/button.c index 836b282..e16edf3 100644 --- a/button.c +++ b/button.c @@ -25,6 +25,13 @@ bool button_is_pressed(void) { return false; } +bool button_was_pressed(void) { + if (button.push_counter > 0) { + return true; + } + return false; +} + uint8_t button_get(void) { if (button.strokes_ended) { uint8_t counter = button.push_counter; diff --git a/button.h b/button.h index 40f97f9..abf6712 100644 --- a/button.h +++ b/button.h @@ -19,6 +19,7 @@ extern button_t button; void button_init(void); void button_reset(void); bool button_is_pressed(void); +bool button_was_pressed(void); void button_handle(void); uint8_t button_get(void); diff --git a/contr.c b/contr.c index 737864d..6ca29af 100644 --- a/contr.c +++ b/contr.c @@ -376,17 +376,18 @@ void contr_show_ptt(void) { void contr_show_button(void) { if (button_is_pressed()) { - disp_string(3, 3, "BT"); + disp_string(3, 6, "*"); } else { - disp_string(3, 3, " "); + disp_string(3, 6, " "); + } + if (button_was_pressed()) { + sprintf(contr.disp_str, "%u", button.push_counter); + disp_string(3, 7, contr.disp_str); + } else { + disp_string(3, 7, " "); } - //if (button.strokes_ended) { - sprintf(contr.disp_str, "%1u", button.push_counter); - disp_string(3, 5, contr.disp_str); - //} } - void contr_show_freq(void) { uint16_t freq = contr_get_freq(); sprintf(contr.disp_str, "%2uM", freq);