- 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)
this->lastDisplaySecret = code;
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();
}

View file

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

View file

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

View file

@ -55,7 +55,7 @@ void OmobiLedDisplay::onDataReceived(String dataString)
{
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);
if (this->sessionAuthorized)