int32_t controller_set_text(controller_id_e_t id, uint8_t line, uint8_t col, const char* str) (found in the controller.c file on the PROS Kernel github) seems to have a major flaw that causes the clear screen and line functions to not work in certain circumstances. This is because when characters are printed on the controller screen they can differ in size & placement. The max amount of characters this function will accept is defined by:
#define CONTROLLER_MAX_COLS 19, which is NOT the max amount of space:
' ' that can fit on the screen. Please increase this number so the entire screen is cleared properly every time.
Line of code that caused the problem:
controller_set_text(CONTROLLER_MASTER,2,0,"DON'T POWER OFF");
controller_set_text(CONTROLLER_MASTER,2,9," "); delay(55); controller_set_text(CONTROLLER_MASTER,2,0," ");
After reading through the code I noticed
char* buf = (char*)malloc(CONTROLLER_MAX_COLS + 1); Why is this variable allocated on the heap and not the stack, wouldn’t a traditional stack allocation be faster?