don't use standard sprintf/snprintf (#1174)

This commit is contained in:
Matthew Kennedy 2020-03-07 07:28:18 -08:00 committed by GitHub
parent e32be1799d
commit c1319342d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View File

@ -11,6 +11,7 @@
#include "io_pins.h"
#if EFI_PROD_CODE
#include "os_access.h"
#include "efi_gpio.h"
#include "drivers/gpio/gpio_ext.h"
@ -102,10 +103,11 @@ iomode_t getInputMode(pin_input_mode_e mode) {
}
#if HAL_USE_ICU
static char icuError[30];
void efiIcuStart(const char *msg, ICUDriver *icup, const ICUConfig *config) {
if (icup->state != ICU_STOP && icup->state != ICU_READY) {
static char icuError[30];
sprintf(icuError, "ICU already used %s", msg);
chsnprintf(icuError, sizeof(icuError), "ICU already used %s", msg);
firmwareError(CUSTOM_ERR_6679, icuError);
return;
}

View File

@ -101,16 +101,16 @@ static void reportPins(void) {
/* use autogeneraged helpers here? */
if (pin_diag == PIN_OK) {
snprintf(pin_error, sizeof(pin_error), "Ok");
chsnprintf(pin_error, sizeof(pin_error), "Ok");
} else if (pin_diag != PIN_INVALID) {
snprintf(pin_error, sizeof(pin_error), "%s%s%s%s%s",
chsnprintf(pin_error, sizeof(pin_error), "%s%s%s%s%s",
pin_diag & PIN_OPEN ? "open_load " : "",
pin_diag & PIN_SHORT_TO_GND ? "short_to_gnd " : "",
pin_diag & PIN_SHORT_TO_BAT ? "short_to_bat " : "",
pin_diag & PIN_OVERLOAD ? "overload " : "",
pin_diag & PIN_DRIVER_OVERTEMP ? "overtemp": "");
} else {
snprintf(pin_error, sizeof(pin_error), "INVALID");
chsnprintf(pin_error, sizeof(pin_error), "INVALID");
}
/* here show all pins, unused too */