Skip to content

Commit

Permalink
Merge pull request #355 from rennancockles/dev
Browse files Browse the repository at this point in the history
Chameleon Ultra full integration
  • Loading branch information
pr3y authored Oct 24, 2024
2 parents 3b0166e + 316671b commit 6ec8281
Show file tree
Hide file tree
Showing 7 changed files with 1,058 additions and 357 deletions.
17 changes: 9 additions & 8 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ lib_deps =
https://github.com/bmorcelli/ESPping/
https://github.com/rennancockles/PN532
https://github.com/rennancockles/MFRC522-I2C
https://github.com/rennancockles/ESP-ChameleonUltra
NTPClient
Timezone
ESP32Time
Expand All @@ -75,7 +76,7 @@ lib_deps =
tobozo/ESP32-PSRamFS
;chegewara/EspTinyUSB
bitbank2/AnimatedGIF

[env:m5stack-cplus2]
platform = https://github.com/bmorcelli/platform-espressif32/releases/download/0.0.4/platform-espressif32.zip
board = m5stick-c
Expand Down Expand Up @@ -634,7 +635,7 @@ build_flags =

;Can run USB as HID
;-DUSB_as_HID=1 ;uncomment to enable
-DBAD_TX=32
-DBAD_TX=32
-DBAD_RX=33

;Battery ADC read pin
Expand Down Expand Up @@ -763,7 +764,7 @@ build_flags =

;Can run USB as HID
;-DUSB_as_HID=1 ;uncomment to enable
-DBAD_TX=21
-DBAD_TX=21
-DBAD_RX=22

;Battery ADC read pin
Expand Down Expand Up @@ -889,7 +890,7 @@ build_flags =

;Can run USB as HID
;-DUSB_as_HID=1 ;uncomment to enable
-DBAD_TX=21
-DBAD_TX=21
-DBAD_RX=22

;Battery ADC read pin
Expand Down Expand Up @@ -995,7 +996,7 @@ build_flags =
; needed for serial
-DARDUINO_USB_CDC_ON_BOOT=1
-DBOARD_HAS_PSRAM

; grove pins
; defaults from https://github.com/espressif/arduino-esp32/blob/master/variants/esp32s3/pins_arduino.h
-DGROVE_SDA=8 ; default RF TX pin
Expand Down Expand Up @@ -1078,7 +1079,7 @@ build_flags =
-DSPI_MOSI_PIN=11
-DSPI_MISO_PIN=13
-DSPI_SS_PIN=10

lib_deps =
${common.lib_deps}

Expand Down Expand Up @@ -1344,7 +1345,7 @@ build_flags =
;tft Brighness Control
-DTFT_BRIGHT_CHANNEL=0
-DTFT_BRIGHT_Bits=8
-DTFT_BRIGHT_FREQ=5000
-DTFT_BRIGHT_FREQ=5000

;Default I2C port
-DGROVE_SDA=27
Expand Down Expand Up @@ -1498,7 +1499,7 @@ build_flags =
;tft Brighness Control
-DTFT_BRIGHT_CHANNEL=0
-DTFT_BRIGHT_Bits=8
-DTFT_BRIGHT_FREQ=10000
-DTFT_BRIGHT_FREQ=10000

;Default I2C port
-DGROVE_SDA=27
Expand Down
2 changes: 2 additions & 0 deletions src/core/sd_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,8 @@ bool checkExt(String ext, String pattern) {
pattern.toUpperCase();
if (ext == pattern) return true;

pattern = "^(" + pattern + ")$";

char charArray[pattern.length() + 1];
pattern.toCharArray(charArray, pattern.length() + 1);
std::regex ext_regex(charArray);
Expand Down
5 changes: 5 additions & 0 deletions src/modules/rfid/PN532.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "PN532.h"
#include "core/sd_functions.h"
#include "core/i2c_finder.h"
#include "core/display.h"


PN532::PN532(bool use_i2c) {
Expand All @@ -31,6 +32,7 @@ int PN532::read() {
if (!nfc.startPassiveTargetIDDetection()) return TAG_NOT_PRESENT;
if (!nfc.readDetectedPassiveTargetID()) return FAILURE;

displayInfo("Reading data blocks...");
pageReadSuccess = read_data_blocks();
format_data();
set_uid();
Expand Down Expand Up @@ -432,6 +434,7 @@ int PN532::write_data_blocks() {
int lineBreakIndex;
int pageIndex;
bool blockWriteSuccess;
int totalSize = strAllPages.length();

while (strAllPages.length() > 0) {
lineBreakIndex = strAllPages.indexOf("\n");
Expand Down Expand Up @@ -463,6 +466,8 @@ int PN532::write_data_blocks() {
}

if (!blockWriteSuccess) return FAILURE;

progressHandler(totalSize-strAllPages.length(), totalSize, "Writing data blocks...");
}

return SUCCESS;
Expand Down
6 changes: 6 additions & 0 deletions src/modules/rfid/RFID2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "RFID2.h"
#include "core/sd_functions.h"
#include "core/i2c_finder.h"
#include "core/display.h"

#define RFID2_I2C_ADDRESS 0x28

Expand Down Expand Up @@ -44,6 +45,8 @@ int RFID2::read() {
if (!PICC_IsNewCardPresent() || !mfrc522.PICC_ReadCardSerial()) {
return TAG_NOT_PRESENT;
}

displayInfo("Reading data blocks...");
pageReadSuccess = read_data_blocks();
format_data();
set_uid();
Expand Down Expand Up @@ -450,6 +453,7 @@ int RFID2::write_data_blocks() {
int lineBreakIndex;
int pageIndex;
bool blockWriteSuccess;
int totalSize = strAllPages.length();

while (strAllPages.length() > 0) {
lineBreakIndex = strAllPages.indexOf("\n");
Expand Down Expand Up @@ -481,6 +485,8 @@ int RFID2::write_data_blocks() {
}

if (!blockWriteSuccess) return FAILURE;

progressHandler(totalSize-strAllPages.length(), totalSize, "Writing data blocks...");
}

return SUCCESS;
Expand Down
Loading

0 comments on commit 6ec8281

Please sign in to comment.