Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Increase max text length for controller text setting #683

Open
wants to merge 2 commits into
base: develop-pros-4
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/devices/controller.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "vdml/vdml.h"

#define CONTROLLER_MAX_COLS 15
#define CONTROLLER_MAX_CHARS 31
ion098 marked this conversation as resolved.
Show resolved Hide resolved

// From enum in misc.h
#define NUM_BUTTONS 12
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down