From 4f5fdb7af4bf92d09a91c0364bc51a317cb44233 Mon Sep 17 00:00:00 2001 From: Marcel Peterkau Date: Wed, 24 Aug 2022 23:08:29 +0200 Subject: [PATCH] corrected Tank-Lvel-Calculation --- Software/src/common.h | 14 ++++++++++++++ Software/src/config.h | 4 ++-- Software/src/lubeapp.cpp | 2 +- Software/src/lubeapp.h | 4 ---- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/Software/src/common.h b/Software/src/common.h index 822f39d..ebc391c 100644 --- a/Software/src/common.h +++ b/Software/src/common.h @@ -35,6 +35,20 @@ #define OTA_DELAY 50 // ticks -> 10ms / tick #endif +#define LUBE_PULSE_LENGHT_MS 160 +#define LUBE_PULSE_PAUSE_MS 340 + +// -> 2Hz PumpPulse +// -> 49,7cc / h @ 2Hz +// -> 49,7 ml / h @ 2Hz +// -> 828,4µl / min @ 2Hz +// -> 828,3µl / 60s +// -> 13,81µl / 1s +// -> 6,90µl / Pulse + +#define DEFAULT_PUMP_DOSE 7 + +#define STARTUP_DELAY 5000 #define SHUTDOWN_DELAY_MS 5000 #define ATOMIC_FS_UPDATE diff --git a/Software/src/config.h b/Software/src/config.h index 21ab690..2f31afd 100644 --- a/Software/src/config.h +++ b/Software/src/config.h @@ -76,7 +76,7 @@ typedef struct uint32_t DistancePerLube_Default = 8000; uint32_t DistancePerLube_Rain = 4000; uint32_t tankCapacity_ml = 320; - uint32_t amountPerDose_µl = 72; + uint32_t amountPerDose_µl = DEFAULT_PUMP_DOSE; uint8_t TankRemindAtPercentage = 30; uint8_t PulsePerRevolution = 1; uint32_t TireWidth_mm = 150; @@ -95,7 +95,7 @@ typedef struct } LubeConfig_t; const LubeConfig_t LubeConfig_defaults{ - 0, 8000, 4000, 320, 72, 30, 1, 150, 70, 18, 2000, 25, SOURCE_IMPULSE, + 0, 8000, 4000, 320, DEFAULT_PUMP_DOSE, 30, 1, 150, 70, 18, 2000, 25, SOURCE_IMPULSE, #ifdef FEATURE_ENABLE_GPS BAUD_115200, #endif diff --git a/Software/src/lubeapp.cpp b/Software/src/lubeapp.cpp index 8c4e09d..f6e47e2 100644 --- a/Software/src/lubeapp.cpp +++ b/Software/src/lubeapp.cpp @@ -5,7 +5,7 @@ uint32_t lubePulseTimestamp = 0; void RunLubeApp(uint32_t add_milimeters) { - globals.TankPercentage = PersistenceData.tankRemain_µl / (LubeConfig.tankCapacity_ml * 1000); + globals.TankPercentage = PersistenceData.tankRemain_µl / (LubeConfig.tankCapacity_ml * 10); MaintainDTC(DTC_TANK_EMPTY, DTC_CRITICAL, (PersistenceData.tankRemain_µl < LubeConfig.amountPerDose_µl)); MaintainDTC(DTC_TANK_LOW, DTC_WARN, (globals.TankPercentage < LubeConfig.TankRemindAtPercentage)); diff --git a/Software/src/lubeapp.h b/Software/src/lubeapp.h index 5f351fe..21d0ad3 100644 --- a/Software/src/lubeapp.h +++ b/Software/src/lubeapp.h @@ -8,10 +8,6 @@ #include "globals.h" #include "dtc.h" -#define LUBE_PULSE_LENGHT_MS 160 -#define LUBE_PULSE_PAUSE_MS 100 -#define STARTUP_DELAY 5000 - void RunLubeApp(uint32_t add_milimeters); void LubePulse();