diff --git a/libraries/AP_HAL_ESP32/RCOutput.cpp b/libraries/AP_HAL_ESP32/RCOutput.cpp index 016ccd5b3cace..c456b3d8edad4 100644 --- a/libraries/AP_HAL_ESP32/RCOutput.cpp +++ b/libraries/AP_HAL_ESP32/RCOutput.cpp @@ -317,7 +317,7 @@ void RCOutput::safety_update(void) bool safety_pressed = gpio_get_level((gpio_num_t)HAL_GPIO_PIN_SAFETY_IN); if (safety_pressed) { AP_BoardConfig *brdconfig = AP_BoardConfig::get_singleton(); - if (safety_press_count < 255) { + if (safety_press_count < UINT8_MAX) { safety_press_count++; } if (brdconfig && brdconfig->safety_button_handle_pressed(safety_press_count)) {