Compare commits

..

No commits in common. "a77918da41547c347b5c605c550c3f8fc4837735" and "1de283b62fe03b8609a105beb965f790c0c3338a" have entirely different histories.

5 changed files with 43 additions and 42 deletions

View File

@ -74,20 +74,23 @@ jobs:
# Copy firmware binary # Copy firmware binary
cp .pio/build/esp32dev/firmware.bin .pio/build/esp32dev/filaman_${VERSION}.bin cp .pio/build/esp32dev/firmware.bin .pio/build/esp32dev/filaman_${VERSION}.bin
# Always create SPIFFS binary # Copy SPIFFS binary if SPIFFS changed
cp .pio/build/esp32dev/spiffs.bin .pio/build/esp32dev/webpage_${VERSION}.bin if [[ "${{ steps.check_spiffs.outputs.SPIFFS_CHANGED }}" == "true" ]]; then
echo "SPIFFS changes detected, copying SPIFFS binary..."
cp .pio/build/esp32dev/spiffs.bin .pio/build/esp32dev/webpage_${VERSION}.bin
fi
# Create full binary (always) # Create full binary (always)
(cd .pio/build/esp32dev && (cd .pio/build/esp32dev && \
esptool.py --chip esp32 merge_bin esptool.py --chip esp32 merge_bin \
--fill-flash-size 4MB --fill-flash-size 4MB \
--flash_mode dio --flash_mode dio \
--flash_freq 40m --flash_freq 40m \
--flash_size 4MB --flash_size 4MB \
-o filaman_full_${VERSION}.bin -o filaman_full_${VERSION}.bin \
0x0000 bootloader.bin 0x0000 bootloader.bin \
0x8000 partitions.bin 0x8000 partitions.bin \
0x10000 firmware.bin 0x10000 firmware.bin \
0x390000 spiffs.bin) 0x390000 spiffs.bin)
# Verify file sizes # Verify file sizes

View File

@ -60,8 +60,11 @@ jobs:
# Copy firmware binary # Copy firmware binary
cp .pio/build/esp32dev/firmware.bin .pio/build/esp32dev/filaman_${VERSION}.bin cp .pio/build/esp32dev/firmware.bin .pio/build/esp32dev/filaman_${VERSION}.bin
# Always create SPIFFS binary # Copy SPIFFS binary if SPIFFS changed
cp .pio/build/esp32dev/spiffs.bin .pio.build/esp32dev/webpage_${VERSION}.bin if [[ "${{ steps.check_spiffs.outputs.SPIFFS_CHANGED }}" == "true" ]]; then
echo "SPIFFS changes detected, copying SPIFFS binary..."
cp .pio/build/esp32dev/spiffs.bin .pio/build/esp32dev/webpage_${VERSION}.bin
fi
# Create full binary (always) # Create full binary (always)
(cd .pio/build/esp32dev && \ (cd .pio/build/esp32dev && \
@ -76,6 +79,12 @@ jobs:
0x10000 firmware.bin \ 0x10000 firmware.bin \
0x390000 spiffs.bin) 0x390000 spiffs.bin)
# Only copy SPIFFS binary if data changed
if [[ "${{ steps.check_data.outputs.DATA_CHANGED }}" == "true" ]]; then
echo "Data changes detected, copying SPIFFS binary..."
cp .pio/build/esp32dev/spiffs.bin .pio/build/esp32dev/webpage_${VERSION}.bin
fi
# Verify file sizes # Verify file sizes
echo "File sizes:" echo "File sizes:"
(cd .pio/build/esp32dev && ls -lh *.bin) (cd .pio/build/esp32dev && ls -lh *.bin)

View File

@ -1,12 +1,5 @@
# Changelog # Changelog
## [1.2.101] - 2025-02-21
### Changed
- update webpages for version v1.2.101
- always create SPIFFS binary in release workflows
- migrate calibration value storage from EEPROM to NVS
## [1.2.100] - 2025-02-21 ## [1.2.100] - 2025-02-21
### Changed ### Changed
- update webpages for version v1.2.100 - update webpages for version v1.2.100

View File

@ -9,7 +9,7 @@
; https://docs.platformio.org/page/projectconf.html ; https://docs.platformio.org/page/projectconf.html
[common] [common]
version = "1.2.101" version = "1.2.100"
[env:esp32dev] [env:esp32dev]
platform = espressif32 platform = espressif32

View File

@ -3,9 +3,9 @@
#include <ArduinoJson.h> #include <ArduinoJson.h>
#include "config.h" #include "config.h"
#include "HX711.h" #include "HX711.h"
#include <EEPROM.h>
#include "display.h" #include "display.h"
#include "esp_task_wdt.h" #include "esp_task_wdt.h"
#include <Preferences.h>
HX711 scale; HX711 scale;
@ -17,10 +17,6 @@ uint8_t weigthCouterToApi = 0;
uint8_t scale_tare_counter = 0; uint8_t scale_tare_counter = 0;
uint8_t pauseMainTask = 0; uint8_t pauseMainTask = 0;
Preferences preferences;
const char* NVS_NAMESPACE = "scale";
const char* NVS_KEY_CALIBRATION = "cal_value";
// ##### Funktionen für Waage ##### // ##### Funktionen für Waage #####
uint8_t tareScale() { uint8_t tareScale() {
Serial.println("Tare scale"); Serial.println("Tare scale");
@ -52,12 +48,13 @@ void scale_loop(void * parameter) {
void start_scale() { void start_scale() {
Serial.println("Prüfe Calibration Value"); Serial.println("Prüfe Calibration Value");
long calibrationValue; long calibrationValue; // calibration value (see example file "Calibration.ino")
//calibrationValue = 696.0; // uncomment this if you want to set the calibration value in the sketch
// NVS EEPROM.begin(512);
preferences.begin(NVS_NAMESPACE, true); // true = readonly EEPROM.get(calVal_eepromAdress, calibrationValue); // uncomment this if you want to fetch the calibration value from eeprom
calibrationValue = preferences.getLong(NVS_KEY_CALIBRATION, defaultScaleCalibrationValue);
preferences.end(); //calibrationValue = EEPROM.read(calVal_eepromAdress);
Serial.print("Read Scale Calibration Value "); Serial.print("Read Scale Calibration Value ");
Serial.println(calibrationValue); Serial.println(calibrationValue);
@ -140,19 +137,18 @@ uint8_t calibrate_scale() {
{ {
Serial.print("New calibration value has been set to: "); Serial.print("New calibration value has been set to: ");
Serial.println(newCalibrationValue); Serial.println(newCalibrationValue);
Serial.print("Save this value to EEPROM adress ");
Serial.println(calVal_eepromAdress);
// Speichern mit NVS //EEPROM.put(calVal_eepromAdress, newCalibrationValue);
preferences.begin(NVS_NAMESPACE, false); // false = readwrite EEPROM.put(calVal_eepromAdress, newCalibrationValue);
preferences.putLong(NVS_KEY_CALIBRATION, newCalibrationValue); EEPROM.commit();
preferences.end();
// Verifizieren EEPROM.get(calVal_eepromAdress, newCalibrationValue);
preferences.begin(NVS_NAMESPACE, true); //newCalibrationValue = EEPROM.read(calVal_eepromAdress);
long verifyValue = preferences.getLong(NVS_KEY_CALIBRATION, 0);
preferences.end();
Serial.print("Verified stored value: "); Serial.print("Read Value ");
Serial.println(verifyValue); Serial.println(newCalibrationValue);
Serial.println("End calibration, revome weight"); Serial.println("End calibration, revome weight");