Tout d'abord merci,
J'aurai du penser à déboguer mon code avec le moniteur série. A l'avenir je le ferai systématiquement.
Effectivement je me doutais bien que c'était l'usine à gaz. Maintenant je vois clairement ce qu'il se passe. C'est n'importe quoi, pourtant mes volets fonctionnent correctement, ils montent et descendent à l'appui sur les BP correspondants mais ma UNO doit souffrir de mes incohérences !
Effectivement la durée de transmission d’une trame complète selon le protocole RTS est de l’ordre de 140 ms, en incluant la synchronisation hardware, la synchronisation software...
Je vous explique ma démarche :
J'utilise la librairie Somfy d'etimou https://github.com/etimou/SomfyRTS avec un module RFM69HCW 434MHZ qui est positionné à 433.42 Mhz dans le code.
Si j'utilise les exemples de la librairie, tout fonctionne parfaitement pour l'appairage du ou des volets, les 56 bits de la trame RTS avec une nouvelle adresse, le rolling code, la commande du volet... s'inscrivent bien dans l'EEPROM de ma UNO (si j'ai bien compris).
// This sketch will pair a Somfy device with a virtual remote controller
#include <SomfyRTS.h>
SomfyRTS myRTS(3, TSR_RFM69); //Tx pin number, transmitter type
//pin number : pin connected to the transmitter DATA pin or to the DIO2 pin on RFM69
//transmitter type can be TSR_RFM69 or TSR_AM (for a generic AM 433.42MHZ transmitter)
void setup() {
Serial.begin(115200);
//myRTS.configRTS(myEEPROM_address, myRTS_address); //uncomment and change values only if you don't want to use default configuration
myRTS.setHighPower(true); //have to call it after initialize for RFM69HW
Serial.println("Enter something in the terminal to pair your device");
//wait until something is received on Serial
while (!Serial.available()){}
Serial.print("Pairing...");
myRTS.sendSomfy(0, PROG);
Serial.println("Done");
}
void loop() {
}
Je respecte le protocole pour appairé, tout va bien pour l'instant...
Ensuite le croquis de démo d'un cycle fonctionne également correctement :
// This sketch will cycle one window blind every minute
#include <SomfyRTS.h>
SomfyRTS myRTS(3, TSR_RFM69); //Tx pin number, transmitter type
//pin number : pin connected to the transmitter DATA pin or to the DIO2 pin on RFM69
//transmitter type can be TSR_RFM69 or TSR_AM (for a generic AM 433.42MHZ transmitter)
void setup() {
//myRTS.configRTS(myEEPROM_address, myRTS_address); //uncomment and change values only if you don't want to use default configuration
myRTS.setHighPower(true); //have to call it after initialize for RFM69HW
}
void loop() {
myRTS.sendSomfy(0, DOWN); // remote 0, down
delay(60000);
myRTS.sendSomfy(0, UP); // remote 0, up
delay(60000);
}
Le ou les volets montent et descendent sans interruption avec une pause delay(60000);
entre chaque mouvement.
Là ou ça se complique c'est lorsque que je veux créer mon propre code avec deux BP, un pour monter tous les volets et un pour les descendre :
Si j'utilise ce code :
#include <SomfyRTS.h>
SomfyRTS myRTS(3, TSR_RFM69); //Tx pin number, transmitter type
//pin number : pin connected to the transmitter DATA pin or to the DIO2 pin on RFM69
//transmitter type can be TSR_RFM69 or TSR_AM (for a generic AM 433.42MHZ transmitter)
void setup() {
//myRTS.configRTS(myEEPROM_address, myRTS_address); //uncomment and change values only if you don't want to use default configuration
myRTS.setHighPower(true); //have to call it after initialize for RFM69HW
pinMode(7, INPUT_PULLUP);
pinMode(8, INPUT_PULLUP);
}
void loop() {
if (digitalRead(7) == LOW)
{
myRTS.sendSomfy(3, DOWN); // remote 0, downloop
delay(30000);
}
if (digitalRead(8) == LOW)
{
myRTS.sendSomfy(3, UP); // remote 0, up
delay(30000);
}
}
ça ne fonctionne pas, tout plante...
Si j'utilise celeui-ci :
#include <SomfyRTS.h>
SomfyRTS myRTS(3, TSR_RFM69); //Tx pin number, transmitter type
//pin number : pin connected to the transmitter DATA pin or to the DIO2 pin on RFM69
//transmitter type can be TSR_RFM69 or TSR_AM (for a generic AM 433.42MHZ transmitter)
void setup() {
//myRTS.configRTS(myEEPROM_address, myRTS_address); //uncomment and change values only if you don't want to use default configuration
myRTS.setHighPower(true); //have to call it after initialize for RFM69HW
pinMode(7, INPUT_PULLUP);
pinMode(8, INPUT_PULLUP);
}
void loop() {
if (digitalRead(7) == LOW)
{
myRTS.sendSomfy(3, DOWN); // remote 0, downloop
delay(30000);
myRTS.setHighPower(false);
}
if (digitalRead(8) == LOW)
{
myRTS.sendSomfy(3, UP); // remote 0, up
delay(30000);
myRTS.setHighPower(false);
}
}
J'ai ajouté myRTS.setHighPower(false);
ça fonctionne mais je dois faire un reset après chaque action sur un BP en appuyant sur le bouton adéquat de ma UNO d'où l'idée d'un reset automatique avec un watchdog. Je voulais un reset logiciel uniquement après l'appui sur un BP et j'ai fait n'importe quoi en prenant un exemple sur internet que j'ai mal utilisé. Malgré tout ce code bancal me permet d'effectuer ce que je veux.
Voilà.
Merci de vous intéresser à un neuneu comme moi.