some tweaks regarding washMode and Debugger

This commit is contained in:
2025-06-15 21:17:32 +02:00
parent 68d571a747
commit b6f9de2894
5 changed files with 193 additions and 89 deletions

View File

@@ -43,7 +43,6 @@
#include "button_actions.h"
#include "ledcontrol.h"
#ifdef FEATURE_ENABLE_WIFI_CLIENT
#include <ESP8266WiFiMulti.h>
@@ -260,7 +259,8 @@ void loop()
DTC_Process();
Debug_Process();
if (globals.toggle_wifi == true){
if (globals.toggle_wifi == true)
{
globals.toggle_wifi = false;
toggleWiFiAP();
@@ -339,12 +339,19 @@ void EEPROMCyclicPDS_callback()
* This ISR is called whenever a pulse is detected from the wheel speed sensor. It increments
* the `wheel_pulse` variable, which is used to track the number of pulses received.
*/
void trigger_ISR()
volatile uint32_t lastTriggerMicros = 0;
void IRAM_ATTR trigger_ISR()
{
uint32_t now = micros();
if (now - lastTriggerMicros < 2500)
return;
lastTriggerMicros = now;
globals.isr_debug++;
wheel_pulse++;
}
#ifdef FEATURE_ENABLE_OLED
/**
* @brief Manages the display content based on the current system status and updates the OLED display.
@@ -372,7 +379,19 @@ void Display_Process()
u8x8.setCursor(0, 1);
// Calculate remaining lubrication distance based on system mode
uint32_t DistRemain = globals.systemStatus == sysStat_Normal ? LubeConfig.DistancePerLube_Default : LubeConfig.DistancePerLube_Rain;
uint32_t DistRemain = 0;
switch (globals.systemStatus)
{
case sysStat_Normal:
DistRemain = LubeConfig.DistancePerLube_Default;
break;
case sysStat_Rain:
DistRemain = LubeConfig.DistancePerLube_Rain;
break;
case sysStat_Wash:
DistRemain = LubeConfig.WashMode_Interval;
break;
}
DistRemain = DistRemain - (PersistenceData.TravelDistance_highRes_mm / 1000);
// Display relevant information on the OLED screen based on system status
@@ -479,36 +498,6 @@ void SystemShutdown(bool restart)
}
}
void onToggleMode()
{
if (globals.systemStatus == sysStat_Normal)
{
globals.systemStatus = sysStat_Rain;
globals.resumeStatus = sysStat_Rain;
}
else if (globals.systemStatus == sysStat_Rain)
{
globals.systemStatus = sysStat_Normal;
globals.resumeStatus = sysStat_Normal;
}
Debug_pushMessage("Toggling Mode\n");
}
void onStartPurge()
{
globals.systemStatus = sysStat_Purge;
globals.purgePulses = LubeConfig.BleedingPulses;
Debug_pushMessage("Starting Purge\n");
}
void onWashMode()
{
Debug_pushMessage("Wash mode start\n");
// Hier könntest du später gezieltes Nachölen implementieren
}
/**
* @brief Processes the impulses from the wheel speed sensor and converts them into traveled distance.
*