static state_t menuProbename(button_t button) { char buffer[17]; unsigned char probeIndex = Menus.getState() - ST_PROBENAME1 + 1; if (button == BUTTON_ENTER) { loadProbeName(probeIndex); snprintf_P(buffer, sizeof(buffer), PSTR("Set probe %1d name"), probeIndex); } // note that we only load the buffer with text on the ENTER call, // after that it is OK to have garbage in it state_t retVal = menuStringEdit(button, buffer, PROBE_NAME_SIZE - 1); if (retVal == Menus.getState()) storeAndReportProbeName(probeIndex, editString); return retVal; }
static void handleCommandUrl(char *URL) { unsigned char urlLen = strlen(URL); if (strncmp_P(URL, PSTR("set?sp="), 7) == 0) { storeSetPoint(atoi(URL + 7)); storePidUnits(URL[urlLen-1]); } else if (strncmp_P(URL, PSTR("set?lb="), 7) == 0) { csvParseI(URL + 7, storeLcdParam); reportLcdParameters(); } else if (strncmp_P(URL, PSTR("set?ld="), 7) == 0) { csvParseI(URL + 7, storeLidParam); reportLidParameters(); } else if (strncmp_P(URL, PSTR("set?po="), 7) == 0) { csvParseI(URL + 7, storeProbeOffset); reportProbeOffsets(); } else if (strncmp_P(URL, PSTR("set?pid"), 7) == 0 && urlLen > 9) { float f = atof(URL + 9); storePidParam(URL[7], f); reportPidParams(); } else if (strncmp_P(URL, PSTR("set?pn"), 6) == 0 && urlLen > 8) { // Store probe name will only store it if a valid probe number is passed storeAndReportProbeName(URL[6] - '0', URL + 8); } else if (strncmp_P(URL, PSTR("set?pc"), 6) == 0 && urlLen > 8) { storeProbeCoeff(URL[6] - '0', URL + 8); } else if (strncmp_P(URL, PSTR("set?al="), 7) == 0) { csvParseI(URL + 7, storeAlarmLimits); reportAlarmLimits(); } else if (strncmp_P(URL, PSTR("set?fn="), 7) == 0) { csvParseI(URL + 7, storeFanParams); reportFanParams(); } else if (strncmp_P(URL, PSTR("set?tt="), 7) == 0) { Menus.displayToast(URL+7); } else if (strncmp_P(URL, PSTR("set?tp="), 7) == 0) { csvParseI(URL + 7, setTempParam); } else if (strncmp_P(URL, PSTR("config"), 6) == 0) { reportConfig(); } else if (strncmp_P(URL, PSTR("reboot"), 5) == 0) { reboot(); // reboot doesn't return } }