Browse Source

add ifdef DEBUG_TIMING for fiming measurments

tags/v1.0.0
Simon Schmidt 3 years ago
parent
commit
6cc52dc460
1 changed files with 27 additions and 7 deletions
  1. 27
    7
      lib/treppe/treppe.cpp

+ 27
- 7
lib/treppe/treppe.cpp View File

@@ -1,4 +1,5 @@
#include "treppe.h"
// #define DEBUG_TIMING

/*
- dimmt stufe (0 - 15, PCA9685 outputs) mit linearen ticks
@@ -225,32 +226,46 @@ bool Treppe::check_ldr()

void Treppe::task()
{
#ifdef DEBUG_TIMING
uint32_t m=micros();
#endif

fsm_inputs.ldr_schwelle = check_ldr();

#ifdef DEBUG_TIMING
Serial.print("1:");
Serial.println(micros()-m);
m=micros();
#endif

fsm_inputs.sensor_oben = read_sensor(SENSOR_OBEN);
fsm_inputs.sensor_unten = read_sensor(SENSOR_UNTEN);
fsm_inputs.anim_beendet = anim_beendet;

#ifdef DEBUG_TIMING
Serial.print("2:");
Serial.println(micros()-m);
m=micros();
#endif

FSMTreppe_Obj.setExternalInputs(&fsm_inputs);
FSMTreppe_Obj.step();
fsm_outputs = FSMTreppe_Obj.getExternalOutputs();

#ifdef DEBUG_TIMING
Serial.print("3:");
Serial.println(micros()-m);

m=micros();
#endif

print_state_on_change();

#ifdef DEBUG_TIMING
Serial.print("4:");
Serial.println(micros()-m);


m=micros();
#endif

if( fsm_outputs.status == ST_AUFDIMMEN_HOCH ||
fsm_outputs.status == ST_ABDIMMEN_HOCH ||
fsm_outputs.status == ST_AUFDIMMEN_RUNTER ||
@@ -261,11 +276,14 @@ void Treppe::task()
else
anim_tick();
}

#ifdef DEBUG_TIMING
Serial.print("5:");
Serial.println(micros()-m);
m=micros();
#endif


m=micros();
// else if (fsm_outputs.status == ST_DIMMEN_LDR) {
// if(anim_beendet) {
// berechne_dimmer();
@@ -273,9 +291,11 @@ void Treppe::task()
// }
// anim_beendet = dimm_treppe();
// }

#ifdef DEBUG_TIMING
Serial.print("6:");
Serial.println(micros()-m);
#endif
}

void Treppe::berechne_dimmer()

Loading…
Cancel
Save