fix issues wifi fallback

This commit is contained in:
2023-04-16 13:36:56 +02:00
parent 0e02abd9c9
commit 1fde3347c8
8 changed files with 36 additions and 109 deletions

View File

@@ -16,7 +16,9 @@ lib_deps =
#bblanchon/ArduinoJson@^6.18.5
bblanchon/ArduinoJson@^6.20.0
fastled/FastLED@^3.5.0
robtillaart/AS5600 @ ^0.3.4
#robtillaart/AS5600 @ ^0.3.4
robtillaart/AS5600 @ ^0.3.6
monitor_speed = 115200
lib_ldf_mode = deep+
extra_scripts = ./littlefsbuilder.py
@@ -24,5 +26,5 @@ build_flags =
-DHARDWARE=2
-DCORE_DEBUG_LEVEL=3
-DNDEF_DEBUG=1
upload_protocol = espota
upload_port = muziekdoos.local
upload_protocol = esptool #espota
#upload_port = muziekdoos.local

View File

@@ -82,7 +82,7 @@ void playSong(String filename)
}
else
{
log_e("no filenae specified");
log_e("no filename specified");
}
}

View File

@@ -9,9 +9,9 @@
#include "game.h"
#define AUDIOGAIN 0.5
#define AUDIONSONGS 3
#define AUDIOREPEATS 3
#define AUDIOGAIN 0.7
//#define AUDIONSONGS 3
//#define AUDIOREPEATS 3

View File

@@ -36,6 +36,10 @@ bool OtaProcess_class::initialize(void)
m_ssid = WiFi.SSID(i);
m_psk = tmppsk;
}
else{
m_ssid = SECRET_SSID;
m_psk = SECRET_PASS;
}
log_i("[%d] %s %s (%d) [%s]", i, WiFi.SSID(i), (WiFi.encryptionType(i) == WIFI_AUTH_OPEN) ? " " : "*", WiFi.RSSI(i), (tmppsk != "")? "OK": "Not congigured");
}
}
@@ -112,7 +116,7 @@ bool OtaProcess_class::initialize(void)
.onEnd([]()
{ log_i("End"); ota.m_otaState = otaDone; })
.onProgress([](unsigned int progress, unsigned int total)
{ log_i("Progress: %u%%\r", (progress / (total / 100))); ota.m_otaState = otaBusy; })
{ log_i("Progress: %u%%\r", (progress / (total / 100))); ota.m_otaState = otaBusy; PowerKeepAlive();})
.onError([](ota_error_t error)
{
log_e("Error[%u]: ", error);
@@ -130,7 +134,7 @@ bool OtaProcess_class::initialize(void)
{
log_i("Otastate = initialize(start)");
ArduinoOTA.begin();
log_i("Ota ready, IPaddress:%s", WiFi.localIP());
log_i("Ota ready, IPaddress:%s", WiFi.localIP().toString());
m_otaState = otaInitDone;
setLedBlink(true);
}

View File

@@ -4,6 +4,7 @@ PN532_SPI pn532spi(SPI, NFC_SS, NFC_SCK, NFC_MISO, NFC_MOSI);
NfcAdapter nfc = NfcAdapter(pn532spi);
uint32_t lastRFID = 0;
uint32_t lastRFIDlog = 0;
String lastUid = "";
@@ -23,10 +24,15 @@ void initRfid()
void handleRfid()
{
uint32_t timeNow = millis();
if (lastRFID - timeNow > RFIDINTERVAL && RfidScanActive)
if (timeNow - lastRFID > RFIDINTERVAL && RfidScanActive)
{
log_i("scanning");
if (nfc.tagPresent(100))
if(timeNow - lastRFIDlog > RFIDLOGINTERVAL)
{
log_i("scanning");
lastRFIDlog = timeNow;
}
if (nfc.tagPresent(80))
{
NfcTag tag = nfc.read();
lastUid = tag.getUidString();

View File

@@ -10,6 +10,7 @@
#define NDEF_SUPPORT_MIFARE_CLASSIC
#define RFIDINTERVAL 800
#define RFIDLOGINTERVAL 5000
void initRfid(void);
void handleRfid(void);

View File

@@ -151,17 +151,16 @@ void handleHallSensor(void)
{
uint32_t timeNow = millis();
if(getAudioState())
{
//if music is playing skip batt check
return;
}
// if(!getAudioState())
// {
// }
if (timeNow - lastADS < ADSINTERVAL)
{
return;
}
lastADS = timeNow;
if (timeNow - lastADS < ADSINTERVAL)
{
return;
}
lastADS = timeNow;
int angle = as5600.getCumulativePosition();
log_v("sensor angle %d", angle);
@@ -170,7 +169,7 @@ void handleHallSensor(void)
{
if(hall_is_Idle)
{
log_i("hall state changed (&i)", angle);
log_i("hall state changed to active(%i)", angle);
}
hall_is_Idle = false;
}
@@ -178,7 +177,7 @@ void handleHallSensor(void)
{
if(!hall_is_Idle)
{
log_i("hall state changed (&i)", angle);
log_i("hall state changed to idle (%i)", angle);
}
hall_is_Idle = true;

View File

@@ -1,85 +0,0 @@
{
"cod": "200",
"message": 0,
"list": [
{
"dt": 1581498000,
"main": {
"temp": 3.23,
"feels_like": -3.63,
"temp_min": 3.23,
"temp_max": 4.62,
"pressure": 1014,
"sea_level": 1014,
"grnd_level": 1010,
"humidity": 58,
"temp_kf": -1.39
},
"weather": [
{
"id": 800,
"main": "Clear",
"description": "clear sky",
"icon": "01d"
}
],
"clouds": {
"all": 0
},
"wind": {
"speed": 6.19,
"deg": 266
},
"sys": {
"pod": "d"
},
"dt_txt": "2020-02-12 09:00:00"
},
{
"dt": 1581508800,
"main": {
"temp": 6.09,
"feels_like": -1.07,
"temp_min": 6.09,
"temp_max": 7.13,
"pressure": 1015,
"sea_level": 1015,
"grnd_level": 1011,
"humidity": 48,
"temp_kf": -1.04
},
"weather": [
{
"id": 800,
"main": "Clear",
"description": "clear sky",
"icon": "01d"
}
],
"clouds": {
"all": 9
},
"wind": {
"speed": 6.64,
"deg": 268
},
"sys": {
"pod": "d"
},
"dt_txt": "2020-02-12 12:00:00"
}
],
"city": {
"id": 2643743,
"name": "London",
"coord": {
"lat": 51.5085,
"lon": -0.1257
},
"country": "GB",
"population": 1000000,
"timezone": 0,
"sunrise": 1581492085,
"sunset": 1581527294
}
}