Compare commits

...

31 Commits

Author SHA1 Message Date
f28b34e427 docs: update changelog and header for version v2.0.0-beta4
All checks were successful
Release Workflow / detect-provider (push) Successful in 9s
Release Workflow / github-release (push) Has been skipped
Release Workflow / gitea-release (push) Successful in 3m4s
2025-08-29 18:57:42 +02:00
9215560558 docs: update platformio.ini for beta version v2.0.0-beta4 2025-08-29 18:57:41 +02:00
7f6bce1699 fix: update createVendor function to use external_id as comment instead of static text 2025-08-29 18:56:20 +02:00
2a4f8bb679 fix: update to_old_version in platformio.ini to reflect correct previous version 2025-08-29 18:45:16 +02:00
480e2da23e docs: update changelog and header for version v2.0.0-beta3
All checks were successful
Release Workflow / detect-provider (push) Successful in 3s
Release Workflow / github-release (push) Has been skipped
Release Workflow / gitea-release (push) Successful in 3m13s
2025-08-29 18:44:33 +02:00
ba22602767 docs: update platformio.ini for beta version v2.0.0-beta3 2025-08-29 18:44:33 +02:00
b2c68d5aac refactor: update createVendor and checkVendor functions to accept JsonDocument payload 2025-08-29 18:44:21 +02:00
52a7f6b5b6 docs: update changelog and header for version v2.0.0-beta2
All checks were successful
Release Workflow / detect-provider (push) Successful in 2s
Release Workflow / github-release (push) Has been skipped
Release Workflow / gitea-release (push) Successful in 2m53s
2025-08-29 18:31:08 +02:00
4cce9f8d5d docs: update platformio.ini for beta version v2.0.0-beta2 2025-08-29 18:31:08 +02:00
f0eced8585 fix: increase delay in start_scale function for improved stability 2025-08-29 18:30:58 +02:00
02e31878ee docs: clarify product URL description for Manufacturer Tags in German and English documentation 2025-08-29 18:22:40 +02:00
7ff499f984 docs: add Manufacturer Tags support documentation in German and English 2025-08-29 18:18:59 +02:00
fcd637cc30 docs: update changelog and header for version v2.0.0-beta1
All checks were successful
Release Workflow / detect-provider (push) Successful in 6s
Release Workflow / github-release (push) Has been skipped
Release Workflow / gitea-release (push) Successful in 3m5s
2025-08-29 18:06:55 +02:00
587485d0de docs: update platformio.ini for beta version v2.0.0-beta1 2025-08-29 18:06:55 +02:00
e0cc99e993 chore: update version to 2.0.0 in platformio.ini 2025-08-29 18:06:48 +02:00
d9a8388ac7 docs: update changelog and header for version v1.5.12-beta18
All checks were successful
Release Workflow / detect-provider (push) Successful in 3s
Release Workflow / github-release (push) Has been skipped
Release Workflow / gitea-release (push) Successful in 3m8s
2025-08-29 18:04:56 +02:00
cb77112976 docs: update platformio.ini for beta version v1.5.12-beta18 2025-08-29 18:04:56 +02:00
1c0ddb52ba fix: replace progress bar with message display for remaining weight in sendToApi function 2025-08-29 18:04:47 +02:00
17f03e9472 feat: add display delay for vendor, filament, and spool creation processes 2025-08-29 17:57:23 +02:00
213b9c099c docs: update changelog and header for version v1.5.12-beta17
All checks were successful
Release Workflow / detect-provider (push) Successful in 3s
Release Workflow / github-release (push) Has been skipped
Release Workflow / gitea-release (push) Successful in 3m41s
2025-08-29 17:32:46 +02:00
687e57b77a docs: update platformio.ini for beta version v1.5.12-beta17 2025-08-29 17:32:46 +02:00
aea11e0c06 fix: update vendor check to use shorthand key in payload 2025-08-29 17:31:25 +02:00
bd8f4606c6 feat: add progress bar updates for vendor and filament creation processes 2025-08-29 17:30:04 +02:00
ac91e71c14 refactor: optimize page limit detection and remove redundant verification code 2025-08-29 17:20:44 +02:00
0d3503f4f1 docs: update changelog and header for version v1.5.12-beta16
All checks were successful
Release Workflow / detect-provider (push) Successful in 4s
Release Workflow / github-release (push) Has been skipped
Release Workflow / gitea-release (push) Successful in 3m4s
2025-08-29 17:04:41 +02:00
1460c6e5f9 docs: update platformio.ini for beta version v1.5.12-beta16 2025-08-29 17:04:41 +02:00
fef7e5aa4b Refactor NFC interface handling and improve error diagnostics
- Removed unused function for getting current date in ISO8601 format.
- Updated JSON key names in filament and spool creation to use shorter identifiers.
- Enhanced NFC interface reset procedure with detailed logging and retry mechanisms.
- Improved stability checks after write operations to ensure NFC interface readiness.
- Added comprehensive error handling and diagnostics for NFC read/write operations.
- Streamlined the quick spool ID check to optimize performance and reliability.
2025-08-29 17:04:33 +02:00
bda8c3dd98 docs: update changelog and header for version v1.5.12-beta15
All checks were successful
Release Workflow / detect-provider (push) Successful in 3s
Release Workflow / github-release (push) Has been skipped
Release Workflow / gitea-release (push) Successful in 3m10s
2025-08-29 16:02:57 +02:00
8702469020 docs: update platformio.ini for beta version v1.5.12-beta15 2025-08-29 16:02:56 +02:00
2a0f999f3b refactor: enhance NFC write operation diagnostics and improve error handling 2025-08-29 16:02:51 +02:00
c89adb6256 refactor: enhance NFC write operation handling and prevent tag operations during write 2025-08-29 15:52:16 +02:00
11 changed files with 1154 additions and 291 deletions

View File

@@ -1,5 +1,74 @@
# Changelog
## [2.0.0-beta4] - 2025-08-29
### Changed
- update platformio.ini for beta version v2.0.0-beta4
### Fixed
- update createVendor function to use external_id as comment instead of static text
- update to_old_version in platformio.ini to reflect correct previous version
## [2.0.0-beta3] - 2025-08-29
### Changed
- update platformio.ini for beta version v2.0.0-beta3
- update createVendor and checkVendor functions to accept JsonDocument payload
## [2.0.0-beta2] - 2025-08-29
### Added
- add Manufacturer Tags support documentation in German and English
### Changed
- update platformio.ini for beta version v2.0.0-beta2
- clarify product URL description for Manufacturer Tags in German and English documentation
### Fixed
- increase delay in start_scale function for improved stability
## [2.0.0-beta1] - 2025-08-29
### Changed
- update platformio.ini for beta version v2.0.0-beta1
- update version to 2.0.0 in platformio.ini
## [1.5.12-beta18] - 2025-08-29
### Added
- add display delay for vendor, filament, and spool creation processes
### Changed
- update platformio.ini for beta version v1.5.12-beta18
### Fixed
- replace progress bar with message display for remaining weight in sendToApi function
## [1.5.12-beta17] - 2025-08-29
### Added
- add progress bar updates for vendor and filament creation processes
### Changed
- update platformio.ini for beta version v1.5.12-beta17
- optimize page limit detection and remove redundant verification code
### Fixed
- update vendor check to use shorthand key in payload
## [1.5.12-beta16] - 2025-08-29
### Changed
- update platformio.ini for beta version v1.5.12-beta16
- Refactor NFC interface handling and improve error diagnostics
## [1.5.12-beta15] - 2025-08-29
### Changed
- update platformio.ini for beta version v1.5.12-beta15
- enhance NFC write operation diagnostics and improve error handling
- enhance NFC write operation handling and prevent tag operations during write
## [1.5.12-beta14] - 2025-08-29
### Changed
- update platformio.ini for beta version v1.5.12-beta14

View File

@@ -27,6 +27,7 @@ Discord Server: [https://discord.gg/my7Gvaxj2v](https://discord.gg/my7Gvaxj2v)
- Filamentdaten auf NFC-Tags schreiben.
- Verwendet das NFC-Tag-Format von [Openspool](https://github.com/spuder/OpenSpool)
- Ermöglicht automatische Spulenerkennung im AMS
- **Hersteller Tag Unterstützung:** Automatische Erstellung von Spoolman-Einträgen aus Hersteller NFC-Tags ([Mehr erfahren](README_ManufacturerTags_DE.md))
- **Bambulab AMS-Integration:**
- Anzeige der aktuellen AMS-Fachbelegung.
- Zuordnung von Filamenten zu AMS-Slots.
@@ -39,8 +40,35 @@ Discord Server: [https://discord.gg/my7Gvaxj2v](https://discord.gg/my7Gvaxj2v)
- Unterstützt das Spoolman Octoprint Plugin
### Wenn Sie meine Arbeit unterstützen möchten, freue ich mich über einen Kaffee
<a href="https://www.buymeacoffee.com/manuelw" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 30px !important;width: 108px !important;" ></a>
## Hersteller Tags Unterstützung
🎉 **Aufregende Neuigkeiten!** FilaMan unterstützt jetzt **Hersteller Tags** - NFC-Tags, die direkt von Filament-Herstellern vorprogrammiert geliefert werden!
### Erster Hersteller-Partner: RecyclingFabrik
Wir freuen uns anzukündigen, dass [**RecyclingFabrik**](https://www.recyclingfabrik.de) der **erste Filament-Hersteller** sein wird, der FilaMan unterstützt, indem sie NFC-Tags im FilaMan-Format auf ihren Spulen anbieten!
**Demnächst verfügbar:** RecyclingFabrik-Spulen werden NFC-Tags enthalten, die sich automatisch in Ihr FilaMan-System integrieren, manuelle Einrichtung überflüssig machen und perfekte Kompatibilität gewährleisten.
### Wie Hersteller Tags funktionieren
Wenn Sie zum ersten Mal einen Hersteller NFC-Tag scannen:
1. **Automatische Markenerkennung:** FilaMan erkennt den Hersteller und erstellt die Marke in Spoolman
2. **Filament-Typ Erstellung:** Alle Materialspezifikationen werden automatisch hinzugefügt
3. **Spulen-Registrierung:** Ihre spezifische Spule wird mit korrektem Gewicht und Spezifikationen registriert
4. **Zukünftige Schnellerkennung:** Nachfolgende Scans verwenden Fast-Path-Erkennung für sofortige Gewichtsmessung
**Für detaillierte technische Informationen:** [Hersteller Tags Dokumentation](README_ManufacturerTags_DE.md)
### Vorteile für Benutzer
-**Null manuelle Einrichtung** - Einfach scannen und wiegen
-**Perfekte Datengenauigkeit** - Hersteller-verifizierte Spezifikationen
-**Sofortige Integration** - Nahtlose Spoolman-Kompatibilität
-**Zukunftssicher** - Tags funktionieren mit jedem FilaMan-kompatiblen System
## Detaillierte Funktionalität
### ESP32-Funktionalität

View File

@@ -31,6 +31,7 @@ Discord Server: [https://discord.gg/my7Gvaxj2v](https://discord.gg/my7Gvaxj2v)
- Write filament data to NFC tags.
- uses NFC-Tag Format of [Openspool](https://github.com/spuder/OpenSpool)
- so you can use it with automatic Spool detection in AMS
- **Manufacturer Tag Support:** Automatic creation of Spoolman entries from manufacturer NFC tags ([Learn more](README_ManufacturerTags_EN.md))
- **Bambulab AMS Integration:**
- Display current AMS tray contents.
- Assign filaments to AMS slots.
@@ -43,8 +44,35 @@ Discord Server: [https://discord.gg/my7Gvaxj2v](https://discord.gg/my7Gvaxj2v)
- Supports Spoolman Octoprint Plugin
### If you want to support my work, i would be happy to get a coffe
<a href="https://www.buymeacoffee.com/manuelw" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 30px !important;width: 108px !important;" ></a>
## Manufacturer Tags Support
🎉 **Exciting News!** FilaMan now supports **Manufacturer Tags** - NFC tags that come pre-programmed directly from filament manufacturers!
### First Manufacturer Partner: RecyclingFabrik
We're thrilled to announce that [**RecyclingFabrik**](https://www.recyclingfabrik.de) will be the **first filament manufacturer** to support FilaMan by offering NFC tags in the FilaMan format on their spools!
**Coming Soon:** RecyclingFabrik spools will include NFC tags that automatically integrate with your FilaMan system, eliminating manual setup and ensuring perfect compatibility.
### How Manufacturer Tags Work
When you scan a manufacturer NFC tag for the first time:
1. **Automatic Brand Detection:** FilaMan recognizes the manufacturer and creates the brand in Spoolman
2. **Filament Type Creation:** All material specifications are automatically added
3. **Spool Registration:** Your specific spool is registered with proper weight and specifications
4. **Future Fast Recognition:** Subsequent scans use fast-path detection for instant weight measurement
**For detailed technical information:** [Manufacturer Tags Documentation](README_ManufacturerTags_EN.md)
### Benefits for Users
-**Zero Manual Setup** - Just scan and weigh
-**Perfect Data Accuracy** - Manufacturer-verified specifications
-**Instant Integration** - Seamless Spoolman compatibility
-**Future-Proof** - Tags work with any FilaMan-compatible system
## Detailed Functionality
### ESP32 Functionality

View File

@@ -0,0 +1,159 @@
# Hersteller Tags - Deutsche Dokumentation
## Überblick
Das FilaMan NFC-System unterstützt **Hersteller Tags**, die es Filament-Produzenten ermöglichen, standardisierte NFC-Tags für ihre Produkte zu erstellen. Beim Scannen dieser Tags werden automatisch die notwendigen Einträge in Spoolman (Marke, Filament-Typ und Spule) erstellt, ohne dass eine manuelle Einrichtung erforderlich ist.
## Funktionsweise der Hersteller Tags
### Ablauf
1. **Tag-Erkennung**: Wenn ein Tag ohne `sm_id` gescannt wird, prüft das System auf Hersteller Tag Format
2. **Marken-Erstellung/Suche**: Das System sucht die Marke in Spoolman oder erstellt sie, falls sie nicht existiert
3. **Filament-Typ-Erstellung/Suche**: Der Filament-Typ wird basierend auf Marke, Material und Spezifikationen erstellt oder gefunden
4. **Spulen-Erstellung**: Ein neuer Spulen-Eintrag wird automatisch mit der Tag-UID als Referenz erstellt
5. **Tag-Update**: Der Tag wird mit der neuen Spoolman Spulen-ID (`sm_id`) aktualisiert
### Warum Hersteller Tags verwenden?
- **Automatische Integration**: Keine manuelle Dateneingabe erforderlich
- **Standardisiertes Format**: Konsistente Produktinformationen verschiedener Hersteller
- **Lagerverwaltung**: Automatische Erstellung vollständiger Spoolman-Einträge
- **Rückverfolgbarkeit**: Direkte Verbindung zwischen physischem Produkt und digitalem Inventar
## Tag-Format Spezifikation
### JSON-Struktur
Hersteller Tags müssen eine JSON-Payload mit spezifischen Feldern enthalten, die **kurze Schlüssel** verwenden, um die Tag-Größe zu minimieren:
```json
{
"b": "Marke/Hersteller Name",
"an": "Artikelnummer",
"t": "Filament Typ (PLA, PETG, etc)",
"c": "Filament Farbe ohne # (FF5733)",
"mc": "Optional Mehrfarben-Filament Farben ohne # (FF0000,00FF00,0000FF)",
"mcd": "Optional Mehrfarben-Richtung als Wort (coaxial, longitudinal)",
"cn": "Farbname (rot, Blaubeere, Arktisches Blau)",
"et": "Extruder Temp als Zahl in C° (230)",
"bt": "Bett Temp als Zahl in C° (60)",
"di": "Durchmesser als Float (1.75)",
"de": "Dichte als Float (1.24)",
"sw": "Leeres Spulengewicht als Zahl in g (180)",
"u": "URL zum Filament mit der Artikelnummer"
}
```
### Pflichtfelder
- **`b`** (brand): Hersteller/Markenname
- **`an`** (article number): Eindeutige Produktkennung
- **`t`** (type): Materialtyp (PLA, PETG, ABS, etc.)
- **`c`** (color): Hex-Farbcode ohne #
- **`cn`** (color name): Lesbare Farbbezeichnung
- **`et`** (extruder temp): Empfohlene Extruder-Temperatur in Celsius
- **`bt`** (bed temp): Empfohlene Bett-Temperatur in Celsius
- **`di`** (diameter): Filamentdurchmesser in mm
- **`de`** (density): Materialdichte in g/cm³
- **`sw`** (spool weight): Leeres Spulengewicht in Gramm
### Optionale Felder
- **`mc`** (multicolor): Komma-getrennte Hex-Farben für Mehrfarben-Filamente
- **`mcd`** (multicolor direction): Richtung für Mehrfarben (coaxial, longitudinal)
- **`u`** (url): Produkt-URL mit direktem Link zum Artikel zB für Nachbestellung
### Beispiel Tag
```json
{"b":"Recycling Fabrik","an":"FX1_PETG-S175-1000-DAEM00055","t":"PETG","c":"FF5733","cn":"Lebendiges Orange","et":"230","bt":"70","di":"1.75","de":"1.24","sw":"180","u":"https://www.recyclingfabrik.com/search?q="}
```
## Implementierungsrichtlinien
### Für Hersteller
1. **Tag-Kodierung**: NDEF-Format mit MIME-Typ `application/json` verwenden
2. **Datenminimierung**: Kompaktes JSON-Format für Tag-Größenbegrenzungen nutzen
3. **Qualitätskontrolle**: Sicherstellen, dass alle Pflichtfelder vorhanden und korrekt formatiert sind
4. **Testen**: Tags vor der Produktion mit dem FilaMan-System verifizieren
### Tag-Größe Überlegungen
- **NTAG213**: 144 Bytes Nutzerdaten (geeignet für einfache Tags)
- **NTAG215**: 504 Bytes Nutzerdaten (empfohlen für umfassende Daten)
- **NTAG216**: 888 Bytes Nutzerdaten (maximale Kompatibilität)
### Best Practices
- Markennamen über alle Produkte hinweg konsistent halten
- Standardisierte Materialtypnamen verwenden (PLA, PETG, ABS, etc.)
- Genaue Temperaturempfehlungen angeben
- Aussagekräftige Farbnamen für bessere Benutzererfahrung verwenden
- Tags vor Massenproduktion mit dem FilaMan-System testen
## System-Integration
### Spoolman Datenbankstruktur
Bei der Verarbeitung eines Hersteller Tags erstellt das System:
1. **Lieferanten-Eintrag**: Markeninformationen in der Spoolman Lieferanten-Datenbank
2. **Filament-Eintrag**: Materialspezifikationen und Eigenschaften
3. **Spulen-Eintrag**: Einzelne Spule mit Gewicht und NFC-Tag-Referenz
### Fast-Path Erkennung
Sobald ein Tag verarbeitet und mit `sm_id` aktualisiert wurde, nutzt er das Fast-Path-Erkennungssystem für schnelle nachfolgende Scans.
## Fehlerbehebung
### Häufige Probleme
- **Tag zu klein**: NTAG215 oder NTAG216 für größere JSON-Payloads verwenden
- **Fehlende Felder**: Sicherstellen, dass alle Pflichtfelder vorhanden sind
- **Ungültiges Format**: JSON-Syntax und Feldtypen überprüfen
- **Spoolman-Verbindung**: Sicherstellen, dass FilaMan mit der Spoolman API verbinden kann
### Validierung
Das System validiert:
- JSON-Format Korrektheit
- Vorhandensein der Pflichtfelder
- Datentyp-Konformität
- Tag-Größe Kompatibilität
## Technische Details
### Verarbeitungsalgorithmus
1. Tag-Scan erkennt kein `sm_id` Feld
2. System prüft auf `b` (Marke) und `an` (Artikelnummer) Felder
3. `checkVendor()` erstellt oder findet Marke in Spoolman
4. `checkFilament()` erstellt oder findet Filament-Typ
5. `createSpool()` erstellt neuen Spulen-Eintrag
6. Tag wird mit neuer `sm_id` aktualisiert
### Fehlerbehandlung
- Graceful Fallback bei Netzwerkproblemen
- Detaillierte Protokollierung für Debugging
- Benutzer-Feedback bei fehlgeschlagenen Operationen
- Wiederholungsmechanismen für temporäre Fehler
### Systemverhalten
#### Bei fehlendem sm_id:
- System prüft auf `b` (brand) und `an` (artnr) Felder
- Falls vorhanden → Hersteller Tag erkannt
- Automatische Erstellung von Lieferant, Filament und Spule in Spoolman
- Tag wird mit neuer `sm_id` beschrieben
#### Bei vorhandenem sm_id:
- Fast-Path Erkennung für bekannte Spulen
- Sofortige Gewichtsmessung ohne vollständige Tag-Analyse
- Optimierte Performance für häufig verwendete Tags
Dieses System ermöglicht eine nahtlose Integration von Hersteller-Filamentprodukten in das FilaMan-Ökosystem unter Beibehaltung von Datenkonsistenz und Benutzererfahrung.

View File

@@ -0,0 +1,145 @@
# Manufacturer Tags - English Documentation
## Overview
The FilaMan NFC system supports **Manufacturer Tags** that allow filament producers to create standardized NFC tags for their products. When scanned, these tags automatically create the necessary entries in Spoolman (brand, filament type, and spool) without requiring manual setup.
## How Manufacturer Tags Work
### Process Flow
1. **Tag Detection**: When a tag without `sm_id` is scanned, the system checks for manufacturer tag format
2. **Brand Creation/Lookup**: The system searches for the brand in Spoolman or creates it if it doesn't exist
3. **Filament Type Creation/Lookup**: The filament type is created or found based on brand, material, and specifications
4. **Spool Creation**: A new spool entry is automatically created with the tag's UID as reference
5. **Tag Update**: The tag is updated with the new Spoolman spool ID (`sm_id`)
### Why Use Manufacturer Tags?
- **Automatic Integration**: No manual data entry required
- **Standardized Format**: Consistent product information across different manufacturers
- **Inventory Management**: Automatic creation of complete Spoolman entries
- **Traceability**: Direct link between physical product and digital inventory
## Tag Format Specification
### JSON Structure
Manufacturer tags must contain a JSON payload with specific fields using **short keys** to minimize tag size:
```json
{
"b": "Brand/Vendor Name",
"an": "Article Number",
"t": "Filament Type (PLA, PETG, etc)",
"c": "Filament Color without # (FF5733)",
"mc": "Optional Multicolor Filament Colors without # (FF0000,00FF00,0000FF)",
"mcd": "Optional Multicolor Direction as Word (coaxial, longitudinal)",
"cn": "Color Name (red, Blueberry, Arctic Blue)",
"et": "Extruder Temp as Number in C° (230)",
"bt": "Bed Temp as Number in C° (60)",
"di": "Diameter as Float (1.75)",
"de": "Density as Float (1.24)",
"sw": "Empty Spool Weight as Number in g (180)",
"u": "URL to get the Filament with the Article Number"
}
```
### Required Fields
- **`b`** (brand): Manufacturer/brand name
- **`an`** (article number): Unique product identifier
- **`t`** (type): Material type (PLA, PETG, ABS, etc.)
- **`c`** (color): Hex color code without #
- **`cn`** (color name): Human-readable color name
- **`et`** (extruder temp): Recommended extruder temperature in Celsius
- **`bt`** (bed temp): Recommended bed temperature in Celsius
- **`di`** (diameter): Filament diameter in mm
- **`de`** (density): Material density in g/cm³
- **`sw`** (spool weight): Empty spool weight in grams
### Optional Fields
- **`mc`** (multicolor): Comma-separated hex colors for multicolor filaments
- **`mcd`** (multicolor direction): Direction for multicolor (coaxial, longitudinal)
- **`u`** (url): Product URL with direct link to the article e.g. for reordering
### Example Tag
```json
{"b":"Recycling Fabrik","an":"FX1_PETG-S175-1000-DAEM00055","t":"PETG","c":"FF5733","cn":"Vibrant Orange","et":"230","bt":"70","di":"1.75","de":"1.24","sw":"180","u":"https://www.recyclingfabrik.com/search?q="}
```
## Implementation Guidelines
### For Manufacturers
1. **Tag Encoding**: Use NDEF format with MIME type `application/json`
2. **Data Minimization**: Use the compact JSON format to fit within tag size limits
3. **Quality Control**: Ensure all required fields are present and correctly formatted
4. **Testing**: Verify tags work with FilaMan system before production
### Tag Size Considerations
- **NTAG213**: 144 bytes user data (suitable for basic tags)
- **NTAG215**: 504 bytes user data (recommended for comprehensive data)
- **NTAG216**: 888 bytes user data (maximum compatibility)
### Best Practices
- Keep brand names consistent across all products
- Use standardized material type names (PLA, PETG, ABS, etc.)
- Provide accurate temperature recommendations
- Include meaningful color names for user experience
- Test tags with the FilaMan system before mass production
## System Integration
### Spoolman Database Structure
When a manufacturer tag is processed, the system creates:
1. **Vendor Entry**: Brand information in Spoolman vendor database
2. **Filament Entry**: Material specifications and properties
3. **Spool Entry**: Individual spool with weight and NFC tag reference
### Fast-Path Recognition
Once a tag is processed and updated with `sm_id`, it uses the fast-path recognition system for quick subsequent scans.
## Troubleshooting
### Common Issues
- **Tag Too Small**: Use NTAG215 or NTAG216 for larger JSON payloads
- **Missing Fields**: Ensure all required fields are present
- **Invalid Format**: Verify JSON syntax and field types
- **Spoolman Connection**: Ensure FilaMan can connect to Spoolman API
### Validation
The system validates:
- JSON format correctness
- Required field presence
- Data type compliance
- Tag size compatibility
## Technical Details
### Processing Algorithm
1. Tag scan detects no `sm_id` field
2. System checks for `b` (brand) and `an` (article number) fields
3. `checkVendor()` creates or finds brand in Spoolman
4. `checkFilament()` creates or finds filament type
5. `createSpool()` creates new spool entry
6. Tag is updated with new `sm_id`
### Error Handling
- Graceful fallback for network issues
- Detailed logging for debugging
- User feedback for failed operations
- Retry mechanisms for temporary failures
This system enables seamless integration of manufacturer filament products into the FilaMan ecosystem while maintaining data consistency and user experience.

View File

@@ -9,8 +9,8 @@
; https://docs.platformio.org/page/projectconf.html
[common]
version = "1.5.12-beta14"
to_old_version = "1.5.0"
version = "2.0.0-beta4"
to_old_version = "1.5.10"
##
[env:esp32dev]

View File

@@ -9,18 +9,6 @@
#include <time.h>
volatile spoolmanApiStateType spoolmanApiState = API_IDLE;
// Returns current date and time in ISO8601 format
String getCurrentDateISO8601() {
struct tm timeinfo;
if(!getLocalTime(&timeinfo)) {
Serial.println("Failed to obtain time");
return "1970-01-01T00:00:00Z";
}
char timeStringBuff[25];
strftime(timeStringBuff, sizeof(timeStringBuff), "%Y-%m-%dT%H:%M:%SZ", &timeinfo);
return String(timeStringBuff);
}
//bool spoolman_connected = false;
String spoolmanUrl = "";
bool octoEnabled = false;
@@ -170,7 +158,8 @@ void sendToApi(void *parameter) {
//oledShowMessage("Remaining: " + String(remaining_weight) + "g");
if(!octoEnabled){
// TBD: Do not use Strings...
oledShowProgressBar(1, 1, "Spool Tag", ("Done: " + String(remainingWeight) + " g remain").c_str());
//oledShowProgressBar(1, 1, "Spool Tag", ("Done: " + String(remainingWeight) + " g remain").c_str());
oledShowMessage("Remaining: " + String(remainingWeight) + "g");
remainingWeight = 0;
}else{
// ocoto is enabled, trigger octo update
@@ -185,7 +174,8 @@ void sendToApi(void *parameter) {
break;
case API_REQUEST_OCTO_SPOOL_UPDATE:
// TBD: Do not use Strings...
oledShowProgressBar(5, 5, "Spool Tag", ("Done: " + String(remainingWeight) + " g remain").c_str());
//oledShowProgressBar(5, 5, "Spool Tag", ("Done: " + String(remainingWeight) + " g remain").c_str());
oledShowMessage("Remaining: " + String(remainingWeight) + "g");
remainingWeight = 0;
break;
case API_REQUEST_VENDOR_CREATE:
@@ -613,7 +603,9 @@ bool updateSpoolBambuData(String payload) {
}
// #### Brand Filament
uint16_t createVendor(String vendor) {
uint16_t createVendor(const JsonDocument& payload) {
oledShowProgressBar(2, 5, "New Brand", "Create new Vendor");
// Create new vendor in Spoolman database using task system
// Note: Due to async nature, the ID will be stored in createdVendorId global variable
// Note: This function assumes that the caller has already ensured API is IDLE
@@ -625,10 +617,24 @@ uint16_t createVendor(String vendor) {
// Create JSON payload for vendor creation
JsonDocument vendorDoc;
vendorDoc["name"] = vendor;
vendorDoc["comment"] = "automatically generated";
vendorDoc["empty_spool_weight"] = 180;
vendorDoc["external_id"] = vendor;
vendorDoc["name"] = payload["b"].as<String>();
// Extract domain from URL if present, otherwise use brand name
String externalId = "";
if (payload["u"].is<String>()) {
String url = payload["u"].as<String>();
// Extract domain from URL (e.g., "https://www.blubb.de/f1234/?suche=irgendwas" -> "https://www.blubb.de")
int protocolEnd = url.indexOf("://");
if (protocolEnd != -1) {
int pathStart = url.indexOf("/", protocolEnd + 3);
externalId = (pathStart != -1) ? url.substring(0, pathStart) : url;
} else {
externalId = url; // No protocol found, use as is
}
} else {
externalId = payload["b"].as<String>();
}
vendorDoc["comment"] = externalId;
String vendorPayload;
serializeJson(vendorDoc, vendorPayload);
@@ -665,6 +671,9 @@ uint16_t createVendor(String vendor) {
vendorDoc.clear();
// Delay for Display Bar
vTaskDelay(1000 / portTICK_PERIOD_MS);
// Wait for task completion and return the created vendor ID
// Note: createdVendorId will be set by sendToApi when response is received
while(createdVendorId == 65535) {
@@ -674,11 +683,13 @@ uint16_t createVendor(String vendor) {
return createdVendorId;
}
uint16_t checkVendor(String vendor) {
uint16_t checkVendor(const JsonDocument& payload) {
oledShowProgressBar(1, 5, "New Brand", "Check Vendor");
// Check if vendor exists using task system
foundVendorId = 65535; // Reset to invalid value to detect when API response is received
String vendorName = vendor;
String vendorName = payload["b"].as<String>();
vendorName.trim();
vendorName.replace(" ", "+");
String spoolsUrl = spoolmanUrl + apiUrl + "/vendor?name=" + vendorName;
@@ -720,7 +731,7 @@ uint16_t checkVendor(String vendor) {
// Check if vendor was found
if (foundVendorId == 0) {
Serial.println("Vendor not found, creating new vendor...");
uint16_t vendorId = createVendor(vendor);
uint16_t vendorId = createVendor(payload);
if (vendorId == 0) {
Serial.println("Failed to create vendor, returning 0.");
return 0; // Failed to create vendor
@@ -729,7 +740,7 @@ uint16_t checkVendor(String vendor) {
return vendorId;
}
} else {
Serial.println("Vendor found: " + vendor);
Serial.println("Vendor found: " + payload["b"].as<String>());
Serial.print("Vendor ID: ");
Serial.println(foundVendorId);
return foundVendorId;
@@ -737,6 +748,8 @@ uint16_t checkVendor(String vendor) {
}
uint16_t createFilament(uint16_t vendorId, const JsonDocument& payload) {
oledShowProgressBar(4, 5, "New Brand", "Create Filament");
// Create new filament in Spoolman database using task system
// Note: Due to async nature, the ID will be stored in createdFilamentId global variable
// Note: This function assumes that the caller has already ensured API is IDLE
@@ -748,34 +761,34 @@ uint16_t createFilament(uint16_t vendorId, const JsonDocument& payload) {
// Create JSON payload for filament creation
JsonDocument filamentDoc;
filamentDoc["name"] = payload["color_name"].as<String>();
filamentDoc["name"] = payload["cn"].as<String>();
filamentDoc["vendor_id"] = String(vendorId);
filamentDoc["material"] = payload["type"].as<String>();
filamentDoc["density"] = (payload["density"].is<String>() && payload["density"].as<String>().length() > 0) ? payload["density"].as<String>() : "1.24";
filamentDoc["diameter"] = (payload["diameter"].is<String>() && payload["diameter"].as<String>().length() > 0) ? payload["diameter"].as<String>() : "1.75";
filamentDoc["material"] = payload["t"].as<String>();
filamentDoc["density"] = (payload["de"].is<String>() && payload["de"].as<String>().length() > 0) ? payload["de"].as<String>() : "1.24";
filamentDoc["diameter"] = (payload["di"].is<String>() && payload["di"].as<String>().length() > 0) ? payload["di"].as<String>() : "1.75";
filamentDoc["weight"] = String(weight);
filamentDoc["spool_weight"] = payload["spool_weight"].as<String>();
filamentDoc["article_number"] = payload["artnr"].as<String>();
filamentDoc["settings_extruder_temp"] = payload["extruder_temp"].is<String>() ? payload["extruder_temp"].as<String>() : "";
filamentDoc["settings_bed_temp"] = payload["bed_temp"].is<String>() ? payload["bed_temp"].as<String>() : "";
if (payload["artnr"].is<String>())
filamentDoc["spool_weight"] = payload["sw"].as<String>();
filamentDoc["article_number"] = payload["an"].as<String>();
filamentDoc["settings_extruder_temp"] = payload["et"].is<String>() ? payload["et"].as<String>() : "";
filamentDoc["settings_bed_temp"] = payload["bt"].is<String>() ? payload["bt"].as<String>() : "";
if (payload["an"].is<String>())
{
filamentDoc["external_id"] = payload["artnr"].as<String>();
filamentDoc["comment"] = payload["url"].is<String>() ? payload["url"].as<String>() + payload["artnr"].as<String>() : "automatically generated";
filamentDoc["external_id"] = payload["an"].as<String>();
filamentDoc["comment"] = payload["u"].is<String>() ? payload["u"].as<String>() + payload["an"].as<String>() : "automatically generated";
}
else
{
filamentDoc["comment"] = payload["url"].is<String>() ? payload["url"].as<String>() : "automatically generated";
filamentDoc["comment"] = payload["u"].is<String>() ? payload["u"].as<String>() : "automatically generated";
}
if (payload["multi_color_hexes"].is<String>()) {
filamentDoc["multi_color_hexes"] = payload["multi_color_hexes"].as<String>();
filamentDoc["multi_color_direction"] = payload["multi_color_direction"].is<String>() ? payload["multi_color_direction"].as<String>() : "";
if (payload["mc"].is<String>()) {
filamentDoc["multi_color_hexes"] = payload["mc"].as<String>();
filamentDoc["multi_color_direction"] = payload["mcd"].is<String>() ? payload["mcd"].as<String>() : "";
}
else
{
filamentDoc["color_hex"] = (payload["color_hex"].is<String>() && payload["color_hex"].as<String>().length() >= 6) ? payload["color_hex"].as<String>() : "FFFFFF";
filamentDoc["color_hex"] = (payload["c"].is<String>() && payload["c"].as<String>().length() >= 6) ? payload["c"].as<String>() : "FFFFFF";
}
String filamentPayload;
@@ -813,6 +826,9 @@ uint16_t createFilament(uint16_t vendorId, const JsonDocument& payload) {
filamentDoc.clear();
// Delay for Display Bar
vTaskDelay(1000 / portTICK_PERIOD_MS);
// Wait for task completion and return the created filament ID
// Note: createdFilamentId will be set by sendToApi when response is received
while(createdFilamentId == 65535) {
@@ -823,6 +839,8 @@ uint16_t createFilament(uint16_t vendorId, const JsonDocument& payload) {
}
uint16_t checkFilament(uint16_t vendorId, const JsonDocument& payload) {
oledShowProgressBar(3, 5, "New Brand", "Check Filament");
// Check if filament exists using task system
foundFilamentId = 65535; // Reset to invalid value to detect when API response is received
@@ -875,6 +893,8 @@ uint16_t checkFilament(uint16_t vendorId, const JsonDocument& payload) {
}
uint16_t createSpool(uint16_t vendorId, uint16_t filamentId, JsonDocument& payload, String uidString) {
oledShowProgressBar(5, 5, "New Brand", "Create new Spool");
// Create new spool in Spoolman database using task system
// Note: Due to async nature, the ID will be stored in createdSpoolId global variable
// Note: This function assumes that the caller has already ensured API is IDLE
@@ -883,17 +903,14 @@ uint16_t createSpool(uint16_t vendorId, uint16_t filamentId, JsonDocument& paylo
String spoolsUrl = spoolmanUrl + apiUrl + "/spool";
Serial.print("Create spool with URL: ");
Serial.println(spoolsUrl);
//String currentDate = getCurrentDateISO8601();
// Create JSON payload for spool creation
JsonDocument spoolDoc;
//spoolDoc["first_used"] = String(currentDate);
//spoolDoc["last_used"] = String(currentDate);
spoolDoc["filament_id"] = String(filamentId);
spoolDoc["initial_weight"] = weight > 10 ? String(weight-payload["spool_weight"].as<int>()) : "1000";
spoolDoc["spool_weight"] = (payload["spool_weight"].is<String>() && payload["spool_weight"].as<String>().length() > 0) ? payload["spool_weight"].as<String>() : "180";
spoolDoc["remaining_weight"] = (payload["weight"].is<String>() && payload["weight"].as<String>().length() > 0) ? payload["weight"].as<String>() : "1000";
spoolDoc["lot_nr"] = (payload["lotnr"].is<String>() && payload["lotnr"].as<String>().length() > 0) ? payload["lotnr"].as<String>() : "";
spoolDoc["initial_weight"] = weight > 10 ? String(weight - payload["sw"].as<int>()) : "1000";
spoolDoc["spool_weight"] = (payload["sw"].is<String>() && payload["sw"].as<String>().length() > 0) ? payload["sw"].as<String>() : "180";
spoolDoc["remaining_weight"] = spoolDoc["initial_weight"];
spoolDoc["lot_nr"] = (payload["an"].is<String>() && payload["an"].as<String>().length() > 0) ? payload["an"].as<String>() : "";
spoolDoc["comment"] = "automatically generated";
spoolDoc["extra"]["nfc_id"] = "\"" + uidString + "\"";
@@ -942,13 +959,8 @@ uint16_t createSpool(uint16_t vendorId, uint16_t filamentId, JsonDocument& paylo
// Create optimized JSON structure with sm_id at the beginning for fast-path detection
JsonDocument optimizedPayload;
optimizedPayload["sm_id"] = String(createdSpoolId); // Place sm_id first for fast scanning
// Copy all other fields from original payload (excluding sm_id if it exists)
for (JsonPair kv : payload.as<JsonObject>()) {
if (strcmp(kv.key().c_str(), "sm_id") != 0) { // Skip sm_id to avoid duplication
optimizedPayload[kv.key()] = kv.value();
}
}
optimizedPayload["b"] = payload["b"].as<String>();
optimizedPayload["cn"] = payload["an"].as<String>();
String payloadString;
serializeJson(optimizedPayload, payloadString);
@@ -959,14 +971,17 @@ uint16_t createSpool(uint16_t vendorId, uint16_t filamentId, JsonDocument& paylo
optimizedPayload.clear();
nfcReaderState = NFC_IDLE;
vTaskDelay(50 / portTICK_PERIOD_MS);
// Delay for Display Bar
vTaskDelay(1000 / portTICK_PERIOD_MS);
startWriteJsonToTag(true, payloadString.c_str());
return createdSpoolId;
}
bool createBrandFilament(JsonDocument& payload, String uidString) {
uint16_t vendorId = checkVendor(payload["brand"].as<String>());
uint16_t vendorId = checkVendor(payload);
if (vendorId == 0) {
Serial.println("ERROR: Failed to create/find vendor");
return false;

View File

@@ -235,7 +235,7 @@ void oledShowIcon(const char* icon) {
display.display();
}
void oledShowProgressBar(const uint8_t step, const uint8_t numSteps, const char* largeText, const char* statusMessage){
void oledShowProgressBar(const uint8_t step, const uint8_t numSteps, const char* largeText, const char* statusMessage) {
assert(step <= numSteps);
// clear data and bar area

File diff suppressed because it is too large Load Diff

View File

@@ -24,6 +24,7 @@ extern String activeSpoolId;
extern String lastSpoolId;
extern volatile nfcReaderStateType nfcReaderState;
extern volatile bool pauseBambuMqttTask;
extern volatile bool nfcWriteInProgress;
extern bool tagProcessed;

View File

@@ -48,9 +48,6 @@ void scale_loop(void * parameter) {
Serial.println("Scale Loop started");
Serial.println("++++++++++++++++++++++++++++++");
vTaskDelay(pdMS_TO_TICKS(500));
scale_tare_counter = 10; // damit beim Starten der Waage automatisch getart wird
for(;;) {
if (scale.is_ready())
{
@@ -114,18 +111,20 @@ void start_scale(bool touchSensorConnected) {
scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);
oledShowProgressBar(6, 7, DISPLAY_BOOT_TEXT, "Tare scale");
for (uint16_t i = 0; i < 2000; i++) {
for (uint16_t i = 0; i < 3000; i++) {
yield();
vTaskDelay(pdMS_TO_TICKS(1));
esp_task_wdt_reset();
}
if (scale.wait_ready_timeout(1000))
{
scale.set_scale(calibrationValue); // this value is obtained by calibrating the scale with known weights; see the README for details
//scale.tare();
while(!scale.is_ready()) {
vTaskDelay(pdMS_TO_TICKS(5000));
}
scale.set_scale(calibrationValue);
vTaskDelay(pdMS_TO_TICKS(5000));
scale.tare();
// Display Gewicht
oledShowWeight(0);