Skip to content

Commit

Permalink
Fixed some vales not being correct
Browse files Browse the repository at this point in the history
  • Loading branch information
doudar committed Feb 25, 2024
1 parent 7befd18 commit 6a20bdd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/Custom_Characteristic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion src/HTTP_Server_Basic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <HTTPUpdate.h>
#include <LittleFS.h>
#include <ESPmDNS.h>
#include <WiFi.h>
#include <WiFiClientSecure.h>
#include <Update.h>
#include <DNSServer.h>
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 6a20bdd

Please sign in to comment.