From 6a20bddd580f06f486acb258b8de4b73b65b6ade Mon Sep 17 00:00:00 2001 From: Anthony Doud Date: Sun, 25 Feb 2024 13:36:51 -0500 Subject: [PATCH] Fixed some vales not being correct --- src/Custom_Characteristic.cpp | 10 +++++----- src/HTTP_Server_Basic.cpp | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Custom_Characteristic.cpp b/src/Custom_Characteristic.cpp index ecf0e65b..e395c5ca 100644 --- a/src/Custom_Characteristic.cpp +++ b/src/Custom_Characteristic.cpp @@ -215,7 +215,7 @@ void ss2kCustomCharacteristicCallbacks::onWrite(BLECharacteristic *pCharacterist case BLE_inclineMultiplier: { // 0x0B logBufLength += snprintf(logBuf + logBufLength, kLogBufCapacity - logBufLength, "<-inclineMultiplier"); - int inc = userConfig->getInclineMultiplier(); + int inc = userConfig->getInclineMultiplier()*10; if (rxValue[0] == read) { returnValue[0] = success; returnValue[2] = (uint8_t)(inc & 0xff); @@ -224,14 +224,14 @@ void ss2kCustomCharacteristicCallbacks::onWrite(BLECharacteristic *pCharacterist } if (rxValue[0] == write) { returnValue[0] = success; - userConfig->setInclineMultiplier(bytes_to_u16(rxValue[3], rxValue[2])); + userConfig->setInclineMultiplier((bytes_to_u16(rxValue[3], rxValue[2]))/10.0); logBufLength += snprintf(logBuf + logBufLength, kLogBufCapacity - logBufLength, "(%f)", userConfig->getInclineMultiplier()); } } break; case BLE_powerCorrectionFactor: { // 0x0C logBufLength += snprintf(logBuf + logBufLength, kLogBufCapacity - logBufLength, "<-powerCorrectionFactor"); - int pcf = userConfig->getPowerCorrectionFactor(); + int pcf = userConfig->getPowerCorrectionFactor() * 10 ; if (rxValue[0] == read) { returnValue[0] = success; returnValue[2] = (uint8_t)(pcf & 0xff); @@ -240,7 +240,7 @@ void ss2kCustomCharacteristicCallbacks::onWrite(BLECharacteristic *pCharacterist } if (rxValue[0] == write) { returnValue[0] = success; - userConfig->setPowerCorrectionFactor(bytes_to_u16(rxValue[3], rxValue[2])); + userConfig->setPowerCorrectionFactor((bytes_to_u16(rxValue[3], rxValue[2]))/10.0); logBufLength += snprintf(logBuf + logBufLength, kLogBufCapacity - logBufLength, "(%f)", userConfig->getPowerCorrectionFactor()); } } break; @@ -501,7 +501,7 @@ void ss2kCustomCharacteristicCallbacks::onWrite(BLECharacteristic *pCharacterist } if (rxValue[0] == write) { returnValue[0] = success; - userConfig->setERGSensitivity(bytes_to_u16(rxValue[3], rxValue[2]) / 10); + userConfig->setERGSensitivity((bytes_to_u16(rxValue[3], rxValue[2])) / 10); logBufLength += snprintf(logBuf + logBufLength, kLogBufCapacity - logBufLength, "(%f)", userConfig->getERGSensitivity()); } } break; diff --git a/src/HTTP_Server_Basic.cpp b/src/HTTP_Server_Basic.cpp index 0ffbb9e4..822fc521 100644 --- a/src/HTTP_Server_Basic.cpp +++ b/src/HTTP_Server_Basic.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -122,7 +123,7 @@ void stopWifi() { void HTTP_Server::start() { server.enableCORS(true); - server.onNotFound([]() { SS2K_LOG(HTTP_SERVER_LOG_TAG, "Link Not Found: %s", server.uri().c_str()); }); + server.onNotFound(handleIndexFile); /***************************Begin Handlers*******************/ server.on("/", handleIndexFile);