Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function onMessage is killing my timer #40

Closed
MarleyRobert opened this issue Dec 5, 2017 · 1 comment
Closed

Function onMessage is killing my timer #40

MarleyRobert opened this issue Dec 5, 2017 · 1 comment

Comments

@MarleyRobert
Copy link

What's up guys (peace),

I'm working on my first project and I have a timer issue. Short version. my timer is running way to fast than the normal time. I already got some good support from crankyoldgit (crankyoldgit/IRremoteESP8266#364 (comment)) and followed his advices. Now I can edge my issue pretty much to one of the functions in this library "onMessage()". My ino looks like that:

`
#include <IRremoteESP8266.h>
#include <IRsend.h>
#include <ESP8266WiFi.h>

#include "fauxmoESP.h"

fauxmoESP fauxmo;

IRsend irsend(4);

#define WIFI_SSID "Mr. NiceGuy (.Y.)"
#define WIFI_PASS "***********"

void setup()
{
irsend.begin();
Serial.begin(115200);

wifiSetup();
fauxmo.enable(true);
devices();
MusicTest();
}

void loop()
{
fauxmo.handle();

static unsigned long last = millis();
if (millis() - last > 5000) {
    last = millis();
    Serial.printf("[MAIN] Free heap: %d bytes\n", ESP.getFreeHeap());
}

}

void MusicTest()
{
Serial.println("Anlage AN");
irsend.sendNEC(0x10E03FC, 32);
delay(4000);
Serial.println("Anlage Eingang CD");
irsend.sendNEC(0x10E23DC, 32);
delay(10000);
Serial.println("Anlage AUS");
irsend.sendNEC(0x10EF906, 32);
}

void request(unsigned char device_id, const char * device_name, bool state)
{
if (state)
{
if(device_id == 0)
{
MusicTest();
}
}
}

void wifiSetup()
{

// ----------
// WLAN SETUP
// ----------

WiFi.mode(WIFI_STA);

Serial.printf("Verbindungs zu %s wird aufgebaut ", WIFI_SSID);

WiFi.begin(WIFI_SSID, WIFI_PASS);

while (WiFi.status() != WL_CONNECTED) 
{
    Serial.print(">");
    delay(100);
}
 
Serial.println("");
Serial.printf("Verbunden! SSID: %s, IP Adresse: %s\n", WiFi.SSID().c_str(), WiFi.localIP().toString().c_str());

}

void devices()
{
fauxmo.addDevice("Test"); //ID 0

//fauxmo.onMessage(request);
}
`
If I run it like that, my output is fine and the delays in MusicTest are working as they should. BUT if I use the version where I uncomment fauxmo.onMessage(request) in devices(), my output isn't delayed. Hope one of you can help me!

best regards,
Michel

@n8henrie
Copy link
Owner

n8henrie commented Dec 6, 2017

Sorry man, wrong library. This is a Python app.

@n8henrie n8henrie closed this as completed Dec 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants