From 42afe7e7b8c1de758c6e2318fdcce1c59340d7d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?King=20K=C3=A9vin?= Date: Fri, 27 Dec 2019 12:48:40 +0100 Subject: [PATCH] application: small fixes --- application.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/application.c b/application.c index d3644db..56e4e45 100644 --- a/application.c +++ b/application.c @@ -169,6 +169,7 @@ static void cable_clear(struct cable_t* cable) for (uint8_t i = 0; i < LENGTH(cable->connectors); i++) { cable->connectors[i] = false; } + cable->load = false; cable->cables_nb = 0; for (uint8_t i = 0; i < LENGTH(cable->cables); i++) { cable->cables[i] = false; @@ -353,7 +354,7 @@ static void cable_cables(struct cable_t* cable) /** calculate number of issues for matching cables * @param[in,out] cable cable for which to find the number of issues - * @note set unconnected_nb, unspecified_nb, and cable_best based on cables + * @note resets connections and connections_nb, sets unconnected_nb, unspecified_nb, and cable_best based on cables */ static void cable_issues_nb(struct cable_t* cable) { @@ -673,7 +674,7 @@ static void command_find(void* argument) // print result to LCD if (print_lcd) { lcd_hd44780_clear_display(); - if (cable.cable_best < LENGTH(usb_cables) && cable.cable_best < LENGTH(cable.unconnected_nb) && cable.cable_best < LENGTH(cable.unconnected_nb)) { + if (cable.cable_best < LENGTH(usb_cables) && cable.cable_best < LENGTH(cable.unconnected_nb) && cable.cable_best < LENGTH(cable.unspecified_nb)) { const struct usb_cable_t* usb_cable = &usb_cables[cable.cable_best]; lcd_hd44780_write_line(false, usb_cable->name, strlen(usb_cable->name)); uint16_t issues = cable.unconnected_nb[cable.cable_best] + cable.unspecified_nb[cable.cable_best];