From 8b4e55d2ddc194f12abb07e427efe755f2f6d06d Mon Sep 17 00:00:00 2001 From: Marcel Peterkau Date: Thu, 10 Feb 2022 22:31:11 +0100 Subject: [PATCH] moved some Strings to Flash --- Software/ChainLube/src/can.cpp | 4 ++-- Software/ChainLube/src/config.cpp | 8 ++++---- Software/ChainLube/src/lubeapp.cpp | 12 ++++++------ Software/ChainLube/src/main.cpp | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Software/ChainLube/src/can.cpp b/Software/ChainLube/src/can.cpp index ba44fd1..277f6ba 100644 --- a/Software/ChainLube/src/can.cpp +++ b/Software/ChainLube/src/can.cpp @@ -6,9 +6,9 @@ void Init_CAN() { if (CAN0.begin(MCP_STDEXT, CAN_500KBPS, MCP_16MHZ) == CAN_OK) - Serial.println("MCP2515 Initialized Successfully!"); + Serial.println(PSTR("MCP2515 Initialized Successfully!")); else - Serial.println("Error Initializing MCP2515..."); + Serial.println(PSTR("Error Initializing MCP2515...")); CAN0.init_Mask(0, 0, 0x07FF0000); // Init first mask... CAN0.init_Mask(1, 0, 0x07FF0000); // Init second mask... diff --git a/Software/ChainLube/src/config.cpp b/Software/ChainLube/src/config.cpp index 67710c8..44883ba 100644 --- a/Software/ChainLube/src/config.cpp +++ b/Software/ChainLube/src/config.cpp @@ -18,7 +18,7 @@ void InitEEPROM() { ee.begin(); if (!ee.isConnected()) - Serial.println("ERROR: Can't find eeprom..."); + Serial.println(PSTR("ERROR: Can't find eeprom...")); } #endif @@ -78,7 +78,7 @@ void GetConfig_EEPROM() if (Checksum_EEPROM((uint8_t *)&LubeConfig, sizeof(LubeConfig)) != checksum) { - Serial.printf("CFG EEPROM Checksum BAD\n"); + Serial.printf(PSTR("CFG EEPROM Checksum BAD\n")); FormatConfig_EEPROM(); } LubeConfig.checksum = checksum; @@ -131,7 +131,7 @@ void GetPersistence_EEPROM() if (Checksum_EEPROM((uint8_t *)&PersistenceData, sizeof(PersistenceData)) != checksum) { - Serial.printf("Persistance EEPROM Checksum BAD\n"); + Serial.printf(PSTR("Persistance EEPROM Checksum BAD\n")); FormatPersistence_EEPROM(); } PersistenceData.checksum = checksum; @@ -191,7 +191,7 @@ void dumpEEPROM(uint16_t memoryAddress, uint16_t length) char ascii_buf[BLOCK_TO_LENGTH + 1]; sprintf(ascii_buf, "%*s", BLOCK_TO_LENGTH, "ASCII"); - Serial.print("\nAddress "); + Serial.print(PSTR("\nAddress ")); for (int x = 0; x < BLOCK_TO_LENGTH; x++) Serial.printf("%3d", x); diff --git a/Software/ChainLube/src/lubeapp.cpp b/Software/ChainLube/src/lubeapp.cpp index 3a813f4..c032867 100644 --- a/Software/ChainLube/src/lubeapp.cpp +++ b/Software/ChainLube/src/lubeapp.cpp @@ -54,22 +54,22 @@ void RunLubeApp(uint32_t add_milimeters) switch (globals.systemStatus) { case sysStat_Normal: - strcpy(globals.systemStatustxt, "Normal"); + strcpy(globals.systemStatustxt, PSTR("Normal")); break; case sysStat_Purge: - strcpy(globals.systemStatustxt, "Purge"); + strcpy(globals.systemStatustxt, PSTR("Purge")); break; case sysStat_Rain: - strcpy(globals.systemStatustxt, "Rain"); + strcpy(globals.systemStatustxt, PSTR("Rain")); break; case sysStat_Startup: - strcpy(globals.systemStatustxt, "Startup"); + strcpy(globals.systemStatustxt, PSTR("Startup")); break; case sysStat_Error: - strcpy(globals.systemStatustxt, "Error"); + strcpy(globals.systemStatustxt, PSTR("Error")); break; case sysStat_Shutdown: - strcpy(globals.systemStatustxt, "Shutdown"); + strcpy(globals.systemStatustxt, PSTR("Shutdown")); break; } diff --git a/Software/ChainLube/src/main.cpp b/Software/ChainLube/src/main.cpp index 3bc4a1b..71e7618 100644 --- a/Software/ChainLube/src/main.cpp +++ b/Software/ChainLube/src/main.cpp @@ -689,7 +689,7 @@ void toggleWiFiAP(boolean shutdown) WiFiMaintainConnectionTicker.stop(); debugV("WiFi AP started, stopped Maintain-Timer"); #else - debugV("WiFi AP started"); + debugV(PSTR("WiFi AP started")); #endif } }