Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESP8266 - Issues with SPIFFS and with the strtol #6

Open
Tanathy opened this issue Oct 20, 2022 · 1 comment
Open

ESP8266 - Issues with SPIFFS and with the strtol #6

Tanathy opened this issue Oct 20, 2022 · 1 comment

Comments

@Tanathy
Copy link

Tanathy commented Oct 20, 2022

Hey there!
I just tried your code and I found few bugs.
I wouldn't recommend using SPIFFS as its deprecated already and may be removed in the later releases. Use LittleFS as the console says, too.

Changing the following lines in the code will resolve the SPIFFS issues:
#include <FS.h> to #include <LittleFS.h>
SPIFFS.begin(); to LittleFS.begin();
server.serveStatic("/", SPIFFS, "/", "no-cache"); to server.serveStatic("/", LittleFS, "/", "no-cache");.

You can use the following plugin to upload your files: https://github.com/earlephilhower/arduino-esp8266littlefs-plugin

I got an other weird error, too:

long strtol (const char *__restrict __n, char **__restrict __end_PTR, int __base); invalid conversion from 'char' to 'char**' [-fpermissive]

The issue starts on the line 151 because we are trying to pass invalid data. Changing the '\0' to NULL will resolve the problem. Here is the snippet:

        char* token = strtok((char*) &payload[2], " ");
        messageNumber = (unsigned long) strtol(token, NULL, 10);
        token = strtok(NULL, " ");
        sampleTreshold = (unsigned int) strtol(token, NULL, 10);
        token = strtok(NULL, " ");
        numberOfSamples = (unsigned int) strtol(token, NULL, 10);

Welcome!

@hamid-ship-it
Copy link

hi i had the same error, i did your instruction and now I have a new error

EspScopeA0-Delta.ino:126:55: warning: multi-character character constant [-Wmultichar] 126 | messageNumber = (unsigned long) strtol(token, 'NULL', 10); | ^~~~~~ C:\Users\mhami\Dropbox\My PC (DESKTOP-G99GV2D)\Desktop\NOT OK\EspScopeA0-Delta\EspScopeA0-Delta.ino:127:24: warning: multi-character character constant [-Wmultichar] 127 | token = strtok('NULL', " "); | ^~~~~~ C:\Users\mhami\Dropbox\My PC (DESKTOP-G99GV2D)\Desktop\NOT OK\EspScopeA0-Delta\EspScopeA0-Delta.ino:128:55: warning: multi-character character constant [-Wmultichar] 128 | sampleTreshold = (unsigned int) strtol(token, 'NULL', 10); | ^~~~~~ C:\Users\mhami\Dropbox\My PC (DESKTOP-G99GV2D)\Desktop\NOT OK\EspScopeA0-Delta\EspScopeA0-Delta.ino:129:24: warning: multi-character character constant [-Wmultichar] 129 | token = strtok('NULL', " ");

can you help? thnk you in advanced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants