Compare commits
19 Commits
1fde3347c8
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 1d7b8fb492 | |||
| 3a88dcfc07 | |||
| 89af60bd22 | |||
| f17f9ddf7c | |||
| 6d9b3fadd0 | |||
| 966868b531 | |||
| 715359f89e | |||
| da809f1ae4 | |||
| d353bc4f38 | |||
| 30db59d4a8 | |||
| 16995b67ef | |||
| 8b4c00bc7f | |||
| 02a4ff420d | |||
| f45809690e | |||
| 6dca8972e3 | |||
| 3af2487843 | |||
| 8ad62b3fc1 | |||
| c075d1a812 | |||
| c6e9e8b0ba |
26
.gitmodules
vendored
26
.gitmodules
vendored
@@ -1,33 +1,31 @@
|
|||||||
[submodule "FW/leo_muziekdoos_esp32/lib/ESP8266Audio"]
|
[submodule "FW/leo_muziekdoos_esp32/lib/ESP8266Audio"]
|
||||||
path = FW/leo_muziekdoos_esp32/lib/ESP8266Audio
|
path = FW/leo_muziekdoos_esp32/lib/ESP8266Audio
|
||||||
url = http://debianvm.local:3000/libs/ESP8266Audio.git
|
url = http://git.oldemans.nl/libs/ESP8266Audio.git
|
||||||
branch = master
|
branch = master
|
||||||
[submodule "FW/leo_muziekdoos_esp32/lib/littleFS_esp32"]
|
|
||||||
path = FW/leo_muziekdoos_esp32/lib/littleFS_esp32
|
|
||||||
url = http://debianvm.local:3000/libs/LittleFS_esp32
|
|
||||||
[submodule "FW/leo_muziekdoos_esp32/lib/JCButton"]
|
[submodule "FW/leo_muziekdoos_esp32/lib/JCButton"]
|
||||||
path = FW/leo_muziekdoos_esp32/lib/JCButton
|
path = FW/leo_muziekdoos_esp32/lib/JCButton
|
||||||
url = http://debianvm.local:3000/libs/JCButton.git
|
url = http://git.oldemans.nl/libs/JCButton.git
|
||||||
branch = master
|
branch = master
|
||||||
[submodule "FW/leo_muziekdoos_esp32/lib/NDEF"]
|
[submodule "FW/leo_muziekdoos_esp32/lib/NDEF"]
|
||||||
path = FW/leo_muziekdoos_esp32/lib/NDEF
|
path = FW/leo_muziekdoos_esp32/lib/NDEF
|
||||||
url = http://debianvm.local:3000/libs/rfid.NDEF.git
|
url = http://git.oldemans.nl/libs/rfid.NDEF.git
|
||||||
|
branch = master
|
||||||
[submodule "FW/leo_muziekdoos_esp32/lib/PN532"]
|
[submodule "FW/leo_muziekdoos_esp32/lib/PN532"]
|
||||||
path = FW/leo_muziekdoos_esp32/lib/PN532
|
path = FW/leo_muziekdoos_esp32/lib/PN532
|
||||||
url = http://debianvm.local:3000/libs/rfid.PN532.git
|
url = http://git.oldemans.nl/libs/rfid.PN532.git
|
||||||
branch = master
|
branch = master
|
||||||
[submodule "FW/leo_muziekdoos_esp32/lib/PN532_SPI"]
|
[submodule "FW/leo_muziekdoos_esp32/lib/PN532_SPI"]
|
||||||
path = FW/leo_muziekdoos_esp32/lib/PN532_SPI
|
path = FW/leo_muziekdoos_esp32/lib/PN532_SPI
|
||||||
url = http://debianvm.local:3000/libs/rfid.PN532_SPI.git
|
url = http://git.oldemans.nl/libs/rfid.PN532_SPI.git
|
||||||
[submodule "FW/leo_muziekdoos_esp32/lib/BatterySense"]
|
[submodule "FW/leo_muziekdoos_esp32/lib/BatterySense"]
|
||||||
path = FW/leo_muziekdoos_esp32/lib/BatterySense
|
path = FW/leo_muziekdoos_esp32/lib/BatterySense
|
||||||
url = http://debianvm.local:3000/libs/BatterySense.git
|
url = http://git.oldemans.nl/libs/BatterySense.git
|
||||||
branch = master
|
|
||||||
[submodule "CAD"]
|
|
||||||
path = CAD
|
|
||||||
url = http://debianvm.local:3000/projects_leo/muziekdooos_hardware.git
|
|
||||||
branch = master
|
branch = master
|
||||||
[submodule "FW/leo_muziekdoos_esp32/lib/ADC_ADS1x15"]
|
[submodule "FW/leo_muziekdoos_esp32/lib/ADC_ADS1x15"]
|
||||||
path = FW/leo_muziekdoos_esp32/lib/ADC_ADS1x15
|
path = FW/leo_muziekdoos_esp32/lib/ADC_ADS1x15
|
||||||
url = http://debianvm.local:3000/libs/ADC_ADS1X15.git
|
url = http://git.oldemans.nl/libs/ADC_ADS1X15.git
|
||||||
|
branch = master
|
||||||
|
[submodule "CAD-SCH"]
|
||||||
|
path = CADSCH
|
||||||
|
url = http://git.oldemans.nl/projects_leo/muziekdooos_hardware.git
|
||||||
branch = master
|
branch = master
|
||||||
|
|||||||
@@ -1,16 +1,17 @@
|
|||||||
{
|
{
|
||||||
"tags": [{
|
"tags": [
|
||||||
"TagUID" : "B3 26 D0 15",
|
{
|
||||||
"audiofile" : "/Billy-Jean.mp3"
|
"TagUID" : "B3 26 D0 15",
|
||||||
},
|
"audiofile" : "/Billy-Jean.mp3"
|
||||||
{
|
},
|
||||||
"TagUID" : "1F E8 20 00",
|
{
|
||||||
"audiofile" : "/Let_it_be.mp3"
|
"TagUID" : "1F E8 20 00",
|
||||||
},
|
"audiofile" : "/Let_it_be.mp3"
|
||||||
{
|
},
|
||||||
"TagUID" : "23 0E 2C 19",
|
{
|
||||||
"audiofile" : "/ringoffire.mp3"
|
"TagUID" : "23 0E 2C 19",
|
||||||
}],
|
"audiofile" : "/ringoffire.mp3"
|
||||||
|
}],
|
||||||
"WiFi": [
|
"WiFi": [
|
||||||
{
|
{
|
||||||
"ssid": "poes",
|
"ssid": "poes",
|
||||||
@@ -19,6 +20,13 @@
|
|||||||
{
|
{
|
||||||
"ssid": "wifi2",
|
"ssid": "wifi2",
|
||||||
"psk": "pass2"
|
"psk": "pass2"
|
||||||
}
|
}],
|
||||||
]
|
|
||||||
|
"AudioGain": 0.5,
|
||||||
|
"ScanTimeout": 50,
|
||||||
|
"HardwareVersion": 2,
|
||||||
|
"GameTimeout": 20000,
|
||||||
|
"PowerTimeout": 30,
|
||||||
|
"PowerOTADelay": 4000,
|
||||||
|
"Brightness": 2
|
||||||
}
|
}
|
||||||
Submodule FW/leo_muziekdoos_esp32/lib/BatterySense updated: 4260fdf0bb...bc76604d68
Submodule FW/leo_muziekdoos_esp32/lib/ESP8266Audio updated: adbed6b207...818dfd5cb7
Submodule FW/leo_muziekdoos_esp32/lib/littleFS_esp32 deleted from c28cf47f61
@@ -8,23 +8,32 @@
|
|||||||
; Please visit documentation for the other options and examples
|
; Please visit documentation for the other options and examples
|
||||||
; https://docs.platformio.org/page/projectconf.html
|
; https://docs.platformio.org/page/projectconf.html
|
||||||
|
|
||||||
|
[env]
|
||||||
|
build_src_filter = +<*> -<.git/> -<.svn/> -<example/> -<examples/> -<test/> -<tests/>
|
||||||
|
|
||||||
|
|
||||||
[env:esp32-pico]
|
[env:esp32-pico]
|
||||||
platform = espressif32
|
platform = espressif32
|
||||||
board = m5stack-atom
|
#board = m5stack-atom
|
||||||
|
board = pico32
|
||||||
framework = arduino
|
framework = arduino
|
||||||
lib_deps =
|
lib_deps =
|
||||||
#bblanchon/ArduinoJson@^6.18.5
|
|
||||||
bblanchon/ArduinoJson@^6.20.0
|
bblanchon/ArduinoJson@^6.20.0
|
||||||
fastled/FastLED@^3.5.0
|
fastled/FastLED@^3.5.0
|
||||||
#robtillaart/AS5600 @ ^0.3.4
|
#robtillaart/AS5600 @ ^0.3.4
|
||||||
robtillaart/AS5600 @ ^0.3.6
|
robtillaart/AS5600 @ ^0.3.6
|
||||||
|
LITTLEFS
|
||||||
monitor_speed = 115200
|
build_src_filter = ${env.build_src_filter}
|
||||||
lib_ldf_mode = deep+
|
lib_ldf_mode = deep+
|
||||||
extra_scripts = ./littlefsbuilder.py
|
|
||||||
build_flags =
|
build_flags =
|
||||||
-DHARDWARE=2
|
-DHARDWARE=2
|
||||||
-DCORE_DEBUG_LEVEL=3
|
-DCORE_DEBUG_LEVEL=3
|
||||||
-DNDEF_DEBUG=1
|
-DNDEF_DEBUG=1
|
||||||
upload_protocol = esptool #espota
|
-fexceptions
|
||||||
#upload_port = muziekdoos.local
|
extra_scripts = ./littlefsbuilder.py
|
||||||
|
board_build.filesystem = littlefs
|
||||||
|
|
||||||
|
monitor_speed = 115200
|
||||||
|
#upload_protocol = esptool
|
||||||
|
upload_protocol = espota
|
||||||
|
upload_port = muziekdoos.local
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ String nextAudioFile = "";
|
|||||||
uint8_t n = 0;
|
uint8_t n = 0;
|
||||||
|
|
||||||
bool audioState = false;
|
bool audioState = false;
|
||||||
|
|
||||||
bool audioInitOk = false;
|
bool audioInitOk = false;
|
||||||
|
|
||||||
const char *waveFile[] =
|
const char *waveFile[] =
|
||||||
@@ -93,7 +92,7 @@ void initAudio()
|
|||||||
delay(500);
|
delay(500);
|
||||||
out = new AudioOutputI2S();
|
out = new AudioOutputI2S();
|
||||||
out->SetPinout(I2S_BCLK, I2S_WCLK, I2S_DATA); // bclk, wclk, data
|
out->SetPinout(I2S_BCLK, I2S_WCLK, I2S_DATA); // bclk, wclk, data
|
||||||
out->SetGain(AUDIOGAIN);
|
out->SetGain(getFloatParam("AudioGain", AUDIOGAIN));
|
||||||
pinMode(DAC_SDMODE, OUTPUT);
|
pinMode(DAC_SDMODE, OUTPUT);
|
||||||
setAudioState(false);
|
setAudioState(false);
|
||||||
mp3 = new AudioGeneratorMP3();
|
mp3 = new AudioGeneratorMP3();
|
||||||
|
|||||||
@@ -8,12 +8,9 @@
|
|||||||
#include "AudioOutputI2S.h"
|
#include "AudioOutputI2S.h"
|
||||||
|
|
||||||
#include "game.h"
|
#include "game.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
#define AUDIOGAIN 0.7
|
#define AUDIOGAIN 0.5
|
||||||
//#define AUDIONSONGS 3
|
|
||||||
//#define AUDIOREPEATS 3
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void initAudio(void);
|
void initAudio(void);
|
||||||
void handleAudio(void);
|
void handleAudio(void);
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "FS.h"
|
#include "FS.h"
|
||||||
#include "LITTLEFS.h"
|
#include <LittleFS.h>
|
||||||
#include "ArduinoJson.h"
|
#include "ArduinoJson.h"
|
||||||
|
|
||||||
const char *tagConfigfile = "/settings.json";
|
const char *tagConfigfile = "/settings.json";
|
||||||
DynamicJsonDocument settingsDoc(512);
|
DynamicJsonDocument settingsDoc(1024);
|
||||||
|
|
||||||
bool configInitOK = false;
|
bool configInitOK = false;
|
||||||
struct tagConfig
|
struct tagConfig
|
||||||
@@ -48,10 +48,45 @@ String GetWifiPassword(String ssid)
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int GetIntparam(String param, int def)
|
||||||
|
{
|
||||||
|
|
||||||
|
log_i("Get param %s",param );
|
||||||
|
if(param == "")
|
||||||
|
{
|
||||||
|
log_e("No param(%s) given", param);
|
||||||
|
return def;
|
||||||
|
}
|
||||||
|
if(!settingsDoc.containsKey(param))
|
||||||
|
{
|
||||||
|
log_e("param(%s) not found",param);
|
||||||
|
return def;
|
||||||
|
}
|
||||||
|
return settingsDoc[param];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
float getFloatParam(String param, int def)
|
||||||
|
{
|
||||||
|
log_i("Get param %s",param );
|
||||||
|
if( param == "")
|
||||||
|
{
|
||||||
|
log_e("No param(%s) given",param);
|
||||||
|
return def;
|
||||||
|
}
|
||||||
|
if(!settingsDoc.containsKey(param))
|
||||||
|
{
|
||||||
|
log_e("param(%s)",param);
|
||||||
|
return def;
|
||||||
|
}
|
||||||
|
return settingsDoc[param];
|
||||||
|
}
|
||||||
|
|
||||||
void loadConfig(const char *fname)
|
void loadConfig(const char *fname)
|
||||||
{
|
{
|
||||||
log_i("config: load");
|
log_i("config: load");
|
||||||
File file = LITTLEFS.open(fname);
|
File file = LittleFS.open(fname);
|
||||||
|
|
||||||
DeserializationError error = deserializeJson(settingsDoc, file);
|
DeserializationError error = deserializeJson(settingsDoc, file);
|
||||||
if (error)
|
if (error)
|
||||||
@@ -80,6 +115,9 @@ void loadConfig(const char *fname)
|
|||||||
}
|
}
|
||||||
configInitOK = !hasError;
|
configInitOK = !hasError;
|
||||||
}
|
}
|
||||||
|
//test values
|
||||||
|
int test = GetIntparam("ScanTimeout");
|
||||||
|
log_i("retval(%i)",test);
|
||||||
log_i("config: load done");
|
log_i("config: load done");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,8 @@
|
|||||||
String getConfigSong(String uid);
|
String getConfigSong(String uid);
|
||||||
bool getUIDvalid(String uid);
|
bool getUIDvalid(String uid);
|
||||||
String GetWifiPassword(String ssid);
|
String GetWifiPassword(String ssid);
|
||||||
|
int GetIntparam(String param, int def = -1);
|
||||||
|
float getFloatParam( String param, int def = -1);
|
||||||
|
|
||||||
void initConfig(void);
|
void initConfig(void);
|
||||||
void handleConfig(void);
|
void handleConfig(void);
|
||||||
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
bool newState = true;
|
bool newState = true;
|
||||||
uint32_t idleTime = 0;
|
uint32_t idleTime = 0;
|
||||||
|
uint32_t gameTimeout = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -24,6 +25,7 @@ GameStates gameState = GameStates::stateInit;
|
|||||||
|
|
||||||
void initGame(void)
|
void initGame(void)
|
||||||
{
|
{
|
||||||
|
gameTimeout = GetIntparam("GameTimeout", TIMEOUT_ARMED);
|
||||||
log_i("Game: init: done");
|
log_i("Game: init: done");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,9 +98,11 @@ void handleGame(void)
|
|||||||
handleNewState();
|
handleNewState();
|
||||||
setRFIDscanState(false);
|
setRFIDscanState(false);
|
||||||
setAudioState(false);
|
setAudioState(false);
|
||||||
idleTime = millis();
|
//idleTime = millis();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
idleTime = getLastTagTime();
|
||||||
|
|
||||||
if (!getRFIDlastUIDValid())
|
if (!getRFIDlastUIDValid())
|
||||||
{
|
{
|
||||||
// no UID found, go RFID scanning
|
// no UID found, go RFID scanning
|
||||||
@@ -149,7 +153,7 @@ void handleGame(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
uint32_t now = millis();
|
uint32_t now = millis();
|
||||||
if(now - idleTime > TIMEOUT_ARMED)
|
if(now - idleTime > gameTimeout)
|
||||||
{
|
{
|
||||||
log_i("Armed timed-out, clear current UID and go back to Idle");
|
log_i("Armed timed-out, clear current UID and go back to Idle");
|
||||||
clearRFIDlastUID();
|
clearRFIDlastUID();
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#include "power.h"
|
#include "power.h"
|
||||||
|
|
||||||
#define TIMEOUT_IDLE 20000
|
#define TIMEOUT_IDLE 20000
|
||||||
#define TIMEOUT_ARMED 10000
|
#define TIMEOUT_ARMED 20000
|
||||||
|
|
||||||
typedef enum{
|
typedef enum{
|
||||||
stateInit,
|
stateInit,
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ void SetLedColor(CRGB color, bool blink)
|
|||||||
void initLed(void)
|
void initLed(void)
|
||||||
{
|
{
|
||||||
FastLED.addLeds<SK6812, LED_PIN, GRB>(leds, NUM_LEDS); // GRB ordering is typical
|
FastLED.addLeds<SK6812, LED_PIN, GRB>(leds, NUM_LEDS); // GRB ordering is typical
|
||||||
FastLED.setBrightness(20);
|
FastLED.setBrightness(GetIntparam("Brightness", LEDDEFBRIGHT));
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleLed(void)
|
void handleLed(void)
|
||||||
|
|||||||
@@ -4,10 +4,12 @@
|
|||||||
#include "power.h"
|
#include "power.h"
|
||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
#include "rfid.h"
|
#include "rfid.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
#define NUM_LEDS 1
|
#define NUM_LEDS 1
|
||||||
#define LEDTIMEOUT 100
|
#define LEDTIMEOUT 100
|
||||||
#define LEDBLINKTIME 500
|
#define LEDBLINKTIME 500
|
||||||
|
#define LEDDEFBRIGHT 20
|
||||||
|
|
||||||
void initLed(void);
|
void initLed(void);
|
||||||
void handleLed(void);
|
void handleLed(void);
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ bool OtaProcess_class::initialize(void)
|
|||||||
m_psk = tmppsk;
|
m_psk = tmppsk;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
log_w("using fallback SSID %s", SECRET_SSID);
|
||||||
m_ssid = SECRET_SSID;
|
m_ssid = SECRET_SSID;
|
||||||
m_psk = SECRET_PASS;
|
m_psk = SECRET_PASS;
|
||||||
}
|
}
|
||||||
@@ -68,10 +69,10 @@ bool OtaProcess_class::initialize(void)
|
|||||||
|
|
||||||
case otaConnect:
|
case otaConnect:
|
||||||
{
|
{
|
||||||
log_i("Otastate = initialize(connect)");
|
|
||||||
uint32_t timeTemp = millis();
|
uint32_t timeTemp = millis();
|
||||||
if (timeTemp - m_lastconnectTime > WIFICONNECTINTERVAL)
|
if (timeTemp - m_lastconnectTime > WIFICONNECTINTERVAL)
|
||||||
{
|
{
|
||||||
|
log_i("Otastate = initialize(connect)");
|
||||||
if (WiFi.status() != WL_CONNECTED)
|
if (WiFi.status() != WL_CONNECTED)
|
||||||
{
|
{
|
||||||
log_e("Connection Failed! Retry...");
|
log_e("Connection Failed! Retry...");
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#include "ArduinoOTA.h"
|
#include "ArduinoOTA.h"
|
||||||
#include "JC_Button.h"
|
#include "JC_Button.h"
|
||||||
#include "LITTLEFS.h"
|
#include "LittleFS.h"
|
||||||
|
|
||||||
#define WIFICONNECTINTERVAL 1000
|
#define WIFICONNECTINTERVAL 1000
|
||||||
|
|
||||||
|
|||||||
@@ -121,6 +121,7 @@ void handlePowerState(void)
|
|||||||
// init all
|
// init all
|
||||||
log_i("powerinit");
|
log_i("powerinit");
|
||||||
SetLedColor(CRGB::Green);
|
SetLedColor(CRGB::Green);
|
||||||
|
//initConfig();
|
||||||
powerstate = on;
|
powerstate = on;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -7,9 +7,10 @@
|
|||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
#include "ota.h"
|
#include "ota.h"
|
||||||
#include "led.h"
|
#include "led.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
|
||||||
#define TIMEOUT_POWER (7 * 1000 * 60) // 7 minutes timeout
|
#define TIMEOUT_POWER (30 * 1000 * 60) // 7 minutes timeout
|
||||||
#define POWERBUTTONDELAY 400
|
#define POWERBUTTONDELAY 400
|
||||||
//#define BATTERYMEASUREDELAY 60000
|
//#define BATTERYMEASUREDELAY 60000
|
||||||
#define POWERBUTTONOTADELAY 4000
|
#define POWERBUTTONOTADELAY 4000
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ NfcAdapter nfc = NfcAdapter(pn532spi);
|
|||||||
|
|
||||||
uint32_t lastRFID = 0;
|
uint32_t lastRFID = 0;
|
||||||
uint32_t lastRFIDlog = 0;
|
uint32_t lastRFIDlog = 0;
|
||||||
|
uint32_t lastTagTime = 0;
|
||||||
|
|
||||||
|
//settings
|
||||||
|
uint32_t scantimeout = 0;
|
||||||
|
|
||||||
String lastUid = "";
|
String lastUid = "";
|
||||||
|
|
||||||
@@ -16,6 +20,7 @@ void initRfid()
|
|||||||
{
|
{
|
||||||
log_i("RFID init:"); // shows in serial that it is ready to read
|
log_i("RFID init:"); // shows in serial that it is ready to read
|
||||||
nfc.begin(true);
|
nfc.begin(true);
|
||||||
|
scantimeout = GetIntparam("ScanTimeout", RFIDTIMEOUT );
|
||||||
RfidinitOK = true;
|
RfidinitOK = true;
|
||||||
log_i("RFID init: OK"); // shows in serial that it is ready to read
|
log_i("RFID init: OK"); // shows in serial that it is ready to read
|
||||||
}
|
}
|
||||||
@@ -32,16 +37,22 @@ void handleRfid()
|
|||||||
lastRFIDlog = timeNow;
|
lastRFIDlog = timeNow;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nfc.tagPresent(80))
|
if (nfc.tagPresent(RFIDTIMEOUT))
|
||||||
{
|
{
|
||||||
NfcTag tag = nfc.read();
|
NfcTag tag = nfc.read();
|
||||||
lastUid = tag.getUidString();
|
lastUid = tag.getUidString();
|
||||||
|
lastTagTime = millis();
|
||||||
log_i("found tag %s",lastUid.c_str());
|
log_i("found tag %s",lastUid.c_str());
|
||||||
}
|
}
|
||||||
lastRFID = timeNow;
|
lastRFID = timeNow;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t getLastTagTime(void)
|
||||||
|
{
|
||||||
|
return lastTagTime;
|
||||||
|
}
|
||||||
|
|
||||||
bool getRFIDInitStatus(void)
|
bool getRFIDInitStatus(void)
|
||||||
{
|
{
|
||||||
return RfidinitOK;
|
return RfidinitOK;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
#include "game.h"
|
#include "game.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#include "PN532_SPI.h"
|
#include "PN532_SPI.h"
|
||||||
@@ -9,8 +10,9 @@
|
|||||||
#include "NfcAdapter.h"
|
#include "NfcAdapter.h"
|
||||||
|
|
||||||
#define NDEF_SUPPORT_MIFARE_CLASSIC
|
#define NDEF_SUPPORT_MIFARE_CLASSIC
|
||||||
#define RFIDINTERVAL 800
|
#define RFIDINTERVAL 200
|
||||||
#define RFIDLOGINTERVAL 5000
|
#define RFIDLOGINTERVAL 5000
|
||||||
|
#define RFIDTIMEOUT 50
|
||||||
|
|
||||||
void initRfid(void);
|
void initRfid(void);
|
||||||
void handleRfid(void);
|
void handleRfid(void);
|
||||||
@@ -18,4 +20,5 @@ bool getRFIDInitStatus(void);
|
|||||||
String getRFIDlastUID(void);
|
String getRFIDlastUID(void);
|
||||||
void setRFIDscanState(bool state);
|
void setRFIDscanState(bool state);
|
||||||
bool getRFIDlastUIDValid(void);
|
bool getRFIDlastUIDValid(void);
|
||||||
void clearRFIDlastUID(void);
|
void clearRFIDlastUID(void);
|
||||||
|
uint32_t getLastTagTime(void);
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ bool CheckBattery(void)
|
|||||||
BatteryVoltage = battery.voltage();
|
BatteryVoltage = battery.voltage();
|
||||||
BatterySensor = battery.level(BatteryVoltage);
|
BatterySensor = battery.level(BatteryVoltage);
|
||||||
digitalWrite(MEAS_EN, HIGH);
|
digitalWrite(MEAS_EN, HIGH);
|
||||||
log_i("read batt, ticks=%d, raw=%4.2f, vbatt=%d, level=%d", battticks, vbattraw, BatteryVoltage, BatterySensor);
|
log_v("read batt, ticks=%d, raw=%4.2f, vbatt=%d, level=%d", battticks, vbattraw, BatteryVoltage, BatterySensor);
|
||||||
if (BatteryVoltage < VBATTMIN)
|
if (BatteryVoltage < VBATTMIN)
|
||||||
{
|
{
|
||||||
uint32_t timeNow = millis();
|
uint32_t timeNow = millis();
|
||||||
@@ -127,6 +127,11 @@ void handleBatterySensor(void)
|
|||||||
{
|
{
|
||||||
uint32_t timeNow = millis();
|
uint32_t timeNow = millis();
|
||||||
|
|
||||||
|
if(getAudioState())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (timeNow - lastVbatt > (VBATTINTERVALL - VBATTMEASPRECHARGE))
|
if (timeNow - lastVbatt > (VBATTINTERVALL - VBATTMEASPRECHARGE))
|
||||||
{
|
{
|
||||||
digitalWrite(MEAS_EN, LOW);
|
digitalWrite(MEAS_EN, LOW);
|
||||||
@@ -150,17 +155,13 @@ void handleBatterySensor(void)
|
|||||||
void handleHallSensor(void)
|
void handleHallSensor(void)
|
||||||
{
|
{
|
||||||
uint32_t timeNow = millis();
|
uint32_t timeNow = millis();
|
||||||
|
|
||||||
// if(!getAudioState())
|
|
||||||
// {
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (timeNow - lastADS < ADSINTERVAL)
|
if (timeNow - lastADS < ADSINTERVAL)
|
||||||
{
|
{
|
||||||
return;
|
//wait for timer
|
||||||
}
|
return;
|
||||||
lastADS = timeNow;
|
}
|
||||||
|
lastADS = timeNow;
|
||||||
|
|
||||||
int angle = as5600.getCumulativePosition();
|
int angle = as5600.getCumulativePosition();
|
||||||
log_v("sensor angle %d", angle);
|
log_v("sensor angle %d", angle);
|
||||||
|
|||||||
@@ -9,32 +9,18 @@
|
|||||||
#include "Wire.h"
|
#include "Wire.h"
|
||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
|
|
||||||
#define ADSINTERVAL 300
|
#define ADSINTERVAL 100
|
||||||
#define VBATTINTERVALL 15000
|
#define VBATTINTERVALL 15000
|
||||||
#define VBATTMEASPRECHARGE 500
|
#define VBATTMEASPRECHARGE 500
|
||||||
#define LOWBATTPERIOD 30000
|
#define LOWBATTPERIOD 30000
|
||||||
|
|
||||||
#define HALLINTERVAL 100
|
#define HALLINTERVAL 100
|
||||||
// #define HALLCNTTHRESHOLD 20
|
#define HALLTHRESHOLD 5
|
||||||
// #define HALLIDLETHRESHOLD 20
|
|
||||||
// #define HALLIDLESAMPLES 15
|
|
||||||
// #define HALLPLAYSAMPLES 24
|
|
||||||
#define HALLTHRESHOLD 2
|
|
||||||
|
|
||||||
// typedef enum
|
|
||||||
// {
|
|
||||||
// hall_idle,
|
|
||||||
// hall_increasing,
|
|
||||||
// hall_tipover,
|
|
||||||
// hall_decreasing,
|
|
||||||
// }HALLSENSORSTATES;
|
|
||||||
|
|
||||||
|
|
||||||
void initSensor(void);
|
void initSensor(void);
|
||||||
void handleBatterySensor(void);
|
void handleBatterySensor(void);
|
||||||
void handleHallSensor(void);
|
void handleHallSensor(void);
|
||||||
|
|
||||||
|
|
||||||
uint16_t getHall( void );
|
uint16_t getHall( void );
|
||||||
bool hallIsIdle(void);
|
bool hallIsIdle(void);
|
||||||
uint16_t getvbatt(uint8_t dummy);
|
uint16_t getvbatt(uint8_t dummy);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#define ESP_V2
|
#define ESP_V2
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#include <LITTLEFS.h>
|
#include <LittleFS.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CONFIG_LITTLEFS_FOR_IDF_3_2
|
#ifndef CONFIG_LITTLEFS_FOR_IDF_3_2
|
||||||
@@ -92,12 +92,12 @@ void readFile(fs::FS &fs, const char *path)
|
|||||||
|
|
||||||
void initStorage()
|
void initStorage()
|
||||||
{
|
{
|
||||||
if (!LITTLEFS.begin(FORMAT_LITTLEFS_IF_FAILED))
|
if (!LittleFS.begin(FORMAT_LITTLEFS_IF_FAILED))
|
||||||
{
|
{
|
||||||
log_e("LITTLEFS Mount Failed");
|
log_e("LittleFS Mount Failed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
listDir(LITTLEFS, "/", 0);
|
listDir(LittleFS, "/", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleStorage()
|
void handleStorage()
|
||||||
|
|||||||
BIN
administratie/kwitantie_20230430.docx
Normal file
BIN
administratie/kwitantie_20230430.docx
Normal file
Binary file not shown.
BIN
administratie/kwitantie_20230430.pdf
Normal file
BIN
administratie/kwitantie_20230430.pdf
Normal file
Binary file not shown.
BIN
administratie/muziekdoos_uitgaven.xlsx
Normal file
BIN
administratie/muziekdoos_uitgaven.xlsx
Normal file
Binary file not shown.
Reference in New Issue
Block a user