fixing I2C requests and Wifi Power Saving Modes.

This commit is contained in:
Thomas Göttgens 2022-09-19 12:05:57 +02:00
parent 2d81d359b8
commit 4c6f3ead60
2 changed files with 8 additions and 2 deletions

View File

@ -3,6 +3,7 @@
#include <Wire.h>
extern uint8_t cardkb_found;
extern uint8_t faceskb_found;
KbI2cBase::KbI2cBase(const char *name) : concurrency::OSThread(name)
{
@ -11,6 +12,10 @@ KbI2cBase::KbI2cBase(const char *name) : concurrency::OSThread(name)
int32_t KbI2cBase::runOnce()
{
if ((cardkb_found != CARDKB_ADDR) && (faceskb_found != CARDKB_ADDR)){
// Input device is not detected.
return INT32_MAX;
}
InputEvent e;
e.inputEvent = ModuleConfig_CannedMessageConfig_InputEventChar_NONE;
e.source = this->_originName;

View File

@ -10,6 +10,7 @@
#include "target_specific.h"
#include <DNSServer.h>
#include <ESPmDNS.h>
#include <esp_wifi.h>
#include <WiFi.h>
#include <WiFiUdp.h>
@ -239,7 +240,7 @@ bool initWifi(bool forceSoftAP)
DEBUG_MSG("MY IP AP ADDRESS: %s\n", WiFi.softAPIP().toString().c_str());
// This is needed to improve performance.
// esp_wifi_set_ps(WIFI_PS_NONE); // Disable radio power saving
esp_wifi_set_ps(WIFI_PS_NONE); // Disable radio power saving
dnsServer.start(53, "*", apIP);
@ -253,7 +254,7 @@ bool initWifi(bool forceSoftAP)
WiFi.onEvent(WiFiEvent);
// This is needed to improve performance.
// esp_wifi_set_ps(WIFI_PS_NONE); // Disable radio power saving
esp_wifi_set_ps(WIFI_PS_NONE); // Disable radio power saving
WiFi.onEvent(
[](WiFiEvent_t event, WiFiEventInfo_t info) {