Removed som debugging

This commit is contained in:
Gunnar Skjold 2024-05-23 21:58:17 +02:00
parent 37a1e3b93e
commit 3b155d78b1
5 changed files with 0 additions and 33 deletions

View File

@ -108,14 +108,11 @@ bool CloudConnector::init() {
memset(clearBuffer, 0, CC_BUF_SIZE);
snprintf(clearBuffer, CC_BUF_SIZE, pub.c_str());
if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("Cloud public key:\n%s\n"), clearBuffer);
mbedtls_pk_context pk;
mbedtls_pk_init(&pk);
int error_code = 0;
if((error_code = mbedtls_pk_parse_public_key(&pk, (unsigned char*) clearBuffer, strlen((const char*) clearBuffer)+1)) == 0){
if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("RSA public key OK\n"));
rsa = mbedtls_pk_rsa(pk);
mbedtls_ctr_drbg_init(&ctr_drbg);
mbedtls_entropy_init(&entropy);
@ -383,7 +380,6 @@ void CloudConnector::update(AmsData& data, EnergyAccounting& ea) {
memset(encryptedBuffer, 0, rsa->len);
int maxlen = 100 * (rsa->len/128);
if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf("(CloudConnector) Sending %d bytes and maxlen %d\n", pos, maxlen);
udp.beginPacket(config.hostname,7443);
for(int i = 0; i < pos; i += maxlen) {
int size = min(maxlen, pos-i);

View File

@ -57,7 +57,6 @@ bool EthernetConnectionHandler::connect(NetworkConfig config, SystemConfig sys)
ethMdc = 23;
ethMdio = 18;
} else if(sys.boardType == 244) {
if (debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("LilyGO T-ETH-Lite\n"));
return false; // TODO
} else {
if (debugger->isActive(RemoteDebug::ERROR)) debugger->printf_P(PSTR("Board type %d incompatible with ETH\n"), sys.boardType);

View File

@ -11,11 +11,9 @@
bool JsonMqttHandler::publish(AmsData* update, AmsData* previousState, EnergyAccounting* ea, PriceService* ps) {
if(strlen(mqttConfig.publishTopic) == 0) {
if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("Unable to publish data, no publish topic\n"));
return false;
}
if(!mqtt.connected()) {
if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("Unable to publish data, not connected\n"));
return false;
}
@ -33,7 +31,6 @@ bool JsonMqttHandler::publish(AmsData* update, AmsData* previousState, EnergyAcc
data = *update;
}
if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("Publishing list ID %d!\n"), data.getListType());
if(data.getListType() == 1) {
ret = publishList1(&data, ea);
mqtt.loop();

View File

@ -356,12 +356,10 @@ float PriceService::getCurrencyMultiplier(const char* from, const char* to, time
float currencyMultiplier = 0;
snprintf_P(buf, BufferSize, PSTR("https://data.norges-bank.no/api/data/EXR/B.%s.NOK.SP?lastNObservations=1"), from);
if(retrieve(buf, &p)) {
if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("(PriceService) got exchange rate %.4f\n"), p.getValue());
currencyMultiplier = p.getValue();
if(strncmp(to, "NOK", 3) != 0) {
snprintf_P(buf, BufferSize, PSTR("https://data.norges-bank.no/api/data/EXR/B.%s.NOK.SP?lastNObservations=1"), to);
if(retrieve(buf, &p)) {
if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("(PriceService) got exchange rate %.4f\n"), p.getValue());
if(p.getValue() > 0.0) {
currencyMultiplier /= p.getValue();
} else {
@ -571,7 +569,6 @@ bool PriceService::load() {
return false;
}
if(!LittleFS.exists(FILE_PRICE_CONF)) {
if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("(PriceService) No price config file\n"));
return false;
}
if(debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("(PriceService) Loading price config\n"));

View File

@ -1072,15 +1072,12 @@ void AmsWebServer::translationsJson() {
lang = String(ui.language);
}
}
if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("Sending translation file for language: %s\n"), lang.c_str());
snprintf_P(buf, BufferSize, PSTR("/translations-%s.json"), lang.c_str());
if(!LittleFS.exists(buf)) {
if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("Language file %s was not found\n"), buf);
notFound();
return;
}
if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("Language file %s\n"), buf);
// server.sendHeader(HEADER_CACHE_CONTROL, CACHE_1DA);
server.sendHeader(HEADER_CACHE_CONTROL, CACHE_CONTROL_NO_CACHE);
@ -1120,7 +1117,6 @@ void AmsWebServer::cloudkeyJson() {
}
void AmsWebServer::handleSave() {
if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("Handling save method from http\n"));
if(!checkSecurity(1))
return;
@ -1759,8 +1755,6 @@ void AmsWebServer::firmwarePost() {
if(server.hasArg(F("url"))) {
String url = server.arg(F("url"));
if(!url.isEmpty() && (url.startsWith(F("http://")) || url.startsWith(F("https://")))) {
if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("Custom firmware URL was provided\n"));
upgradeFromUrl(url, "");
server.send(200, MIME_PLAIN, "OK");
return;
@ -1813,20 +1807,11 @@ HTTPUpload& AmsWebServer::uploadFile(const char* path) {
server.send_P(500, MIME_HTML, PSTR("<html><body><h1>Unable to mount LittleFS!</h1></body></html>"));
} else {
uploading = true;
if(debugger->isActive(RemoteDebug::DEBUG)) {
debugger->printf_P(PSTR("handleFileUpload file: %s\n"), path);
}
if(LittleFS.exists(path)) {
LittleFS.remove(path);
}
file = LittleFS.open(path, "w");
if(debugger->isActive(RemoteDebug::DEBUG)) {
debugger->printf_P(PSTR("handleFileUpload Open file and write: %u\n"), upload.currentSize);
}
size_t written = file.write(upload.buf, upload.currentSize);
if(debugger->isActive(RemoteDebug::DEBUG)) {
debugger->printf_P(PSTR("handleFileUpload Written: %u\n"), written);
}
}
} else if(upload.status == UPLOAD_FILE_WRITE) {
if(file) {
@ -1848,9 +1833,6 @@ HTTPUpload& AmsWebServer::uploadFile(const char* path) {
}
}
} else if(upload.status == UPLOAD_FILE_END) {
if(debugger->isActive(RemoteDebug::DEBUG)) {
debugger->printf_P(PSTR("handleFileUpload Ended\n"));
}
if(file) {
file.flush();
file.close();
@ -1877,13 +1859,9 @@ void AmsWebServer::factoryResetPost() {
if(!checkSecurity(1))
return;
if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("Performing factory reset\n"));
bool success = false;
if(server.hasArg(F("perform")) && server.arg(F("perform")) == F("true")) {
if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("Formatting LittleFS\n"));
LittleFS.format();
if(debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("Clearing configuration\n"));
config->clear();
success = true;