Skip to content

Commit

Permalink
Add Fallback controller_clear
Browse files Browse the repository at this point in the history
  • Loading branch information
TixoRebel committed Oct 10, 2019
1 parent 59bde8f commit 4de3a0a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
3 changes: 2 additions & 1 deletion include/pros/misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,8 @@ int32_t controller_clear_line(controller_id_e_t id, uint8_t line);
* Clears all of the lines on the controller screen.
*
* \note Controller text setting is currently in beta, so continuous, fast
* updates will not work well.
* updates will not work well. On vexOS version 1.0.0 this function will block
* for 110ms.
*
* This function uses the following values of errno when an error state is
* reached:
Expand Down
3 changes: 2 additions & 1 deletion include/pros/misc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,8 @@ class Controller {
* Clears all of the lines on the controller screen.
*
* \note Controller text setting is currently in beta, so continuous, fast
* updates will not work well.
* updates will not work well. On vexOS version 1.0.0 this function will
* block for 110ms.
*
* This function uses the following values of errno when an error state is
* reached:
Expand Down
11 changes: 10 additions & 1 deletion src/devices/controller.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,16 @@ int32_t controller_clear_line(controller_id_e_t id, uint8_t line) {
}

int32_t controller_clear(controller_id_e_t id) {
return controller_print(id, 0, 0, "");
if (vexSystemVersion() > 0x01000000) {
return controller_print(id, 0, 0, "");
} else {
for (int i = 0; i < 3; i++) {
int32_t rtn = controller_clear_line(id, i);
if (rtn == PROS_ERR) return PROS_ERR;
if (i != 2) delay(55);
}
return 1;
}
}

int32_t controller_rumble(controller_id_e_t id, const char* rumble_pattern) {
Expand Down

0 comments on commit 4de3a0a

Please sign in to comment.