I am a model train enthusiast.
In the following two URL's, a program called "D17" is discussed:
French: http://udelmas.e-monsite.com/pages/centrale-dcc-wifi-d17.html
English: https://forum.mrhmag.com/post/sma47-wild1-wireless-onboard-for-dc-and-dcc-locos-and-devices-from-any-browser-12570559
Wanting to create such a thing I purchased some ESP8266 D1 clones and tried uploading the 8266 specific code I had found at the second link: https://www.scalemodelanimation.com/misc/WILDMaterials.zip.
The basic INO file is too large to post, thus the quick link to the files above. (I know, I know - I see "post the code" all the time, but this example is just too large to post by about 10,000 characters, so... Follow the links above!)
I am using the "WILDMaterials/WILD_Arduino_Extras/D17_8266_754410/D17_8266_754410.ino" code for my ESP8266 device. It appears quite similar to all the other versions to my inexperienced eye. (I have also TRIED to get ESP32 versions to work, but am having issues with the littleFS loading part on an esp32 VROOM devkit device.)
When I run this code on the 8266, it's not working - and the area it's not working is around the "data" sub directory that is loaded via littleFS on the ESP8266 flash.
The device runs in Access Point mode, this works - I can join the network. But when I try to load the web page that would be the overall control for the device, it fails with "404 file not found" and on the serial console, I see similar "$FILE, no such file found" errors.
I used the littleFS upload tool per code instructions and it worked successfully to install the files:
esptool.py v3.0
Serial port /dev/cu.usbserial-110
Connecting....
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: cc:50:e3:fd:a3:b4
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 368112 bytes to 265271...
Writing at 0x00000000... (5 %)
Writing at 0x00004000... (11 %)
Writing at 0x00008000... (17 %)
Writing at 0x0000c000... (23 %)
Writing at 0x00010000... (29 %)
Writing at 0x00014000... (35 %)
Writing at 0x00018000... (41 %)
Writing at 0x0001c000... (47 %)
Writing at 0x00020000... (52 %)
Writing at 0x00024000... (58 %)
Writing at 0x00028000... (64 %)
Writing at 0x0002c000... (70 %)
Writing at 0x00030000... (76 %)
Writing at 0x00034000... (82 %)
Writing at 0x00038000... (88 %)
Writing at 0x0003c000... (94 %)
Writing at 0x00040000... (100 %)
Wrote 368112 bytes (265271 compressed) at 0x00000000 in 7.1 seconds (effective 413.1 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin...
[LittleFS] data : /Users/*****berl/Documents/Hobbies/Micro Controllers/Arduino/trains/WILDMaterials/WILD_Arduino_Extras/D17_8266_754410/data
[LittleFS] size : 2024
[LittleFS] page : 256
[LittleFS] block : 8192
/carre_rouge.png
/index.html
/admin.html
/EMD40FCL.gif
/tt.png
/carre_vert.png
/BA284.gif
/EMD40_Gray.jpg
/admin.gif
/del.html
/BA462.gif
/nyc282.gif
/NYC_GP9.gif
/EMD40_Blue.gif
/EMD40_FarmwrsCoop.gif
/debug.log
/success.html
/EMD40_Red.gif
/img_cc21000.gif
/upload.html
[LittleFS] upload : /var/folders/0b/t4jy_scn7mn5qhymsx1gbnmw0000gn/T/arduino_build_431474/D17_8266_754410.mklittlefs.bin
[LittleFS] address : 0x200000
[LittleFS] reset : --before default_reset --after hard_reset
[LittleFS] port : /dev/cu.usbserial-110
[LittleFS] speed : 921600
[LittleFS] python : /Users/*****/Library/Arduino15/packages/esp8266/tools/python3/3.7.2-post1/python3
[LittleFS] uploader : /Users/*****/Library/Arduino15/packages/esp8266/hardware/esp8266/3.1.2/tools/upload.py
esptool.py v3.0
Serial port /dev/cu.usbserial-110
Connecting........_
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: cc:50:e3:fd:a3:b4
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 2072576 bytes to 130446...
Writing at 0x00200000... (12 %)
Writing at 0x00204000... (25 %)
Writing at 0x00208000... (37 %)
Writing at 0x0020c000... (50 %)
Writing at 0x00210000... (62 %)
Writing at 0x00214000... (75 %)
Writing at 0x00218000... (87 %)
Writing at 0x0021c000... (100 %)
Wrote 2072576 bytes (130446 compressed) at 0x00200000 in 9.3 seconds (effective 1785.2 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin...
..so I believe the files are there.
The code base is a few years old now, and hasn't been upgraded much that I can see.. I see references I don't quite understand talking about the demise of SPIFFS and the general desire to use littleFS..
When I compile, I get "WARNINGS" about char* that I don't understand?
/Users/*****/Documents/Hobbies/Micro Controllers/Arduino/trains/WILDMaterials/WILD_Arduino_Extras/D17_8266_754410/D17_8266_754410.ino: In function 'void startSPIFFS()':
/Users/*****/Documents/Hobbies/Micro Controllers/Arduino/trains/WILDMaterials/WILD_Arduino_Extras/D17_8266_754410/D17_8266_754410.ino:3274:7: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
3274 | log("SPIFFS started.\n");
| ^~~~~~~~~~~~~~~~~~~
/Users/*****/Documents/Hobbies/Micro Controllers/Arduino/trains/WILDMaterials/WILD_Arduino_Extras/D17_8266_754410/D17_8266_754410.ino:3276:7: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
3276 | log("Files:\n");
| ^~~~~~~~~~
/Users/*****/Documents/Hobbies/Micro Controllers/Arduino/trains/WILDMaterials/WILD_Arduino_Extras/D17_8266_754410/D17_8266_754410.ino: In function 'void startWebSocket()':
/Users/*****/Documents/Hobbies/Micro Controllers/Arduino/trains/WILDMaterials/WILD_Arduino_Extras/D17_8266_754410/D17_8266_754410.ino:3351:7: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
3351 | log("WebSocket server started.\n");
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/*****/Documents/Hobbies/Micro Controllers/Arduino/trains/WILDMaterials/WILD_Arduino_Extras/D17_8266_754410/D17_8266_754410.ino: In function 'void handleFileUpload()':
/Users/*****/Documents/Hobbies/Micro Controllers/Arduino/trains/WILDMaterials/WILD_Arduino_Extras/D17_8266_754410/D17_8266_754410.ino:3464:9: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
3464 | log("**\n");
| ^~~~~~
. Variables and constants in RAM (global, static), used 35404 / 80192 bytes (44%)
β SEGMENT BYTES DESCRIPTION
β ββ DATA 2596 initialized variables
β ββ RODATA 3056 constants
βββ BSS 29752 zeroed variables
. Instruction RAM (IRAM_ATTR, ICACHE_RAM_ATTR), used 61411 / 65536 bytes (93%)
β SEGMENT BYTES DESCRIPTION
β ββ ICACHE 32768 reserved space for flash instruction cache
βββ IRAM 28643 code in IRAM
. Code in flash (default, ICACHE_FLASH_ATTR), used 329672 / 1048576 bytes (31%)
β SEGMENT BYTES DESCRIPTION
βββ IROM 329672 code in flash
....But it does appear to compile and upload, though I understand this is no guarantee of functionality...
Would anyone have any thoughts on how I might proceed here? I think the compile warnings and the "file not found" are related somehow?
There is this line in the code, but have no a clue in the world how to act on it?
FS* filesystem = &SPIFFS; // you can also do without it and use FS.
I'm not clear at all how to remove or rework the SPIFFS to a "FS" solution, or even if that's the root of my problem?
The "non filesystem" parts of the web stuff works, in that I can load "192.168.4.1/au1" and "au0" and the power on off link appears to work, but the admin and index links lead to "file not found:"
I feel like I am close to having this work, but I'm not experienced enough to actually make it work?
Thanks so very much for any ideas I might try to get this code functional..
Sincerely,
Eric