void execute_buffer() { while (g_cmd_length) { // find a line break character size_t i = 0u; uint32_t quotes = 0; for (i = 0u; i < g_cmd_length; ++i) { if (g_cmd_buffer[i] == '"') { ++quotes; } if (g_cmd_buffer[i] == '\n' || g_cmd_buffer[i] == '\r') { break; } } g_cmd_buffer[i] = '\0'; std::string cmd_text(g_cmd_buffer); //shift everything down the buffer as commands may add new text to the //buffer. if (g_cmd_length == i) { //nothing left to move, just reset the size g_cmd_length = 0; } else { ++i; g_cmd_length -= i; std::memmove(g_cmd_buffer, g_cmd_buffer + i, g_cmd_length); } //now execute cmd::execute(cmd_text); } }
void GDClass::self_calibrate(void) { cmd_dlstart(); Clear(); cmd_text(240, 100, 30, OPT_CENTERX, "please tap on the dot"); cmd_calibrate(); finish(); cmd_loadidentity(); cmd_dlstart(); GDTR.flush(); }