Compare commits

..

3 Commits

Author SHA1 Message Date
69bf5f90fa docs: update changelog and header for version v1.5.12-beta13
All checks were successful
Release Workflow / detect-provider (push) Successful in 5s
Release Workflow / github-release (push) Has been skipped
Release Workflow / gitea-release (push) Successful in 3m9s
2025-08-29 14:17:15 +02:00
382caeaced docs: update platformio.ini for beta version v1.5.12-beta13 2025-08-29 14:17:15 +02:00
47bdf022ec refactor: reorganize clearUserDataArea function for improved clarity and safety 2025-08-29 14:17:10 +02:00
3 changed files with 39 additions and 33 deletions

View File

@@ -1,5 +1,11 @@
# Changelog
## [1.5.12-beta13] - 2025-08-29
### Changed
- update platformio.ini for beta version v1.5.12-beta13
- reorganize clearUserDataArea function for improved clarity and safety
## [1.5.12-beta12] - 2025-08-29
### Changed
- update platformio.ini for beta version v1.5.12-beta12

View File

@@ -9,7 +9,7 @@
; https://docs.platformio.org/page/projectconf.html
[common]
version = "1.5.12-beta12"
version = "1.5.12-beta13"
to_old_version = "1.5.0"
##

View File

@@ -223,38 +223,6 @@ uint16_t getMaxUserDataPages()
return maxPages;
}
bool clearUserDataArea() {
// IMPORTANT: Only clear user data pages, NOT configuration pages
// NTAG layout: Pages 0-3 (header), 4-N (user data), N+1-N+3 (config) - NEVER touch config!
String tagType = detectNtagType();
// Calculate safe user data page ranges (NEVER touch config pages!)
uint16_t firstUserPage = 4;
uint16_t lastUserPage = 0;
if (tagType == "NTAG213") {
lastUserPage = 39; // Pages 40-42 are config - DO NOT TOUCH!
Serial.println("NTAG213: Sichere Löschung Seiten 4-39");
} else if (tagType == "NTAG215") {
lastUserPage = 129; // Pages 130-132 are config - DO NOT TOUCH!
Serial.println("NTAG215: Sichere Löschung Seiten 4-129");
} else if (tagType == "NTAG216") {
lastUserPage = 225; // Pages 226-228 are config - DO NOT TOUCH!
Serial.println("NTAG216: Sichere Löschung Seiten 4-225");
} else {
// Conservative fallback - only clear a small safe area
lastUserPage = 39;
Serial.println("UNKNOWN TAG: Konservative Löschung Seiten 4-39");
}
Serial.println("WARNUNG: Vollständiges Löschen kann Tag beschädigen!");
Serial.println("Verwende stattdessen selective NDEF-Überschreibung...");
// Instead of clearing everything, just write a minimal NDEF structure
// This is much safer and preserves tag integrity
return initializeNdefStructure();
}
bool initializeNdefStructure() {
// Write minimal NDEF structure without destroying the tag
// This creates a clean slate while preserving tag functionality
@@ -300,6 +268,38 @@ bool initializeNdefStructure() {
return true;
}
bool clearUserDataArea() {
// IMPORTANT: Only clear user data pages, NOT configuration pages
// NTAG layout: Pages 0-3 (header), 4-N (user data), N+1-N+3 (config) - NEVER touch config!
String tagType = detectNtagType();
// Calculate safe user data page ranges (NEVER touch config pages!)
uint16_t firstUserPage = 4;
uint16_t lastUserPage = 0;
if (tagType == "NTAG213") {
lastUserPage = 39; // Pages 40-42 are config - DO NOT TOUCH!
Serial.println("NTAG213: Sichere Löschung Seiten 4-39");
} else if (tagType == "NTAG215") {
lastUserPage = 129; // Pages 130-132 are config - DO NOT TOUCH!
Serial.println("NTAG215: Sichere Löschung Seiten 4-129");
} else if (tagType == "NTAG216") {
lastUserPage = 225; // Pages 226-228 are config - DO NOT TOUCH!
Serial.println("NTAG216: Sichere Löschung Seiten 4-225");
} else {
// Conservative fallback - only clear a small safe area
lastUserPage = 39;
Serial.println("UNKNOWN TAG: Konservative Löschung Seiten 4-39");
}
Serial.println("WARNUNG: Vollständiges Löschen kann Tag beschädigen!");
Serial.println("Verwende stattdessen selective NDEF-Überschreibung...");
// Instead of clearing everything, just write a minimal NDEF structure
// This is much safer and preserves tag integrity
return initializeNdefStructure();
}
uint8_t ntag2xx_WriteNDEF(const char *payload) {
// Determine exact tag type and capabilities first
String tagType = detectNtagType();