Compare commits

..

7 Commits

Author SHA1 Message Date
74aaedd72d fix typo 2025-10-15 16:03:07 +02:00
4dff77e75d docs: update changelog and header for version v2.0.9
Some checks failed
Release Workflow / detect-provider (push) Successful in 5s
Release Workflow / github-release (push) Has been skipped
Release Workflow / gitea-release (push) Failing after 2m24s
2025-10-15 15:53:44 +02:00
907765bcaa docs: update platformio.ini for version v2.0.9 2025-10-15 15:53:44 +02:00
b867aade7d docs: update changelog and header for version v2.0.8
Some checks failed
Release Workflow / detect-provider (push) Successful in 1m9s
Release Workflow / github-release (push) Has been skipped
Release Workflow / gitea-release (push) Failing after 2m39s
2025-10-15 15:43:54 +02:00
36771235ad docs: update platformio.ini for version v2.0.8 2025-10-15 15:43:53 +02:00
47470eb944 Merge pull request #51 from Anzarion/main
Fix: Add NULL checks to prevent crash without RFID module
2025-10-15 15:37:20 +02:00
Anzarion
e1da8eb525 Fix: Add NULL checks to prevent crash without RFID module
- Added NULL checks before vTaskSuspend/vTaskResume in scale.cpp
- Prevents crash when calibrating without RFID module connected
- Allows scale to work as standalone device without RFID
2025-09-30 10:37:58 +02:00
5 changed files with 22 additions and 12 deletions

View File

@@ -1,5 +1,15 @@
# Changelog # Changelog
## [2.0.9] - 2025-10-15
## [2.0.8] - 2025-10-15
### Added
- Fix: Add NULL checks to prevent crash without RFID module
### Changed
- Merge pull request #51 from Anzarion/main
## [2.0.7] - 2025-09-13 ## [2.0.7] - 2025-09-13
### Added ### Added
- add HTTP service to mDNS responder - add HTTP service to mDNS responder

View File

@@ -9,7 +9,7 @@
; https://docs.platformio.org/page/projectconf.html ; https://docs.platformio.org/page/projectconf.html
[common] [common]
version = "2.0.7" version = "2.0.9"
to_old_version = "1.5.10" to_old_version = "1.5.10"
## ##

View File

@@ -203,11 +203,11 @@ void loop() {
// Prüfen ob das Gewicht gleich bleibt und dann senden // Prüfen ob das Gewicht gleich bleibt und dann senden
if (abs(weight - lastWeight) <= 2 && weight > 5) if (abs(weight - lastWeight) <= 2 && weight > 5)
{ {
weigthCouterToApi++; weightCounterToApi++;
} }
else else
{ {
weigthCouterToApi = 0; weightCounterToApi = 0;
weightSend = 0; weightSend = 0;
} }
} }
@@ -215,13 +215,13 @@ void loop() {
// reset weight counter after writing tag // reset weight counter after writing tag
if (currentMillis - lastWeightReadTime >= weightReadInterval && nfcReaderState != NFC_IDLE && nfcReaderState != NFC_READ_SUCCESS) if (currentMillis - lastWeightReadTime >= weightReadInterval && nfcReaderState != NFC_IDLE && nfcReaderState != NFC_READ_SUCCESS)
{ {
weigthCouterToApi = 0; weightCounterToApi = 0;
} }
lastWeight = weight; lastWeight = weight;
// Wenn ein Tag mit SM id erkannte wurde und der Waage Counter anspricht an SM Senden // Wenn ein Tag mit SM id erkannte wurde und der Waage Counter anspricht an SM Senden
if (activeSpoolId != "" && weigthCouterToApi > 3 && weightSend == 0 && nfcReaderState == NFC_READ_SUCCESS && tagProcessed == false && spoolmanApiState == API_IDLE) if (activeSpoolId != "" && weightCounterToApi > 3 && weightSend == 0 && nfcReaderState == NFC_READ_SUCCESS && tagProcessed == false && spoolmanApiState == API_IDLE)
{ {
// set the current tag as processed to prevent it beeing processed again // set the current tag as processed to prevent it beeing processed again
tagProcessed = true; tagProcessed = true;
@@ -248,7 +248,7 @@ void loop() {
} }
// Handle successful tag write: Send weight to Spoolman but NEVER auto-send to Bambu // Handle successful tag write: Send weight to Spoolman but NEVER auto-send to Bambu
if (activeSpoolId != "" && weigthCouterToApi > 3 && weightSend == 0 && nfcReaderState == NFC_WRITE_SUCCESS && tagProcessed == false && spoolmanApiState == API_IDLE) if (activeSpoolId != "" && weightCounterToApi > 3 && weightSend == 0 && nfcReaderState == NFC_WRITE_SUCCESS && tagProcessed == false && spoolmanApiState == API_IDLE)
{ {
// set the current tag as processed to prevent it beeing processed again // set the current tag as processed to prevent it beeing processed again
tagProcessed = true; tagProcessed = true;

View File

@@ -28,7 +28,7 @@ int16_t lastDisplayedWeight = 0;
int16_t lastStableWeight = 0; // For API/action triggering int16_t lastStableWeight = 0; // For API/action triggering
unsigned long lastMeasurementTime = 0; unsigned long lastMeasurementTime = 0;
uint8_t weigthCouterToApi = 0; uint8_t weightCounterToApi = 0;
uint8_t scale_tare_counter = 0; uint8_t scale_tare_counter = 0;
bool scaleTareRequest = false; bool scaleTareRequest = false;
uint8_t pauseMainTask = 0; uint8_t pauseMainTask = 0;
@@ -285,8 +285,8 @@ uint8_t calibrate_scale() {
scaleCalibrationActive = true; scaleCalibrationActive = true;
vTaskSuspend(RfidReaderTask); if (RfidReaderTask != NULL) vTaskSuspend(RfidReaderTask);
vTaskSuspend(ScaleTask); if (ScaleTask != NULL) vTaskSuspend(ScaleTask);
pauseBambuMqttTask = true; pauseBambuMqttTask = true;
pauseMainTask = 1; pauseMainTask = 1;
@@ -393,8 +393,8 @@ uint8_t calibrate_scale() {
returnState = 0; returnState = 0;
} }
vTaskResume(RfidReaderTask); if (RfidReaderTask != NULL) vTaskResume(RfidReaderTask);
vTaskResume(ScaleTask); if (ScaleTask != NULL) vTaskResume(ScaleTask);
pauseBambuMqttTask = false; pauseBambuMqttTask = false;
pauseMainTask = 0; pauseMainTask = 0;
scaleCalibrationActive = false; scaleCalibrationActive = false;

View File

@@ -18,7 +18,7 @@ int16_t getFilteredDisplayWeight();
extern HX711 scale; extern HX711 scale;
extern int16_t weight; extern int16_t weight;
extern uint8_t weigthCouterToApi; extern uint8_t weightCounterToApi;
extern uint8_t scale_tare_counter; extern uint8_t scale_tare_counter;
extern uint8_t scaleTareRequest; extern uint8_t scaleTareRequest;
extern uint8_t pauseMainTask; extern uint8_t pauseMainTask;