Browse Source

added software timer

tags/v0.1.0
Simon Schmidt 2 years ago
parent
commit
49f9c9c217
1 changed files with 21 additions and 7 deletions
  1. 21
    7
      src/main.cpp

+ 21
- 7
src/main.cpp View File

@@ -3,6 +3,24 @@

#include "PCA9685.h"

extern "C" {
#include "user_interface.h"
}
os_timer_t Timer1; // Verwaltungsstruktur des Timers

uint32_t c;

uint32_t m=0;
void timerCallback(void *pArg)
{
*((int *) pArg) += 1;
Serial.print("hallo\n");
Serial.println(micros()-m);
m = micros();
}


// Änderung
// OTA & WEB
#include "wifi_credentials.h"
@@ -149,8 +167,6 @@ void setup_pwm_pca9685() {
Serial.println(pwmController.getChannelPWM(0)); // Should output 2048, which is 128 << 4
}



void setup() {
Serial.begin(115200);
Serial.println(F("Booting ...."));
@@ -167,6 +183,9 @@ void setup() {
ESP.restart();
}
os_timer_setfn(&Timer1, timerCallback, &c);
os_timer_arm(&Timer1, 1000, true);

Serial.println("Ready");
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
@@ -278,11 +297,6 @@ void loop() {
onoff = 1;
direction = 0;
}
TIMEIF_US("OTA", ArduinoOTA.handle(), 20000);
TIMEIF_US("HTTP", server.handleClient(), 20000);

TIMEIF_US("OTA", ArduinoOTA.handle(), 1000);
TIMEIF_US("HTTP", server.handleClient(), 1000);

}

Loading…
Cancel
Save