Skip to content

Commit

Permalink
more const cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
richonguzman committed Jun 6, 2024
1 parent 18de124 commit c89ca73
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 21 deletions.
8 changes: 4 additions & 4 deletions src/bme_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ namespace BME_Utils {
}
}

String generateTempString(float bmeTemp) {
const String generateTempString(const float bmeTemp) {
String strTemp;
strTemp = String((int)bmeTemp);
switch (strTemp.length()) {
Expand All @@ -131,7 +131,7 @@ namespace BME_Utils {
}
}

String generateHumString(float bmeHum) {
const String generateHumString(const float bmeHum) {
String strHum;
strHum = String((int)bmeHum);
switch (strHum.length()) {
Expand All @@ -150,7 +150,7 @@ namespace BME_Utils {
}
}

String generatePresString(float bmePress) {
const String generatePresString(const float bmePress) {
String strPress = String((int)bmePress);
String decPress = String(int((bmePress - int(bmePress)) * 10));
switch (strPress.length()) {
Expand All @@ -169,7 +169,7 @@ namespace BME_Utils {
}
}

String readDataSensor() {
const String readDataSensor() {
String wx, tempStr, humStr, presStr;
switch (wxModuleType) {
case 1: // BME280
Expand Down
12 changes: 6 additions & 6 deletions src/bme_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@

namespace BME_Utils {

void getWxModuleAddres();
void setup();
String generateTempString(float bmeTemp);
String generateHumString(float bmeHum);
String generatePresString(float bmePress);
String readDataSensor();
void getWxModuleAddres();
void setup();
const String generateTempString(const float bmeTemp);
const String generateHumString(const float bmeHum);
const String generatePresString(const float bmePress);
const String readDataSensor();

}

Expand Down
4 changes: 2 additions & 2 deletions src/lora_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ namespace LoRa_Utils {
}
}

String packetSanitization(const String& packet) {
/*String packetSanitization(const String& packet) {
String sanitizedPacket = packet;
if (packet.indexOf("\0") > 0) {
sanitizedPacket.replace("\0", "");
Expand All @@ -146,7 +146,7 @@ namespace LoRa_Utils {
sanitizedPacket.replace("\n", "");
}
return sanitizedPacket;
}
}*/

void startReceive() {
radio.startReceive();
Expand Down
2 changes: 1 addition & 1 deletion src/lora_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace LoRa_Utils {

void setup();
void sendNewPacket(const String& newPacket);
String packetSanitization(const String& packet);
//String packetSanitization(const String& packet);
String receivePacket();
void changeFreqTx();
void changeFreqRx();
Expand Down
2 changes: 1 addition & 1 deletion src/query_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ extern int freqError;

namespace QUERY_Utils {

String process(const String& query, const String& station, uint8_t queryOrigin) {
String process(const String& query, const String& station, const uint8_t queryOrigin) {
String answer;
if (query=="?APRS?" || query=="?aprs?" || query=="?Aprs?" || query=="H" || query=="h" || query=="HELP" || query=="Help" || query=="help" || query=="?") {
answer = "?APRSV ?APRSP ?APRSL ?APRSH ?WHERE callsign";
Expand Down
2 changes: 1 addition & 1 deletion src/query_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace QUERY_Utils {

String process(const String& query, const String& station, uint8_t queryOrigin);
String process(const String& query, const String& station, const uint8_t queryOrigin);

}

Expand Down
2 changes: 1 addition & 1 deletion src/syslog_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ WiFiUDP udpClient;

namespace SYSLOG_Utils {

void log(uint8_t type, const String& packet, int rssi, float snr, int freqError) {
void log(const uint8_t type, const String& packet, const int rssi, const float snr, const int freqError) {
if (Config.syslog.active && WiFi.status() == WL_CONNECTED) {
String syslogPacket = "<165>1 - ";
syslogPacket.concat(Config.callsign);
Expand Down
2 changes: 1 addition & 1 deletion src/syslog_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace SYSLOG_Utils {

void log(uint8_t type ,const String& packet, int rssi, float snr, int freqError);
void log(const uint8_t type ,const String& packet, const int rssi, const float snr, const int freqError);
void setup();

}
Expand Down
4 changes: 2 additions & 2 deletions src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ namespace Utils {
}
}

String getLocalIP() {
const String getLocalIP() {
if (!WiFiConnected) {
return "IP : 192.168.4.1";
} else if (backUpDigiMode) {
Expand Down Expand Up @@ -213,7 +213,7 @@ namespace Utils {
}
}

void typeOfPacket(const String& packet, uint8_t packetType) {
void typeOfPacket(const String& packet, const uint8_t packetType) {
String sender = packet.substring(0,packet.indexOf(">"));
switch (packetType) {
case 0: // LoRa-APRS
Expand Down
4 changes: 2 additions & 2 deletions src/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ class ReceivedPacket {
namespace Utils {

void processStatus();
String getLocalIP();
const String getLocalIP();
void setupDisplay();
void activeStations();
void checkBeaconInterval();
void checkDisplayInterval();
void validateFreqs();
void typeOfPacket(const String& packet, uint8_t packetType);
void typeOfPacket(const String& packet, const uint8_t packetType);
void print(const String& text);
void println(const String& text);
void checkRebootMode();
Expand Down

0 comments on commit c89ca73

Please sign in to comment.