Skip to content

Scripture Of the Day Display Error #34

Open
@bkabela

Description

@bkabela

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions