- changed pin calculation

- fixes runtime error
This commit is contained in:
Dorian Zedler 2020-10-18 19:16:27 +02:00
parent c03b6c36a0
commit d18eb3cce3
Signed by: dorian
GPG key ID: D3B255CB8BC7CD37
4 changed files with 9 additions and 12 deletions

View file

@ -40,7 +40,7 @@ void LedDisplayBackend::authenticate(QString code) {
if(code.length() == 64) if(code.length() == 64)
this->lastDisplaySecret = code; this->lastDisplaySecret = code;
else if(code.length() == 4) { else if(code.length() == 4) {
QString combinedCode = this->bleClient->getCurrentDevice()->getAddress().toUpper() + code; QString combinedCode = code;
this->lastDisplaySecret = QCryptographicHash::hash(combinedCode.toUtf8(), QCryptographicHash::Sha256).toHex(); this->lastDisplaySecret = QCryptographicHash::hash(combinedCode.toUtf8(), QCryptographicHash::Sha256).toHex();
} }

View file

@ -12,7 +12,6 @@
// function for updater task on core 0 // function for updater task on core 0
void updateDisplayGlobal(void* object); void updateDisplayGlobal(void* object);
//extern LedDisplayController *ledDisplayControllerGlobal;
class LedDisplayController class LedDisplayController
{ {
@ -20,11 +19,11 @@ public:
template<typename T_COLOR_FEATURE, typename T_METHOD> template<typename T_COLOR_FEATURE, typename T_METHOD>
explicit LedDisplayController(NeoPixelBrightnessBusGfx<T_COLOR_FEATURE, T_METHOD> *matrix ) explicit LedDisplayController(NeoPixelBrightnessBusGfx<T_COLOR_FEATURE, T_METHOD> *matrix )
{ {
this->eepromUnit = nullptr; this->eepromUnit = nullptr;
//ledDisplayControllerGlobal = this;
this->loadTextSets(); this->loadTextSets();
this->RFade = (StepsFade*log10(2))/log10(255);
this->matrix = matrix; this->matrix = matrix;
this->matrix->Begin(); this->matrix->Begin();
this->matrix->setTextWrap(false); this->matrix->setTextWrap(false);
@ -112,6 +111,9 @@ private:
uint8_t default_display_show_wait_ms; uint8_t default_display_show_wait_ms;
uint8_t display_show_wait_ms; uint8_t display_show_wait_ms;
static const uint8_t StepsFade = 50;
float RFade;
// matrix control // matrix control
//uint16_t remap(uint16_t x, uint16_t y); //uint16_t remap(uint16_t x, uint16_t y);
void disp_init(); void disp_init();

View file

@ -1,10 +1,5 @@
#include "LedDisplayController.h" #include "LedDisplayController.h"
LedDisplayController *ledDisplayControllerGlobal = nullptr;
static const uint8_t StepsFade = 50;
static const float RFade = (StepsFade*log10(2))/log10(255);
// -------------------- // --------------------
// - Public functions - // - Public functions -
// -------------------- // --------------------
@ -265,8 +260,8 @@ LedDisplayController::GetSetTextSetParameterExitCode LedDisplayController::getSe
if (set) if (set)
currentTextSet->runtime = value->toInt() * 1000; currentTextSet->runtime = value->toInt() * 1000;
else else
returnValue = String(round(currentTextSet->runtime / 1000)); returnValue = String((int)round(currentTextSet->runtime / 1000));
//Serial.printf("Runtim is: %d \n", currentTextSet->runtime); //Serial.printf("Runtime is: %d \n", currentTextSet->runtime);
break; break;
case ColorParameter: case ColorParameter:

View file

@ -55,7 +55,7 @@ void OmobiLedDisplay::onDataReceived(String dataString)
{ {
case AuthenticateCommand: case AuthenticateCommand:
{ {
String combinedCode = this->bleServer->getDeviceAddress() + String(this->properties.deviceCode); String combinedCode = String(this->properties.deviceCode); //this->bleServer->getDeviceAddress() + String(this->properties.deviceCode);
String secret = this->sha256(combinedCode); String secret = this->sha256(combinedCode);
if (this->sessionAuthorized) if (this->sessionAuthorized)