changed Capture-Functions to FunctionPointer
This commit is contained in:
parent
059b693889
commit
ac8be93faf
@ -48,6 +48,8 @@ const uint32_t connectTimeoutMs = 5000;
|
||||
ESP8266WiFiMulti wifiMulti;
|
||||
#endif
|
||||
|
||||
uint32_t (*wheelSpeedcapture)() = nullptr;
|
||||
|
||||
bool startSetupMode = false;
|
||||
volatile uint32_t wheel_pulse = 0;
|
||||
|
||||
@ -138,21 +140,23 @@ void setup()
|
||||
{
|
||||
case SOURCE_CAN:
|
||||
Init_CAN();
|
||||
wheelSpeedcapture = &Process_CAN_WheelSpeed;
|
||||
Serial.print("\nCAN-Init done");
|
||||
break;
|
||||
case SOURCE_GPS:
|
||||
Init_GPS();
|
||||
wheelSpeedcapture = &Process_GPS_WheelSpeed;
|
||||
Serial.print("\nGPS-Init done");
|
||||
break;
|
||||
case SOURCE_IMPULSE:
|
||||
pinMode(GPIO_TRIGGER, INPUT_PULLUP);
|
||||
attachInterrupt(digitalPinToInterrupt(GPIO_TRIGGER), trigger_ISR, FALLING);
|
||||
wheelSpeedcapture = &Process_Impulse_WheelSpeed;
|
||||
Serial.print("\nPulse-Input Init done");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Serial.print("\nSource-Init done");
|
||||
|
||||
// Configure GPIO pins for button and pump control
|
||||
@ -222,30 +226,8 @@ void setup()
|
||||
*/
|
||||
void loop()
|
||||
{
|
||||
// Variable to store calculated wheel distance
|
||||
uint32_t wheelDistance = 0;
|
||||
|
||||
// Switch based on the configured speed source
|
||||
switch (LubeConfig.SpeedSource)
|
||||
{
|
||||
case SOURCE_IMPULSE:
|
||||
wheelDistance = Process_Impulse_WheelSpeed();
|
||||
break;
|
||||
case SOURCE_CAN:
|
||||
wheelDistance = Process_CAN_WheelSpeed();
|
||||
break;
|
||||
|
||||
#ifdef FEATURE_ENABLE_TIMER
|
||||
case SOURCE_TIME:
|
||||
break;
|
||||
#endif
|
||||
case SOURCE_GPS:
|
||||
wheelDistance = Process_GPS_WheelSpeed();
|
||||
break;
|
||||
}
|
||||
|
||||
// Run lubrication application with the calculated wheel distance
|
||||
RunLubeApp(wheelDistance);
|
||||
RunLubeApp(wheelSpeedcapture());
|
||||
|
||||
#ifdef FEATURE_ENABLE_OLED
|
||||
// Update OLED display if enabled
|
||||
|
Loading…
x
Reference in New Issue
Block a user