From c6ee909aa47aa576ca7e8dc2865db3b5fcb257fc Mon Sep 17 00:00:00 2001 From: "Sergio R. Caprile" Date: Mon, 14 Jul 2025 15:12:50 -0300 Subject: [PATCH] uint16_t always >= 0 --- tutorials/mqtt/mqtt-dashboard/device/hal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tutorials/mqtt/mqtt-dashboard/device/hal.c b/tutorials/mqtt/mqtt-dashboard/device/hal.c index 8f50c448..4d2a9bdd 100644 --- a/tutorials/mqtt/mqtt-dashboard/device/hal.c +++ b/tutorials/mqtt/mqtt-dashboard/device/hal.c @@ -7,7 +7,7 @@ static bool s_pins[MAX_PIN_NO]; bool gpio_write(uint16_t pin, bool status) { bool ok = false; - if (pin >= 0 && pin < MAX_PIN_NO) { + if (pin < MAX_PIN_NO) { s_pins[pin] = status; ok = true; } @@ -15,5 +15,5 @@ bool gpio_write(uint16_t pin, bool status) { } bool gpio_read(uint16_t pin) { - return (pin >= 0 && pin < MAX_PIN_NO) ? s_pins[pin] : false; + return (pin < MAX_PIN_NO) ? s_pins[pin] : false; }