MCPcopy Create free account
hub / github.com/bmorcelli/Launcher / sdPinsHandler

Function sdPinsHandler

src/webInterface.cpp:878–905  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

876}
877
878esp_err_t sdPinsHandler(httpd_req_t *req) {
879 if (!checkUserWebAuth(req)) return ESP_OK;
880 String misoStr = queryValue(req, "miso");
881 String mosiStr = queryValue(req, "mosi");
882 String sckStr = queryValue(req, "sck");
883 String csStr = queryValue(req, "cs");
884 if (misoStr.isEmpty() || mosiStr.isEmpty() || sckStr.isEmpty() || csStr.isEmpty()) return ESP_OK;
885#if defined(HEADLESS)
886 int miso = misoStr.toInt();
887 int mosi = mosiStr.toInt();
888 int sck = sckStr.toInt();
889 int cs = csStr.toInt();
890 if (miso > 44 || mosi > 44 || sck > 44 || cs > 44 || miso < 0 || mosi < 0 || sck < 0 || cs < 0) {
891 sendText(req, "text/plain", "Pins not configured.");
892 return ESP_OK;
893 }
894 _sck = sck;
895 _miso = miso;
896 _mosi = mosi;
897 _cs = cs;
898 saveIntoNVS();
899 setupSdCard();
900 sendText(req, "text/plain", "Pins configured.");
901#else
902 sendText(req, "text/plain", "Functionality exclusive for Headless environment (devices with no screen)");
903#endif
904 return ESP_OK;
905}
906
907esp_err_t wifiHandler(httpd_req_t *req) {
908 if (!checkUserWebAuth(req)) return ESP_OK;

Callers

nothing calls this directly

Calls 4

checkUserWebAuthFunction · 0.85
queryValueFunction · 0.85
sendTextFunction · 0.85
saveIntoNVSFunction · 0.85

Tested by

no test coverage detected