Remove some String usages

This commit is contained in:
fvanroie 2020-04-12 16:47:29 +02:00
parent 788107864f
commit 0445a7d045
2 changed files with 10 additions and 16 deletions

View File

@ -113,7 +113,7 @@ uint8_t current_page = 0;
/********************** /**********************
* GLOBAL FUNCTIONS * GLOBAL FUNCTIONS
**********************/ **********************/
void haspLoadPage(String pages); void haspLoadPage(const char * pages);
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
/** /**
@ -636,13 +636,6 @@ static void roller_event_handler(lv_obj_t * obj, lv_event_t event)
} }
/////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////
void haspSetNodename(String name)
{}
// String haspGetNodename()
//{
// return String(F("plate11"));
//}
String haspGetVersion() String haspGetVersion()
{ {
@ -875,7 +868,7 @@ void haspNewObject(const JsonObject & config, uint8_t & saved_page_id)
for(JsonPair keyValue : config) { for(JsonPair keyValue : config) {
v = keyValue.value().as<String>(); v = keyValue.value().as<String>();
hasp_process_obj_attribute(obj, keyValue.key().c_str(), v.c_str(), true); hasp_process_obj_attribute(obj, keyValue.key().c_str(), v.c_str(), true);
Log.trace(F(" * %s => %s"), keyValue.key().c_str(), v.c_str()); // Log.trace(F(" * %s => %s"), keyValue.key().c_str(), v.c_str());
} }
/** testing start **/ /** testing start **/
@ -895,29 +888,31 @@ void haspNewObject(const JsonObject & config, uint8_t & saved_page_id)
if(test != obj) { if(test != obj) {
Log.error(F("HASP: Objects DO NOT match!")); Log.error(F("HASP: Objects DO NOT match!"));
} else { } else {
Log.trace(F("Objects match!")); // Log.trace(F("Objects match!"));
} }
} }
void haspLoadPage(String pages) void haspLoadPage(const char * pages)
{ {
if(pages[0] == '\0') return;
if(!SPIFFS.begin()) { if(!SPIFFS.begin()) {
Log.error(F("HASP: FS not mounted. Failed to load %s"), pages.c_str()); Log.error(F("HASP: FS not mounted. Failed to load %s"), pages);
return; return;
} }
if(!SPIFFS.exists(pages)) { if(!SPIFFS.exists(pages)) {
Log.error(F("HASP: Non existing file %s"), pages.c_str()); Log.error(F("HASP: Non existing file %s"), pages);
return; return;
} }
Log.notice(F("HASP: Loading file %s"), pages.c_str()); Log.notice(F("HASP: Loading file %s"), pages);
File file = SPIFFS.open(pages, "r"); File file = SPIFFS.open(pages, "r");
dispatchJsonl(file); dispatchJsonl(file);
file.close(); file.close();
Log.notice(F("HASP: File %s loaded"), pages.c_str()); Log.notice(F("HASP: File %s loaded"), pages);
} }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -65,7 +65,6 @@ void haspLoop(void);
void haspSetPage(uint8_t id); void haspSetPage(uint8_t id);
uint8_t haspGetPage(); uint8_t haspGetPage();
void haspClearPage(uint16_t pageid); void haspClearPage(uint16_t pageid);
void haspSetNodename(String name);
String haspGetNodename(); String haspGetNodename();
String haspGetVersion(); String haspGetVersion();
void haspBackground(uint16_t pageid, uint16_t imageid); void haspBackground(uint16_t pageid, uint16_t imageid);