kluk does not use battery anymore

This commit is contained in:
Christophe Robillard 2026-01-27 19:29:29 +01:00
parent b24637e7ec
commit 45d6421f32

View file

@ -19,11 +19,7 @@
#include <MFRC522DriverPinSimple.h> #include <MFRC522DriverPinSimple.h>
#include <MFRC522Debug.h> #include <MFRC522Debug.h>
#include "Adafruit_MAX1704X.h"
#define SS_PIN SDA #define SS_PIN SDA
#define SLEEP_DURATION 1
#define RGB_BRIGHTNESS 4 // Change neopixel brightness (max 255) #define RGB_BRIGHTNESS 4 // Change neopixel brightness (max 255)
@ -31,10 +27,6 @@ MFRC522DriverPinSimple ss_1_pin(SS_PIN); // Configurable, take an unused pin, on
MFRC522DriverSPI driver_1{ss_1_pin}; MFRC522DriverSPI driver_1{ss_1_pin};
MFRC522 reader{driver_1}; // Create MFRC522 instance. MFRC522 reader{driver_1}; // Create MFRC522 instance.
RTC_DATA_ATTR int nbCycles = 0;
Adafruit_MAX17048 lipo;
const char *rootCACertificate = R"string_literal( const char *rootCACertificate = R"string_literal(
-----BEGIN CERTIFICATE----- -----BEGIN CERTIFICATE-----
MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw
@ -76,12 +68,8 @@ void setup() {
#ifdef DEBUG #ifdef DEBUG
Serial.begin(115200); Serial.begin(115200);
while (!Serial) delay(10); while (!Serial) delay(10);
Serial.print("Nb cycles: ");
Serial.println(nbCycles++);
#endif #endif
measureBattery();
reader.PCD_Init(); // Init each MFRC522 card. reader.PCD_Init(); // Init each MFRC522 card.
#ifdef DEBUG #ifdef DEBUG
MFRC522Debug::PCD_DumpVersionToSerial(reader, Serial); // Show details of PCD - MFRC522 Card Reader details. MFRC522Debug::PCD_DumpVersionToSerial(reader, Serial); // Show details of PCD - MFRC522 Card Reader details.
@ -96,16 +84,6 @@ void loop() {
} }
else { else {
delay(200); delay(200);
ESP.deepSleep(SLEEP_DURATION * 1000000);
}
}
void measureBattery() {
if (nbCycles % 10) {
lipo.begin();
if (lipo.cellVoltage() < 2.6) {
displayError();
}
} }
} }