Jump to content

Wifi: "setWifiPowerMode" zweimal setzen führt zu Fehler


Recommended Posts

Hi

Ich habe einen Master + WLAN + Temperatursensor, alle mit aktueller Firmware.

Ich habe den Verdacht, dass wenn ich den WIFI Power Mode zweimal auf LOW_POWER setze, dass es dann einen Fehler gibt.

 

Folgendes node.js script wird alle 15 Minuten aufgerufen

    var ipcon = new TF.IPConnection();

    var masterBrick = new TF.BrickMaster('6esCZX', ipcon);

    var tempBricklet = new TF.BrickletTemperature('dCf', ipcon);

    tempBricklet.setI2CMode(TF.BrickletTemperature.I2C_MODE_SLOW);

   

    ipcon.connect(HOST, PORT, function(error) {

        cb("Could not open connection: "+error);       

    });

 

    ipcon.on(TF.IPConnection.CALLBACK_CONNECTED, function(connectReason) {

        masterBrick.setWifiPowerMode(TF.BrickMaster.WIFI_POWER_MODE_LOW_POWER);

        tempBricklet.getTemperature(

            function(temp) {

                cb(null, temp/100);

                ipcon.disconnect();

            },

            function(error) {

                cb("Could not read temperature: "+error);

                ipcon.disconnect();

            }

        );

    });

 

Ich bekomme immer "Could not read temperature: 31".

Wenn ich die Zeile

masterBrick.setWifiPowerMode(TF.BrickMaster.WIFI_POWER_MODE_LOW_POWER);

weglasse, dann funktioniert es.

Link zu diesem Kommentar
Share on other sites

hab ich probiert:

    ipcon.on(TF.IPConnection.CALLBACK_CONNECTED, function(connectReason) {

        masterBrick.setWifiPowerMode(TF.BrickMaster.WIFI_POWER_MODE_LOW_POWER);

        // Get temperature

        setTimeout(function(){

            tempBricklet.getTemperature(

                function(temp) {

                    console.log(null, temp/100);

                    ipcon.disconnect();

                },

                function(error) {

                    console.log("Could not read temperature: "+error);

                    ipcon.disconnect();

                }

            );

        }, 1500);

    });

 

hilft nix. Erst wenn ich "masterBrick.setWifiPowerMode" weglasse dann funktioniert es.

Link zu diesem Kommentar
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Gast
Reply to this topic...

×   Du hast formatierten Text eingefügt.   Formatierung jetzt entfernen

  Only 75 emoji are allowed.

×   Dein Link wurde automatisch eingebettet.   Einbetten rückgängig machen und als Link darstellen

×   Dein vorheriger Inhalt wurde wiederhergestellt.   Clear editor

×   Du kannst Bilder nicht direkt einfügen. Lade Bilder hoch oder lade sie von einer URL.

×
×
  • Neu erstellen...