ESPHome-Devices
ESPHome-Devices copied to clipboard
Scripture Of the Day Display Error
First off, I'm using the ESP32-WROOM-32D board and the same display as you had in your sample. I'm trying to use your code to create a Quote of the Day display and I keep having my device crash. I believe I have narrowed it down ScriptureOfTheDay::display_scripture(). If I take out the following code:
for (int i = 0; i < verseLineCount; i++)
{
display_->print(400, currentPosition, verse_font_, TextAlign::CENTER, scripture_[i].c_str());
currentPosition += SPACE_BETWEEN_LINES;
}
display_->print(760, currentPosition, reference_font_, TextAlign::CENTER_RIGHT, scripture_[verseLineCount].c_str());
Here is the crash dump
Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC : 0x400dcfcb PS : 0x00060230 A0 : 0x800dd00f A1 : 0x3ffb1c60
A2 : 0x00000000 A3 : 0x000000ff A4 : 0x0000bb80 A5 : 0x3ffc6f0c
A6 : 0x3f401960 A7 : 0x00000000 A8 : 0x00060023 A9 : 0x3ffb8098
A10 : 0x00000000 A11 : 0x00000000 A12 : 0x80089e3c A13 : 0x3ffb1b60
A14 : 0x00000000 A15 : 0x3ffb0060 SAR : 0x00000010 EXCCAUSE: 0x0000001c
EXCVADDR: 0x000000bc LBEG : 0x4000c28c LEND : 0x4000c296 LCOUNT : 0x00000000
ELF file SHA256: 0000000000000000
Backtrace: 0x400dcfcb:0x3ffb1c60 0x400dd00c:0x3ffb1c80 0x400d256f:0x3ffb1ca0 0x400d2596:0x3ffb1cc0 0x400d62e6:0x3ffb1ce0 0x400ddd85:0x3ffb1d00 0x400dde1f:0x3ffb1e30 0x400dcdd9:0x3ffb1e50 0x401a815b:0x3ffb1e70 0x401a7c03:0x3ffb1e90 0x400d5f33:0x3ffb1eb0 0x400d4fc1:0x3ffb1ed0 0x401a7f85:0x3ffb1f20 0x401a8061:0x3ffb1f40 0x400dac6e:0x3ffb1f60 0x400dd01a:0x3ffb1f90 0x400ec215:0x3ffb1fb0 0x40089c2a:0x3ffb1fd0
It will not crash. I have zero experience with C++ and have been trying to troubleshoot the best I can.
Also in the follow code I'm have problems with the http_request_->send();
std::vector<std::string> ScriptureOfTheDay::get_scripture()
{
http_request_->set_url(SCRIPTURE_URL);
http_request_->set_method("GET");
http_request_->send();
if (http_request_->status_has_warning())
{
// If the request failed we shutdown and try again in 15 minutes
shutdown(15 * 60);
}
const char *json = http_request_->get_string();
DynamicJsonBuffer jsonBuffer(JSON_BUFFER_SIZE);
JsonObject& scripture = jsonBuffer.parseObject(json);
http_request_->close();
std::vector<std::string> formattedScripture = split_verse_into_lines(std::string(scripture["verse"]["details"]["text"].as<char*>()));
formattedScripture.push_back(std::string(scripture["verse"]["details"]["reference"].as<char*>()));
return formattedScripture;
}
The error is below
In file included from src/main.cpp:37:0:
src/random_quote.h: In member function 'std::vector<std::__cxx11::basic_string<char> > ScriptureOfTheDay::get_scripture()':
src/random_quote.h:85:23: error: no matching function for call to 'esphome::http_request::HttpRequestComponent::send()'
http_request_->send();
^
In file included from src/esphome.h:12:0,
from src/main.cpp:3:
src/esphome/components/http_request/http_request.h:47:8: note: candidate: void esphome::http_request::HttpRequestComponent::send(const std::vector<esphome::http_request::HttpRequestResponseTrigger*>&)
void send(const std::vector<HttpRequestResponseTrigger *> &response_triggers);
^
src/esphome/components/http_request/http_request.h:47:8: note: candidate expects 1 argument, 0 provided
I have managed to update the ArduinoJson to 6.18.5. I am running ESPHome V2022.3.2. This is my first time creating an issue, sorry if it doesn't contain everything needed or if the formatting if off. Any help or pointers would be much appreciated. Thank you!
This project was done when JSON and HTTP support in ESPHome were pretty new and a lot has changed. This code has not been able to compile in a while. This project has not been as successful as planned (I am much better with the software side of things than I am with the hardware). The issue for me has been around powering it via battery. Standby power draw is higher than I hoped and the voltage regulator on the ESP has to high a drop out voltage so the device will only refresh once or twice before the voltage on the battery falls below the dropout voltage and it stops refreshing. Work around has been to keep them plugged in. I had intentions last fall to do a rebuild using a DS3231 timer to completely power off the device until it needed to refresh and to redesign how it was powered. I got the code to support the DS3231 completed but before I had a chance to do testing of the code and/or rebuild one of them I had a bunch of personal things happen (had to replace A/C, furnace, and hot water heater, got Covid for 3+ weeks, holidays, etc.) and have not had a chance to get back to this. I can probably work on getting this code to at least compile over the next week or 2.
I know how all of that goes, glad you're doing better with getting Covid. I'm very new to ESP and have been playing around somewhat successfully but I lack knowledge in C++ and hardware lol but I'm learning from all the samples I have found from the HA community. As for the battery I went with using the diymore Double Li-ion V8 Battery Shield Micro USB 5V/3A 3V/1A Power Bank Battery Charging Module (https://www.amazon.com/dp/B07SZKNST4?ref_=cm_sw_r_cp_ud_dp_GVB1JYWBZG8DFHCNV922) it uses two 18650 rechargeable batteries, they are rated at 3.7V 3200mAh but haven't really had the chance to see what the run time is as I have gotten busy with work the last few weeks. I'm definitely willing to help with testing code or help any way I can, but like I said I lack C++ skills.