Closed V1pr closed 1 year ago
Can you please create a github repo with the complete setup?
@urish sure, it's already there: https://github.com/V1pr/OpenSprinkler-Firmware-ESP32
Please keep in mind, that you'll have to modify the OpenThingsLibrary files a bit (as in readme):
OpenThings lib is not 100%, the following 2 functions must be added to Esp32LocalServer.cpp (don't forget to modify the .h as well):
void Esp32LocalClient::flush() {
client.flush();
}
void Esp32LocalClient::stop() {
client.stop();
}
Thanks, seems like there are some other issues with the OpenThingsLibrary:
opensprinkler_server.cpp:253:89: error: no matching function for call to 'OTF::Response::writeHeader(const char [14], const char [47])'
res.writeHeader(F("Cache-Control"), F("max-age=0, no-cache, no-store, must-revalidate"));
^
In file included from .pio/libdeps/esp32_sprinkler/OpenThings-Framework-Firmware-Library/OpenThingsFramework.h:5,
from OpenSprinkler.h:50,
from opensprinkler_server.cpp:24:
.pio/libdeps/esp32_sprinkler/OpenThings-Framework-Firmware-Library/Response.h:48:10: note: candidate: 'void OTF::Response::writeHeader(const __FlashStringHelper*, const __FlashStringHelper*)'
void writeHeader(const __FlashStringHelper *const name, const __FlashStringHelper *const value);
^~~~~~~~~~~
.pio/libdeps/esp32_sprinkler/OpenThings-Framework-Firmware-Library/Response.h:48:10: note: no known conversion for argument 1 from 'const char [14]' to 'const __FlashStringHelper*'
.pio/libdeps/esp32_sprinkler/OpenThings-Framework-Firmware-Library/Response.h:50:10: note: candidate: 'void OTF::Response::writeHeader(const __FlashStringHelper*, int)'
void writeHeader(const __FlashStringHelper *const name, int value);
^~~~~~~~~~~
.pio/libdeps/esp32_sprinkler/OpenThings-Framework-Firmware-Library/Response.h:50:10: note: no known conversion for argument 1 from 'const char [14]' to 'const __FlashStringHelper*'
opensprinkler_server.cpp:254:45: error: no matching function for call to 'OTF::Response::writeHeader(const char [11], const char [6])'
res.writeHeader(F("Connection"), F("close"));
^
In file included from .pio/libdeps/esp32_sprinkler/OpenThings-Framework-Firmware-Library/OpenThingsFramework.h:5,
from OpenSprinkler.h:50,
from opensprinkler_server.cpp:24:
.pio/libdeps/esp32_sprinkler/OpenThings-Framework-Firmware-Library/Response.h:48:10: note: candidate: 'void OTF::Response::writeHeader(const __FlashStringHelper*, const __FlashStringHelper*)'
void writeHeader(const __FlashStringHelper *const name, const __FlashStringHelper *const value);
^~~~~~~~~~~
.pio/libdeps/esp32_sprinkler/OpenThings-Framework-Firmware-Library/Response.h:48:10: note: no known conversion for argument 1 from 'const char [11]' to 'const __FlashStringHelper*'
.pio/libdeps/esp32_sprinkler/OpenThings-Framework-Firmware-Library/Response.h:50:10: note: candidate: 'void OTF::Response::writeHeader(const __FlashStringHelper*, int)'
void writeHeader(const __FlashStringHelper *const name, int value);
^~~~~~~~~~~
.pio/libdeps/esp32_sprinkler/OpenThings-Framework-Firmware-Library/Response.h:50:10: note: no known conversion for argument 1 from 'const char [11]' to 'const __FlashStringHelper*'
@urish unfortunatelly no, that's a result of a f*cked up commit in ESP32 arduino framework (already fixed, but pio still uses it). Fastest is a manual fix in \Users\<CURR_USER.platformio\packages\framework-arduinoespressif32\core\esp32\WString.h:
// A pure abstract class forward used as a means to proide a unique pointer type
// but really is never defined.
class __FlashStringHelper;
//#define FPSTR(pstr_pointer) (pstr_pointer)
#define FPSTR(pstr_pointer) (reinterpret_cast<const __FlashStringHelper *>(pstr_pointer))
#define F(string_literal) (FPSTR(PSTR(string_literal)))
( simply replace the F() and FPSTR() macro )
Yeah, now it compiles and I can see the error:
The reason you're getting it is because you are loading "firmware.bin", which does not contain the partition table, only the actual firmware.
You can fix it by switching to firmware_merged.bin
instead. Change line 3 of wokwi.toml to
firmware = '.pio\build\esp32_sprinkler\firmware_merged.bin'
and line 6 of diagram.json to
{ "type": "wokwi-esp32-devkit-v1", "id": "esp", "top": 0, "left": 0, "attrs": { "firmwareOffset": "0" } },
then it seems to work (or, at least, find the SPIFFS partition):
Thanks for checking! (meanwhile I've figured out, that the error above is due to the facts, that the SPIFFS is not formatted - the code seemingly stops, 'cos it's formatting the flash)
@urish I've tried the firmware_merged.bin before, but the simulator stalled at 'loading project' in VSCode. It was my bad, since I've also changed the path ot the ELF to firmware_merges.elf, which did not exists. IMHO it would be a good idea to check the existance of it upon startup ad throw an error.
(the code now failes, where it's failing on a live board)
Describe the bug A clear and concise description of what the bug is.
Same result in VSCode simulator & firmware upload to simulator. Partitions are listed ok.
To Reproduce
Relevant code snipplet:
Expected behavior Code should continue to run, as on live hw.
Environment (please complete the following information):
Additional context platformio.ini settings: