From a50f2f492fc04415f919bbc2aed5edfc7a2fde57 Mon Sep 17 00:00:00 2001 From: ion098 <146852218+ion098@users.noreply.github.com> Date: Thu, 27 Jun 2024 17:08:15 -0700 Subject: [PATCH] fix: :bug: Increase max text length for controller text setting --- src/devices/controller.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/devices/controller.c b/src/devices/controller.c index 2c5e9188..d0bae28a 100644 --- a/src/devices/controller.c +++ b/src/devices/controller.c @@ -19,6 +19,7 @@ #include "vdml/vdml.h" #define CONTROLLER_MAX_COLS 15 +#define CONTROLLER_MAX_CHARS 31 // From enum in misc.h #define NUM_BUTTONS 12 @@ -107,7 +108,7 @@ int32_t controller_set_text(controller_id_e_t id, uint8_t line, uint8_t col, con else col++; - char* buf = strndup(str, CONTROLLER_MAX_COLS + 1); + char* buf = strndup(str, CONTROLLER_MAX_CHARS + 1); uint32_t rtn_val = vexControllerTextSet(id, line, col, buf); free(buf); @@ -131,8 +132,8 @@ int32_t controller_print(controller_id_e_t id, uint8_t line, uint8_t col, const va_list args; va_start(args, fmt); - char* buf = (char*)malloc(CONTROLLER_MAX_COLS + 1); - vsnprintf(buf, CONTROLLER_MAX_COLS + 1, fmt, args); + char* buf = (char*)malloc(CONTROLLER_MAX_CHARS + 1); + vsnprintf(buf, CONTROLLER_MAX_CHARS + 1, fmt, args); uint32_t rtn_val = vexControllerTextSet(id, line, col, buf); free(buf);