<commit_before>int command_parsing(char ch, int v) {
  switch (ch) {
    case 'p':
      Serial.print("p: ");
      Serial.println(g_state.pos.l);
      PROMPT;
      break;
    case 'R':
      g_state.speed_ctrl = true;
      g_state.spwr = (v == 0 ? PWM_PWR : constrain(v, 0, PWM_PWR));
      Serial.print("c: ");
      Serial.println(g_state.speed_ctrl ? "on" : "off");
      Serial.print("w: ");
      Serial.println(g_state.spwr);
      v = 0;
      PROMPT;
      break;
    case 'r':
      g_state.speed_ctrl = false;
      Serial.print("c: ");
      Serial.println(g_state.speed_ctrl ? "on" : "off");
      PROMPT;
      break;
    case 'S':
      g_state.speed = constrain(v, 0, MAX_SPEED);
      Serial.print("s: ");
      Serial.println(g_state.speed, DEC);
      v = 0;
      PROMPT;
      break;
    case 's':
      g_state.speed = constrain(-v, -MAX_SPEED, 0);
      Serial.print("s: ");
      Serial.println(g_state.speed, DEC);
      v = 0;
      PROMPT;
      break;
    case '+':
      if (g_state.speed != 0) {
        v = v == 0 ? 1 : v;
        myStepper.setSpeed(abs(g_state.speed));
        myStepper.step(v);
      }
      else {
        myStepper.setSpeed(MAX_SPEED);
        myStepper.step(v = 1);
        myStepper.setSpeed(abs(g_state.speed));
      }
      g_state.pos.l += v;
      Serial.println(g_state.pos.l);
      v = 0;
      PROMPT;
      break;
    case '-':
      if (g_state.speed != 0) {
        v = v == 0 ? 1 : v;
        myStepper.setSpeed(abs(g_state.speed));
        myStepper.step(-v);
      }
      else {
        myStepper.setSpeed(MAX_SPEED);
        myStepper.step(v = -1);
        myStepper.setSpeed(abs(g_state.speed));
      }
      g_state.pos.l -= v;
      Serial.println(g_state.pos.l);
      v = 0;
      PROMPT;
      break;
    case 'z':
      g_state.pos.l = 0;
      v = 0;
      PROMPT;
      break;
    case 'Z':
      if (g_state.speed != 0) {
        myStepper.setSpeed(abs(g_state.speed));
        myStepper.step(-g_state.pos.l);
        g_state.pos.l = 0;
        v = 0;
      }
      PROMPT;
      break;
    case 'W':
      g_state.pwr = v;
      Serial.print("w: ");
      Serial.println(g_state.pwr, DEC);
      v = 0;
      PROMPT;
      break;
    case 'w':
      g_state.pwr = 0;
      v = 0;
      PROMPT;
      break;
    case 'i':
      EEPROM.put(g_eeprom_addr, (byte)v);
      v = 0;
      PROMPT;
      break;
    default:
      v = 0;
      PROMPT;
  }
  return v;
}
<commit_msg>In stepper_driver, added support for x (disable Serial) and X (Enable serial) commands via I2C<commit_after>int command_parsing(char ch, int v) {
  switch (ch) {
    case 'p':
      Serial.print("p: ");
      Serial.println(g_state.pos.l);
      PROMPT;
      break;
    case 'R':
      g_state.speed_ctrl = true;
      g_state.spwr = (v == 0 ? PWM_PWR : constrain(v, 0, PWM_PWR));
      Serial.print("c: ");
      Serial.println(g_state.speed_ctrl ? "on" : "off");
      Serial.print("w: ");
      Serial.println(g_state.spwr);
      v = 0;
      PROMPT;
      break;
    case 'r':
      g_state.speed_ctrl = false;
      Serial.print("c: ");
      Serial.println(g_state.speed_ctrl ? "on" : "off");
      PROMPT;
      break;
    case 'S':
      g_state.speed = constrain(v, 0, MAX_SPEED);
      Serial.print("s: ");
      Serial.println(g_state.speed, DEC);
      v = 0;
      PROMPT;
      break;
    case 's':
      g_state.speed = constrain(-v, -MAX_SPEED, 0);
      Serial.print("s: ");
      Serial.println(g_state.speed, DEC);
      v = 0;
      PROMPT;
      break;
    case '+':
      if (g_state.speed != 0) {
        v = v == 0 ? 1 : v;
        myStepper.setSpeed(abs(g_state.speed));
        myStepper.step(v);
      }
      else {
        myStepper.setSpeed(MAX_SPEED);
        myStepper.step(v = 1);
        myStepper.setSpeed(abs(g_state.speed));
      }
      g_state.pos.l += v;
      Serial.println(g_state.pos.l);
      v = 0;
      PROMPT;
      break;
    case '-':
      if (g_state.speed != 0) {
        v = v == 0 ? 1 : v;
        myStepper.setSpeed(abs(g_state.speed));
        myStepper.step(-v);
      }
      else {
        myStepper.setSpeed(MAX_SPEED);
        myStepper.step(v = -1);
        myStepper.setSpeed(abs(g_state.speed));
      }
      g_state.pos.l -= v;
      Serial.println(g_state.pos.l);
      v = 0;
      PROMPT;
      break;
    case 'z':
      g_state.pos.l = 0;
      v = 0;
      PROMPT;
      break;
    case 'Z':
      if (g_state.speed != 0) {
        myStepper.setSpeed(abs(g_state.speed));
        myStepper.step(-g_state.pos.l);
        g_state.pos.l = 0;
        v = 0;
      }
      PROMPT;
      break;
    case 'W':
      g_state.pwr = v;
      Serial.print("w: ");
      Serial.println(g_state.pwr, DEC);
      v = 0;
      PROMPT;
      break;
    case 'w':
      g_state.pwr = 0;
      v = 0;
      PROMPT;
      break;
    case 'i':
      EEPROM.put(g_eeprom_addr, (byte)v);
      v = 0;
      PROMPT;
      break;
    case 'x':
      Serial.end();
      v = 0;
    case 'X':
      Serial.begin(115200);
      v = 0;
      PROMPT;
    default:
      v = 0;
      PROMPT;
  }
  return v;
}

{'fraction_non_alphanumeric': 0.15477819034590581, 'fraction_numerical': 0.012311901504787962, 'mean_word_length': 1.665625, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5889724', 'n_tokens_mistral': 2052, 'n_tokens_neox': 1948, 'n_words': 365}