Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Troubleshooting
  3. RFM69 new driver delay

RFM69 new driver delay

Scheduled Pinned Locked Moved Troubleshooting
67 Posts 10 Posters 7.9k Views 8 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • gohanG gohan

    I was talking to @tekka some time ago about the issues I had on 2.3 alpha, I don't know what he did after that.

    pepsonP Offline
    pepsonP Offline
    pepson
    wrote on last edited by
    #18

    @gohan
    And where we can send issue with this?

    1 Reply Last reply
    0
    • gohanG Offline
      gohanG Offline
      gohan
      Mod
      wrote on last edited by
      #19

      github and if you attach the rfm69 verbose output both for gw and node

      pepsonP 1 Reply Last reply
      1
      • gohanG gohan

        github and if you attach the rfm69 verbose output both for gw and node

        pepsonP Offline
        pepsonP Offline
        pepson
        wrote on last edited by pepson
        #20

        @gohan
        But how I can download info from gateway and node?

        On github created issue but nothing replay from developers...

        mfalkviddM 1 Reply Last reply
        0
        • pepsonP pepson

          @gohan
          But how I can download info from gateway and node?

          On github created issue but nothing replay from developers...

          mfalkviddM Offline
          mfalkviddM Offline
          mfalkvidd
          Mod
          wrote on last edited by
          #21

          @pepson all core members are helping MySensors when they have free time. Quick replies can happen, but don't count on it. We have as many projects and as little time as you.

          pepsonP 1 Reply Last reply
          0
          • mfalkviddM mfalkvidd

            @pepson all core members are helping MySensors when they have free time. Quick replies can happen, but don't count on it. We have as many projects and as little time as you.

            pepsonP Offline
            pepsonP Offline
            pepson
            wrote on last edited by
            #22

            @mfalkvidd
            OK thanks

            1 Reply Last reply
            0
            • M Offline
              M Offline
              mickecarlsson
              wrote on last edited by mickecarlsson
              #23

              I run mysgw 2.30 on a RPi 3 Model B and all nodes on 2.20 with RFM69:

              cat /proc/cpuinfo
              .
              .
              Hardware	: BCM2835
              Revision	: a02082
              

              I did a git pull then configured:

              ./configure --my-transport=rfm69 --my-is-rfm69hw --my-rfm69-frequency=868
              make
              sudo make install
              

              Note that I don't use LED's or specify gateway. My Controller is Domoticz

              I then started the gateway with debug (note missing -d) (and the log is from today):

              pi@mysensors-gw:~ $ sudo /usr/local/bin/mysgw 
              Jun 21 06:36:58 INFO  Starting gateway...
              Jun 21 06:36:58 INFO  Protocol version - 2.3.0
              Jun 21 06:36:58 DEBUG MCO:BGN:INIT GW,CP=RPNGL---,VER=2.3.0
              Jun 21 06:36:58 DEBUG TSF:LRT:OK
              Jun 21 06:36:58 DEBUG TSM:INIT
              Jun 21 06:36:58 DEBUG TSF:WUR:MS=0
              Jun 21 06:36:58 DEBUG TSM:INIT:TSP OK
              Jun 21 06:36:58 DEBUG TSM:INIT:GW MODE
              Jun 21 06:36:58 DEBUG TSM:READY:ID=0,PAR=0,DIS=0
              Jun 21 06:36:58 DEBUG MCO:REG:NOT NEEDED
              Jun 21 06:36:58 DEBUG Listening for connections on 0.0.0.0:5003
              Jun 21 06:36:58 DEBUG MCO:BGN:STP
              Jun 21 06:36:58 DEBUG MCO:BGN:INIT OK,TSP=1
              Jun 21 06:37:18 DEBUG GWT:RFC:C=0,MSG=0;0;3;0;2;
              Jun 21 06:37:18 DEBUG GWT:RFC:C=0,MSG=0;0;3;0;2;Get Version
              Jun 21 06:37:20 DEBUG GWT:RFC:C=0,MSG=0;0;3;0;18;PING
              Jun 21 06:37:30 DEBUG GWT:RFC:C=0,MSG=0;0;3;0;18;PING
              Jun 21 06:37:37 DEBUG TSF:MSG:READ,22-22-0,s=1,c=1,t=0,pt=7,l=5,sg=0:23.3
              Jun 21 06:37:37 DEBUG TSF:MSG:READ,22-22-0,s=2,c=1,t=1,pt=7,l=5,sg=0:48.0
              

              After the debug check I pressed ctrl-c and started mysgw as a service

              sudo systemctl start mysgw.service
              

              System has been running without any hickup since then.

              If you check the commit 2175c993ef81b78527c85649f5bdc3585d2f41b2 you will notice that -d is removed and some other features has been added.

              git log 2175c993ef81b78527c85649f5bdc3585d2f41b2
              commit 2175c993ef81b78527c85649f5bdc3585d2f41b2
              Author: Marcelo Aquino <marceloaqno@users.noreply.github.com>
              Date:   Fri Mar 23 07:00:34 2018 -0300
              
                  Linux: Use config file for gateway settings (#1061)
                  
                  - The following settings can be use on the config file:
                    - verbose=[debug,info,notice,warn,err] - Logging verbosity.
                    - log_file[0|1] - Enable logging to a file.
                    - log_filepath=(FILE) - Log file path.
                    - log_pipe=[0|1] - Enable logging to a named pipe(aka fifo).
                      Use this option to view your gateway's log messages from the
                      log_pipe_file (defined below).
                      To do so, run the following command on another terminal:
                      - $ cat "log_pipe_file"
                    - log_pipe_file=(FILE)
                    - syslog=[0|1] - Enable logging to syslog.
                    - eeprom_file=[/etc/mysensors.eeprom]
                    - eeprom_size=[1024]
                  - Change some mysgw parameters:
                    - Added:
                      - -q, --quiet:  for quiet mode, disable log messages written to the
                      terminal.
                    - Removed:
                      - -d, --debug: removed, log messages are now enabled by default.
                    - Replaced:
                      - -b, --background: replaced by --daemon
                  - isatty() is no longer used, log messages by default are printed to
                    stderr unless the gateway is started with --quiet (#1022)
                  - MY_LINUX_CONFIG_FILE: no longer holds the path to the eeprom file,
                    but to the configuration file
              

              My nodes has these definitions (I don't use New Driver):

              #define   MY_SPLASH_SCREEN_DISABLED
              // Enable and select radio type attached
              #define   MY_RADIO_RFM69
              #define   MY_IS_RFM69HW
              #define   MY_RFM69_FREQUENCY RFM69_868MHZ
              
              pepsonP 1 Reply Last reply
              0
              • M mickecarlsson

                I run mysgw 2.30 on a RPi 3 Model B and all nodes on 2.20 with RFM69:

                cat /proc/cpuinfo
                .
                .
                Hardware	: BCM2835
                Revision	: a02082
                

                I did a git pull then configured:

                ./configure --my-transport=rfm69 --my-is-rfm69hw --my-rfm69-frequency=868
                make
                sudo make install
                

                Note that I don't use LED's or specify gateway. My Controller is Domoticz

                I then started the gateway with debug (note missing -d) (and the log is from today):

                pi@mysensors-gw:~ $ sudo /usr/local/bin/mysgw 
                Jun 21 06:36:58 INFO  Starting gateway...
                Jun 21 06:36:58 INFO  Protocol version - 2.3.0
                Jun 21 06:36:58 DEBUG MCO:BGN:INIT GW,CP=RPNGL---,VER=2.3.0
                Jun 21 06:36:58 DEBUG TSF:LRT:OK
                Jun 21 06:36:58 DEBUG TSM:INIT
                Jun 21 06:36:58 DEBUG TSF:WUR:MS=0
                Jun 21 06:36:58 DEBUG TSM:INIT:TSP OK
                Jun 21 06:36:58 DEBUG TSM:INIT:GW MODE
                Jun 21 06:36:58 DEBUG TSM:READY:ID=0,PAR=0,DIS=0
                Jun 21 06:36:58 DEBUG MCO:REG:NOT NEEDED
                Jun 21 06:36:58 DEBUG Listening for connections on 0.0.0.0:5003
                Jun 21 06:36:58 DEBUG MCO:BGN:STP
                Jun 21 06:36:58 DEBUG MCO:BGN:INIT OK,TSP=1
                Jun 21 06:37:18 DEBUG GWT:RFC:C=0,MSG=0;0;3;0;2;
                Jun 21 06:37:18 DEBUG GWT:RFC:C=0,MSG=0;0;3;0;2;Get Version
                Jun 21 06:37:20 DEBUG GWT:RFC:C=0,MSG=0;0;3;0;18;PING
                Jun 21 06:37:30 DEBUG GWT:RFC:C=0,MSG=0;0;3;0;18;PING
                Jun 21 06:37:37 DEBUG TSF:MSG:READ,22-22-0,s=1,c=1,t=0,pt=7,l=5,sg=0:23.3
                Jun 21 06:37:37 DEBUG TSF:MSG:READ,22-22-0,s=2,c=1,t=1,pt=7,l=5,sg=0:48.0
                

                After the debug check I pressed ctrl-c and started mysgw as a service

                sudo systemctl start mysgw.service
                

                System has been running without any hickup since then.

                If you check the commit 2175c993ef81b78527c85649f5bdc3585d2f41b2 you will notice that -d is removed and some other features has been added.

                git log 2175c993ef81b78527c85649f5bdc3585d2f41b2
                commit 2175c993ef81b78527c85649f5bdc3585d2f41b2
                Author: Marcelo Aquino <marceloaqno@users.noreply.github.com>
                Date:   Fri Mar 23 07:00:34 2018 -0300
                
                    Linux: Use config file for gateway settings (#1061)
                    
                    - The following settings can be use on the config file:
                      - verbose=[debug,info,notice,warn,err] - Logging verbosity.
                      - log_file[0|1] - Enable logging to a file.
                      - log_filepath=(FILE) - Log file path.
                      - log_pipe=[0|1] - Enable logging to a named pipe(aka fifo).
                        Use this option to view your gateway's log messages from the
                        log_pipe_file (defined below).
                        To do so, run the following command on another terminal:
                        - $ cat "log_pipe_file"
                      - log_pipe_file=(FILE)
                      - syslog=[0|1] - Enable logging to syslog.
                      - eeprom_file=[/etc/mysensors.eeprom]
                      - eeprom_size=[1024]
                    - Change some mysgw parameters:
                      - Added:
                        - -q, --quiet:  for quiet mode, disable log messages written to the
                        terminal.
                      - Removed:
                        - -d, --debug: removed, log messages are now enabled by default.
                      - Replaced:
                        - -b, --background: replaced by --daemon
                    - isatty() is no longer used, log messages by default are printed to
                      stderr unless the gateway is started with --quiet (#1022)
                    - MY_LINUX_CONFIG_FILE: no longer holds the path to the eeprom file,
                      but to the configuration file
                

                My nodes has these definitions (I don't use New Driver):

                #define   MY_SPLASH_SCREEN_DISABLED
                // Enable and select radio type attached
                #define   MY_RADIO_RFM69
                #define   MY_IS_RFM69HW
                #define   MY_RFM69_FREQUENCY RFM69_868MHZ
                
                pepsonP Offline
                pepsonP Offline
                pepson
                wrote on last edited by
                #24

                @mickecarlsson

                Hi
                But you run gateway on 2.3.0 and node on 2.2.0 without NEW DRIVER and it was working ?
                Even though the gateway has a different version and nodes have a different ?
                All people tell that gateway and nodes must have the same version ?

                M 1 Reply Last reply
                0
                • gohanG Offline
                  gohanG Offline
                  gohan
                  Mod
                  wrote on last edited by
                  #25

                  There have been versions in the past that were not backward compatible, but usually it is not necessary to have same version on gw and nodes

                  pepsonP 1 Reply Last reply
                  0
                  • gohanG gohan

                    There have been versions in the past that were not backward compatible, but usually it is not necessary to have same version on gw and nodes

                    pepsonP Offline
                    pepsonP Offline
                    pepson
                    wrote on last edited by
                    #26

                    @gohan

                    Ok thanks

                    1 Reply Last reply
                    0
                    • pepsonP pepson

                      @mickecarlsson

                      Hi
                      But you run gateway on 2.3.0 and node on 2.2.0 without NEW DRIVER and it was working ?
                      Even though the gateway has a different version and nodes have a different ?
                      All people tell that gateway and nodes must have the same version ?

                      M Offline
                      M Offline
                      mickecarlsson
                      wrote on last edited by
                      #27

                      @pepson
                      Yes, I run gateway 2.30 and nodes on 2.20 without new driver. No probems.

                      1 Reply Last reply
                      0
                      • pepsonP Offline
                        pepsonP Offline
                        pepson
                        wrote on last edited by
                        #28

                        Today i installed Gateway on RPI3 with version 2.3.0 but node has 2.2.0 with NEW_DRIVER and still is problem with communication.

                        After come back to home i test it with change version on node to 2.2.0 without NEW_DRIVER.

                        I give you and info...

                        But tell me on what RPI you have run gateway version 2.3.0 ?
                        I have RPI3 version B.

                        1 Reply Last reply
                        0
                        • M Offline
                          M Offline
                          mickecarlsson
                          wrote on last edited by
                          #29

                          @mickecarlsson said in RFM69 new driver delay:

                          > cat /proc/cpuinfo
                          > .
                          > .
                          > Hardware	: BCM2835
                          > Revision	: a02082
                          

                          Type as above and check the last entries, my RPi is revision a02082
                          Se here for more info:
                          Raspberry Pi revision codes

                          pepsonP 1 Reply Last reply
                          0
                          • M mickecarlsson

                            @mickecarlsson said in RFM69 new driver delay:

                            > cat /proc/cpuinfo
                            > .
                            > .
                            > Hardware	: BCM2835
                            > Revision	: a02082
                            

                            Type as above and check the last entries, my RPi is revision a02082
                            Se here for more info:
                            Raspberry Pi revision codes

                            pepsonP Offline
                            pepsonP Offline
                            pepson
                            wrote on last edited by pepson
                            #30

                            @mickecarlsson
                            It is the same hardware and rev.
                            Ok i done test...
                            On Gateway on RPI3 i have installed MySensors 2.3.0

                            On node i installed version 2.2.0
                            One with NEW_DRIVER. Communication with gateway sometimes is ok but still with problem lost communication.

                            Second test installed on node 2.2.0 without NEW_DRIVER and it no working. No communicate with gateway.
                            Not working NODE. Any reaction to control relay.

                            For me only all working when i have MySensors 2.2.0 also on Gateway and also on node with NEW DRIVER option.

                            // Enable and select radio type attached
                            #define MY_RADIO_RFM69
                            #define MY_IS_RFM69HW
                            #define RFM69_868MH
                            #define MY_RFM69_NEW_DRIVER
                            
                            
                            other 
                            
                            
                            // Enable and select radio type attached
                            #define MY_RADIO_RFM69
                            #define MY_IS_RFM69HW
                            #define MY_RFM69_FREQUENCY RFM69_868MHZ
                            
                            1 Reply Last reply
                            0
                            • M Offline
                              M Offline
                              mickecarlsson
                              wrote on last edited by
                              #31

                              What kind of antenna do you have on the RPi for the radio? And what kind of antenna do you have on the node?

                              pepsonP 1 Reply Last reply
                              0
                              • M mickecarlsson

                                What kind of antenna do you have on the RPi for the radio? And what kind of antenna do you have on the node?

                                pepsonP Offline
                                pepsonP Offline
                                pepson
                                wrote on last edited by
                                #32

                                @mickecarlsson

                                I have a wire length if I remember 82mm.

                                1 Reply Last reply
                                0
                                • M Offline
                                  M Offline
                                  mickecarlsson
                                  wrote on last edited by
                                  #33

                                  Just a hunch, add 4 mm to it so that it is 86 mm instead..
                                  And the power supply for the RPi must be able to provide at leat 1.5 A at 5Volt. Dont go for a cheap powersupply, it wont cope with the power drain from the ROi.

                                  pepsonP 1 Reply Last reply
                                  0
                                  • M mickecarlsson

                                    Just a hunch, add 4 mm to it so that it is 86 mm instead..
                                    And the power supply for the RPi must be able to provide at leat 1.5 A at 5Volt. Dont go for a cheap powersupply, it wont cope with the power drain from the ROi.

                                    pepsonP Offline
                                    pepsonP Offline
                                    pepson
                                    wrote on last edited by
                                    #34

                                    @mickecarlsson

                                    Hi
                                    my bug lenght antenna is 86mm. Sorry.
                                    Power for RPI is very good and original raspberry manufacturer provide about 2,5A

                                    After my tests only on MySensors 2.2.0 on Gateway and on Nodes 2.2.0 with NEW_DRIVER all works ok.

                                    In other like gateway 2.3.0 and node 2.2.0 or 2.3.0 with NEW_DRIVER or without NEW_DRIVER not working correct.

                                    pepsonP 1 Reply Last reply
                                    0
                                    • K Offline
                                      K Offline
                                      kimot
                                      wrote on last edited by
                                      #35
                                      This post is deleted!
                                      1 Reply Last reply
                                      0
                                      • pepsonP pepson

                                        @mickecarlsson

                                        Hi
                                        my bug lenght antenna is 86mm. Sorry.
                                        Power for RPI is very good and original raspberry manufacturer provide about 2,5A

                                        After my tests only on MySensors 2.2.0 on Gateway and on Nodes 2.2.0 with NEW_DRIVER all works ok.

                                        In other like gateway 2.3.0 and node 2.2.0 or 2.3.0 with NEW_DRIVER or without NEW_DRIVER not working correct.

                                        pepsonP Offline
                                        pepsonP Offline
                                        pepson
                                        wrote on last edited by
                                        #36

                                        @kimot

                                        I dont must use NEW_DRIVER, but when i write sketch to my node without option NEW_DRIVER, it no working. I tested some combination...mix. Gateway 2.3.0 or 2.2.0 with node 2.2.0 and 2.3.0 and Only with NEW_DRIVER works ok and only on 2.2.0 on node and gateway.

                                        This is my sketch.

                                        // Enable debug prints to serial monitor
                                        #define MY_DEBUG
                                        
                                        // Enable and select radio type attached
                                        #define MY_RADIO_RFM69
                                        #define MY_IS_RFM69HW
                                        //#define MY_RFM69_FREQUENCY RFM69_868MHZ
                                        #define RFM69_868MH
                                        #define MY_RFM69_NEW_DRIVER
                                        
                                        #define MY_REPEATER_FEATURE
                                        
                                        //#define MY_RFM69_CSMA_LIMIT_DBM (-85)
                                        
                                        // uncomment if we want to manually assign an ID
                                        #define MY_NODE_ID 1
                                        
                                        #include <Bounce2.h>
                                        #include <MySensors.h>
                                        #include <SPI.h>
                                        
                                        #define BUTTON_UP_PIN 3  // Arduino Digital I/O pin number for up button
                                        #define BUTTON_DOWN_PIN 4  // Arduino Digital I/O pin number for down button
                                        //#define BUTTON_STOP_PIN 5  // Arduino Digital I/O pin number for stop button
                                        //#define RELAY_DIR_PIN 6  // Arduino Digital I/O pin number for direction relay
                                        //#define RELAY_POWER_PIN 7  // Arduino Digital I/O pin number for power relay
                                        #define RELAY_UP_PIN 5 
                                        #define RELAY_DOWN_PIN 6
                                        #define RELAY_ON 0
                                        #define RELAY_OFF 1
                                        //#define RELAY_DOWN 1
                                        //#define RELAY_UP 0
                                        #define DIRECTION_DOWN 0
                                        #define DIRECTION_UP 1
                                        #define SKETCH_NAME "Roleta w sypialni"
                                        #define SKETCH_VER "2.2"
                                        #define CHILD_ID_COVER 0   // sensor Id of the sensor child
                                        #define STATE_UP 100 // 100 is open - up
                                        #define STATE_DOWN 0 // 0 is closed - down
                                        //#define CHILD_ID_CALIBRATE 1   // sensor Id of the sensor child to calibrate
                                        #define CHILD_ID_SET 1   // sensor Id of the sensor child to init the roll time
                                        #define PRESENT_MESSAGE "Rolety dla Home Assistant"
                                        const int LEVELS = 100; //the number of levels
                                        float rollTime = 20.0; //the overall rolling time of the shutter
                                        const bool IS_ACK = false; //is to acknowlage
                                        static bool initial_state_sent = false;//for hass we need at list one state send at begining
                                        
                                        // debouncing parameters
                                        int value = 0;
                                        int oldValueUp = 0;
                                        int oldValueDown = 0;
                                        int oldValueStop = 0;
                                        //static unsigned long last_interrupt_time_up = 0;
                                        //static unsigned long last_interrupt_time_down = 0;
                                        //static unsigned long debounce_time = 200;
                                        
                                        Bounce debouncerUp = Bounce();
                                        Bounce debouncerDown = Bounce();
                                        Bounce debouncerStop = Bounce();
                                        
                                        // shutter position parameters
                                        float timeOneLevel = rollTime / LEVELS;
                                        int requestedShutterLevel = 0;
                                        int currentShutterLevel = 0;
                                        unsigned long lastLevelTime = 0;
                                        bool isMoving = false;
                                        int directionUpDown;
                                        bool calibrateDown;
                                        bool calibrateUp;
                                        unsigned long calibrationStartTime;
                                        float calibrationTime = 5.0;
                                        bool calibratedDown;
                                        bool calibratedUp;
                                        
                                        enum CoverState {
                                          STOP,
                                          UP, // Window covering. Up.
                                          DOWN, // Window covering. Down.
                                        };
                                        
                                        static int coverState = STOP;
                                        
                                        MyMessage msgUp(CHILD_ID_COVER, V_UP);
                                        MyMessage msgDown(CHILD_ID_COVER, V_DOWN);
                                        MyMessage msgStop(CHILD_ID_COVER, V_STOP);
                                        MyMessage msgPercentage(CHILD_ID_COVER, V_PERCENTAGE);
                                        //MyMessage msgCode(CHILD_ID_SET, V_IR_SEND);
                                        
                                        void sendState() {
                                          // Send current state and status to gateway.
                                        //  send(msgUp.set(coverState == UP));
                                        //  send(msgDown.set(coverState == DOWN));
                                        //  send(msgStop.set(coverState == STOP));
                                          send(msgPercentage.set(currentShutterLevel));
                                        }
                                        
                                        void shuttersUp(void) {
                                          #ifdef MY_DEBUG
                                          Serial.println("Shutters going up");
                                          #endif
                                          if (digitalRead(RELAY_DOWN_PIN) == RELAY_ON) {
                                            digitalWrite(RELAY_DOWN_PIN, RELAY_OFF);
                                            wait(50);
                                          }
                                          digitalWrite(RELAY_UP_PIN, RELAY_ON);
                                        
                                          directionUpDown = DIRECTION_UP;
                                          isMoving = true;
                                          coverState = UP;
                                          sendState();
                                        }
                                        
                                        void shuttersDown(void) {
                                          #ifdef MY_DEBUG
                                          Serial.println("Shutters going down");
                                          #endif
                                          if (digitalRead(RELAY_UP_PIN) == RELAY_ON) {
                                            digitalWrite(RELAY_UP_PIN, RELAY_OFF);
                                            wait(50);
                                          }
                                          digitalWrite(RELAY_DOWN_PIN, RELAY_ON);
                                        
                                          directionUpDown = DIRECTION_DOWN;
                                          isMoving = true;
                                          coverState = DOWN;
                                          sendState();
                                        }
                                        
                                        void shuttersHalt(void) {
                                        #ifdef MY_DEBUG
                                          Serial.println("Shutters halted");
                                        #endif
                                          digitalWrite(RELAY_UP_PIN, RELAY_OFF);
                                          digitalWrite(RELAY_DOWN_PIN, RELAY_OFF);
                                        
                                          isMoving = false;
                                          requestedShutterLevel = currentShutterLevel;
                                        #ifdef MY_DEBUG
                                          Serial.println("saving state to: ");
                                          Serial.println(String(currentShutterLevel));
                                        #endif
                                          saveState(CHILD_ID_COVER, currentShutterLevel);
                                          coverState = STOP;
                                          sendState();
                                        }
                                        
                                        void changeShuttersLevel(int level) {
                                          int dir = (level > currentShutterLevel) ? DIRECTION_UP : DIRECTION_DOWN;
                                          if (isMoving && dir != directionUpDown) {
                                            shuttersHalt();
                                          }
                                          requestedShutterLevel = level;
                                        }
                                        
                                        void initShutters() {
                                        #ifdef MY_DEBUG
                                          Serial.println("Init Cover");
                                        #endif
                                          shuttersUp();
                                          wait((rollTime + timeOneLevel * LEVELS) * 1000);
                                          currentShutterLevel = STATE_UP;
                                          requestedShutterLevel = currentShutterLevel;
                                        }
                                        
                                        void receive(const MyMessage &message) {
                                        #ifdef MY_DEBUG
                                          Serial.println("recieved incomming message");
                                          Serial.println("Recieved message for sensor: ");
                                          Serial.println(String(message.sensor));
                                          Serial.println("Recieved message with type: ");
                                          Serial.println(String(message.type));
                                        #endif
                                          if (message.sensor == CHILD_ID_COVER) {
                                            switch (message.type) {
                                              case V_UP:
                                                //Serial.println(", New status: V_UP");
                                                changeShuttersLevel(STATE_UP);
                                                //state = UP;
                                                //sendState();
                                                break;
                                        
                                              case V_DOWN:
                                                //Serial.println(", New status: V_DOWN");
                                                changeShuttersLevel(STATE_DOWN);
                                                //state = DOWN;
                                                //sendState();
                                                break;
                                        
                                              case V_STOP:
                                                //Serial.println(", New status: V_STOP");
                                                shuttersHalt();
                                                //state = IDLE;
                                                //sendState();
                                                break;
                                        
                                              case V_PERCENTAGE:
                                                //Serial.println(", New status: V_PERCENTAGE");
                                                //          if (!initial_state_sent) {
                                                //            #ifdef MY_DEBUG
                                                //            Serial.println("Receiving initial value from controller");
                                                //            #endif
                                                //            initial_state_sent = true;
                                                //          }
                                                int per = message.getInt();
                                                if (per > STATE_UP) {
                                                  per = STATE_UP;
                                                }
                                                changeShuttersLevel(per);
                                                //InitShutters(message.getInt());//send value < 0 or > 100 to calibrate
                                                //sendState();
                                                break;
                                            }
                                          } 
                                        else if (message.sensor ==  CHILD_ID_SET) {
                                        
                                            if (message.type == V_VAR1) {
                                              #ifdef MY_DEBUG
                                              Serial.println(", New status: V_VAR1, with payload: ");
                                              #endif      
                                              String strRollTime = message.getString();
                                              rollTime = strRollTime.toFloat();
                                              #ifdef MY_DEBUG
                                              Serial.println("rolltime value: ");
                                              Serial.println(String(rollTime));
                                              #endif
                                              saveState(CHILD_ID_SET, rollTime);
                                            }
                                          }
                                        #ifdef MY_DEBUG
                                          Serial.println("exiting incoming message");
                                        #endif
                                          return;
                                        }
                                        
                                        void before() {
                                        
                                          // Setup the button
                                          pinMode(BUTTON_UP_PIN, INPUT_PULLUP);
                                          // Activate internal pull-up
                                        //  digitalWrite(BUTTON_UP_PIN, HIGH);
                                          //  attachInterrupt(digitalPinToInterrupt(BUTTON_UP_PIN), upButtonPress, FALLING);
                                        
                                          pinMode(BUTTON_DOWN_PIN, INPUT_PULLUP);
                                          // Activate internal pull-up
                                        //  digitalWrite(BUTTON_DOWN_PIN, HIGH);
                                          //  attachInterrupt(digitalPinToInterrupt(BUTTON_DOWN_PIN), downButtonPress, FALLING);
                                        
                                        //  pinMode(BUTTON_STOP_PIN, INPUT_PULLUP);
                                          // Activate internal pull-up
                                        //  digitalWrite(BUTTON_STOP_PIN, HIGH);
                                        
                                          // After setting up the button, setup debouncer
                                          debouncerUp.attach(BUTTON_UP_PIN);
                                          debouncerUp.interval(5);
                                          // After setting up the button, setup debouncer
                                          debouncerDown.attach(BUTTON_DOWN_PIN);
                                          debouncerDown.interval(5);
                                          // After setting up the button, setup debouncer
                                        //  debouncerStop.attach(BUTTON_STOP_PIN);
                                        //  debouncerStop.interval(5);
                                        
                                          // Make sure relays are off when starting up
                                          digitalWrite(RELAY_UP_PIN, RELAY_OFF);
                                          // Then set relay pins in output mode
                                          pinMode(RELAY_UP_PIN, OUTPUT);
                                        
                                          // Make sure relays are off when starting up
                                          digitalWrite(RELAY_DOWN_PIN, RELAY_OFF);
                                          // Then set relay pins in output mode
                                          pinMode(RELAY_DOWN_PIN, OUTPUT);
                                        }
                                        
                                        void presentation() {
                                          // Send the sketch version information to the gateway and Controller
                                          sendSketchInfo(SKETCH_NAME, SKETCH_VER);
                                          // Register all sensors to gw (they will be created as child devices)
                                          present(CHILD_ID_COVER, S_COVER, PRESENT_MESSAGE, IS_ACK);
                                          // present(CHILD_ID_SET, S_CUSTOM);
                                        }
                                        
                                        void setup(void) {
                                          //set up roll time if the saved value is not 255
                                          #ifdef MY_DEBUG
                                          Serial.println("getting rolltime from eeprom: ");
                                          #endif
                                          float tmpRollTime = loadState(CHILD_ID_SET);
                                          if (tmpRollTime != 0xff) {
                                            rollTime = tmpRollTime;
                                          }
                                          #ifdef MY_DEBUG
                                          Serial.println(String(rollTime));
                                          #endif
                                          
                                          int state = loadState(CHILD_ID_COVER);
                                          
                                          #ifdef MY_DEBUG
                                          Serial.println("getting state from eeprom: ");
                                          Serial.println(String(state));
                                          #endif
                                          
                                        //  if (state == 0xff) {
                                        //    initShutters();
                                        //  } else {
                                            currentShutterLevel = state;
                                            requestedShutterLevel = state;
                                        //  }
                                        }
                                        
                                        void loop(void) {
                                          if (!initial_state_sent) {
                                        #ifdef MY_DEBUG
                                            Serial.println("Sending initial value");
                                        #endif
                                            sendState();
                                            
                                           // send(msgCode.set('20.0'));
                                            //    #ifdef MY_DEBUG
                                            //    Serial.println("Requesting initial value from controller");
                                            //    #endif
                                            //    request(CHILD_ID_COVER, V_PERCENTAGE);
                                            //    wait(2000, C_SET, V_PERCENTAGE);
                                            initial_state_sent = true;
                                          }
                                        
                                          debouncerUp.update();
                                          value = debouncerUp.read();
                                          if (value == 0 && value != oldValueUp) {
                                            if(isMoving){
                                              shuttersHalt();
                                            }  
                                            else{
                                            calibrateUp = false;
                                            calibratedUp = false;
                                            changeShuttersLevel(STATE_UP);
                                            }
                                            //state = UP;
                                            //sendState();
                                          }
                                          oldValueUp = value;
                                        
                                          debouncerDown.update();
                                          value = debouncerDown.read();
                                          if (value == 0 && value != oldValueDown) {
                                            if(isMoving){
                                              shuttersHalt();
                                            }  
                                            else{
                                            calibrateDown = false;
                                            calibratedDown = false;
                                            changeShuttersLevel(STATE_DOWN);
                                            }    
                                            //state = DOWN;
                                            //sendState();
                                          }
                                          oldValueDown = value;
                                        
                                        /*  debouncerStop.update();
                                          value = debouncerStop.read();
                                          if (value == 0 && value != oldValueStop) {
                                            shuttersHalt();
                                            //state = IDLE;
                                            //sendState();
                                          }
                                          oldValueStop = value;
                                        */
                                          if(currentShutterLevel != 100)
                                          {
                                            calibrateUp = false;
                                            calibratedUp = false;
                                          }
                                          if(currentShutterLevel != 0)
                                          {
                                            calibrateDown = false;
                                            calibratedDown = false;
                                          }
                                          
                                          if (isMoving) 
                                          {
                                            unsigned long _now = millis();
                                            if (_now - lastLevelTime >= timeOneLevel * 1000) {
                                              if (directionUpDown == DIRECTION_UP) {
                                                currentShutterLevel += 1;
                                              } else {
                                                currentShutterLevel -= 1;
                                              }
                                              currentShutterLevel = constrain(currentShutterLevel, 0, 100);
                                              #ifdef MY_DEBUG
                                              Serial.println(String(requestedShutterLevel));
                                              Serial.println(String(currentShutterLevel));
                                              #endif
                                              lastLevelTime = millis();
                                              send(msgPercentage.set(currentShutterLevel));
                                            }
                                            if (currentShutterLevel == requestedShutterLevel) 
                                            {
                                              if(currentShutterLevel == 0 && !calibratedDown)
                                              {
                                                if(calibrateDown == false)
                                                {
                                                  calibrateDown = true;
                                                  calibratedDown = false;
                                                  calibrationStartTime = _now;
                                                }
                                                else 
                                                {
                                                  if(calibratedDown == false)
                                                  {
                                                    if (_now - calibrationStartTime >= calibrationTime * 1000)
                                                    {
                                                     calibratedDown = true;
                                                    }
                                                  }
                                                }
                                              }
                                              else if (currentShutterLevel == 100 && !calibratedUp)
                                              {
                                                if(calibrateUp == false)
                                                {
                                                  calibrateUp = true;
                                                  calibratedUp = false;
                                                  calibrationStartTime = _now;
                                                }
                                                else 
                                                {
                                                  if(calibratedUp == false)
                                                  {
                                                    if (_now - calibrationStartTime >= calibrationTime * 1000)
                                                    {
                                                     calibratedUp = true;
                                                    }
                                                  }
                                                }
                                              }
                                              else
                                              {
                                                shuttersHalt();
                                              }
                                            }
                                          } 
                                          else 
                                          {
                                            if (requestedShutterLevel != currentShutterLevel) 
                                            {
                                              if (requestedShutterLevel > currentShutterLevel) {
                                                shuttersUp();
                                              }
                                              else {
                                                shuttersDown();
                                              }
                                              lastLevelTime = millis();
                                            }
                                          }
                                        }
                                        
                                        pepsonP 1 Reply Last reply
                                        0
                                        • pepsonP pepson

                                          @kimot

                                          I dont must use NEW_DRIVER, but when i write sketch to my node without option NEW_DRIVER, it no working. I tested some combination...mix. Gateway 2.3.0 or 2.2.0 with node 2.2.0 and 2.3.0 and Only with NEW_DRIVER works ok and only on 2.2.0 on node and gateway.

                                          This is my sketch.

                                          // Enable debug prints to serial monitor
                                          #define MY_DEBUG
                                          
                                          // Enable and select radio type attached
                                          #define MY_RADIO_RFM69
                                          #define MY_IS_RFM69HW
                                          //#define MY_RFM69_FREQUENCY RFM69_868MHZ
                                          #define RFM69_868MH
                                          #define MY_RFM69_NEW_DRIVER
                                          
                                          #define MY_REPEATER_FEATURE
                                          
                                          //#define MY_RFM69_CSMA_LIMIT_DBM (-85)
                                          
                                          // uncomment if we want to manually assign an ID
                                          #define MY_NODE_ID 1
                                          
                                          #include <Bounce2.h>
                                          #include <MySensors.h>
                                          #include <SPI.h>
                                          
                                          #define BUTTON_UP_PIN 3  // Arduino Digital I/O pin number for up button
                                          #define BUTTON_DOWN_PIN 4  // Arduino Digital I/O pin number for down button
                                          //#define BUTTON_STOP_PIN 5  // Arduino Digital I/O pin number for stop button
                                          //#define RELAY_DIR_PIN 6  // Arduino Digital I/O pin number for direction relay
                                          //#define RELAY_POWER_PIN 7  // Arduino Digital I/O pin number for power relay
                                          #define RELAY_UP_PIN 5 
                                          #define RELAY_DOWN_PIN 6
                                          #define RELAY_ON 0
                                          #define RELAY_OFF 1
                                          //#define RELAY_DOWN 1
                                          //#define RELAY_UP 0
                                          #define DIRECTION_DOWN 0
                                          #define DIRECTION_UP 1
                                          #define SKETCH_NAME "Roleta w sypialni"
                                          #define SKETCH_VER "2.2"
                                          #define CHILD_ID_COVER 0   // sensor Id of the sensor child
                                          #define STATE_UP 100 // 100 is open - up
                                          #define STATE_DOWN 0 // 0 is closed - down
                                          //#define CHILD_ID_CALIBRATE 1   // sensor Id of the sensor child to calibrate
                                          #define CHILD_ID_SET 1   // sensor Id of the sensor child to init the roll time
                                          #define PRESENT_MESSAGE "Rolety dla Home Assistant"
                                          const int LEVELS = 100; //the number of levels
                                          float rollTime = 20.0; //the overall rolling time of the shutter
                                          const bool IS_ACK = false; //is to acknowlage
                                          static bool initial_state_sent = false;//for hass we need at list one state send at begining
                                          
                                          // debouncing parameters
                                          int value = 0;
                                          int oldValueUp = 0;
                                          int oldValueDown = 0;
                                          int oldValueStop = 0;
                                          //static unsigned long last_interrupt_time_up = 0;
                                          //static unsigned long last_interrupt_time_down = 0;
                                          //static unsigned long debounce_time = 200;
                                          
                                          Bounce debouncerUp = Bounce();
                                          Bounce debouncerDown = Bounce();
                                          Bounce debouncerStop = Bounce();
                                          
                                          // shutter position parameters
                                          float timeOneLevel = rollTime / LEVELS;
                                          int requestedShutterLevel = 0;
                                          int currentShutterLevel = 0;
                                          unsigned long lastLevelTime = 0;
                                          bool isMoving = false;
                                          int directionUpDown;
                                          bool calibrateDown;
                                          bool calibrateUp;
                                          unsigned long calibrationStartTime;
                                          float calibrationTime = 5.0;
                                          bool calibratedDown;
                                          bool calibratedUp;
                                          
                                          enum CoverState {
                                            STOP,
                                            UP, // Window covering. Up.
                                            DOWN, // Window covering. Down.
                                          };
                                          
                                          static int coverState = STOP;
                                          
                                          MyMessage msgUp(CHILD_ID_COVER, V_UP);
                                          MyMessage msgDown(CHILD_ID_COVER, V_DOWN);
                                          MyMessage msgStop(CHILD_ID_COVER, V_STOP);
                                          MyMessage msgPercentage(CHILD_ID_COVER, V_PERCENTAGE);
                                          //MyMessage msgCode(CHILD_ID_SET, V_IR_SEND);
                                          
                                          void sendState() {
                                            // Send current state and status to gateway.
                                          //  send(msgUp.set(coverState == UP));
                                          //  send(msgDown.set(coverState == DOWN));
                                          //  send(msgStop.set(coverState == STOP));
                                            send(msgPercentage.set(currentShutterLevel));
                                          }
                                          
                                          void shuttersUp(void) {
                                            #ifdef MY_DEBUG
                                            Serial.println("Shutters going up");
                                            #endif
                                            if (digitalRead(RELAY_DOWN_PIN) == RELAY_ON) {
                                              digitalWrite(RELAY_DOWN_PIN, RELAY_OFF);
                                              wait(50);
                                            }
                                            digitalWrite(RELAY_UP_PIN, RELAY_ON);
                                          
                                            directionUpDown = DIRECTION_UP;
                                            isMoving = true;
                                            coverState = UP;
                                            sendState();
                                          }
                                          
                                          void shuttersDown(void) {
                                            #ifdef MY_DEBUG
                                            Serial.println("Shutters going down");
                                            #endif
                                            if (digitalRead(RELAY_UP_PIN) == RELAY_ON) {
                                              digitalWrite(RELAY_UP_PIN, RELAY_OFF);
                                              wait(50);
                                            }
                                            digitalWrite(RELAY_DOWN_PIN, RELAY_ON);
                                          
                                            directionUpDown = DIRECTION_DOWN;
                                            isMoving = true;
                                            coverState = DOWN;
                                            sendState();
                                          }
                                          
                                          void shuttersHalt(void) {
                                          #ifdef MY_DEBUG
                                            Serial.println("Shutters halted");
                                          #endif
                                            digitalWrite(RELAY_UP_PIN, RELAY_OFF);
                                            digitalWrite(RELAY_DOWN_PIN, RELAY_OFF);
                                          
                                            isMoving = false;
                                            requestedShutterLevel = currentShutterLevel;
                                          #ifdef MY_DEBUG
                                            Serial.println("saving state to: ");
                                            Serial.println(String(currentShutterLevel));
                                          #endif
                                            saveState(CHILD_ID_COVER, currentShutterLevel);
                                            coverState = STOP;
                                            sendState();
                                          }
                                          
                                          void changeShuttersLevel(int level) {
                                            int dir = (level > currentShutterLevel) ? DIRECTION_UP : DIRECTION_DOWN;
                                            if (isMoving && dir != directionUpDown) {
                                              shuttersHalt();
                                            }
                                            requestedShutterLevel = level;
                                          }
                                          
                                          void initShutters() {
                                          #ifdef MY_DEBUG
                                            Serial.println("Init Cover");
                                          #endif
                                            shuttersUp();
                                            wait((rollTime + timeOneLevel * LEVELS) * 1000);
                                            currentShutterLevel = STATE_UP;
                                            requestedShutterLevel = currentShutterLevel;
                                          }
                                          
                                          void receive(const MyMessage &message) {
                                          #ifdef MY_DEBUG
                                            Serial.println("recieved incomming message");
                                            Serial.println("Recieved message for sensor: ");
                                            Serial.println(String(message.sensor));
                                            Serial.println("Recieved message with type: ");
                                            Serial.println(String(message.type));
                                          #endif
                                            if (message.sensor == CHILD_ID_COVER) {
                                              switch (message.type) {
                                                case V_UP:
                                                  //Serial.println(", New status: V_UP");
                                                  changeShuttersLevel(STATE_UP);
                                                  //state = UP;
                                                  //sendState();
                                                  break;
                                          
                                                case V_DOWN:
                                                  //Serial.println(", New status: V_DOWN");
                                                  changeShuttersLevel(STATE_DOWN);
                                                  //state = DOWN;
                                                  //sendState();
                                                  break;
                                          
                                                case V_STOP:
                                                  //Serial.println(", New status: V_STOP");
                                                  shuttersHalt();
                                                  //state = IDLE;
                                                  //sendState();
                                                  break;
                                          
                                                case V_PERCENTAGE:
                                                  //Serial.println(", New status: V_PERCENTAGE");
                                                  //          if (!initial_state_sent) {
                                                  //            #ifdef MY_DEBUG
                                                  //            Serial.println("Receiving initial value from controller");
                                                  //            #endif
                                                  //            initial_state_sent = true;
                                                  //          }
                                                  int per = message.getInt();
                                                  if (per > STATE_UP) {
                                                    per = STATE_UP;
                                                  }
                                                  changeShuttersLevel(per);
                                                  //InitShutters(message.getInt());//send value < 0 or > 100 to calibrate
                                                  //sendState();
                                                  break;
                                              }
                                            } 
                                          else if (message.sensor ==  CHILD_ID_SET) {
                                          
                                              if (message.type == V_VAR1) {
                                                #ifdef MY_DEBUG
                                                Serial.println(", New status: V_VAR1, with payload: ");
                                                #endif      
                                                String strRollTime = message.getString();
                                                rollTime = strRollTime.toFloat();
                                                #ifdef MY_DEBUG
                                                Serial.println("rolltime value: ");
                                                Serial.println(String(rollTime));
                                                #endif
                                                saveState(CHILD_ID_SET, rollTime);
                                              }
                                            }
                                          #ifdef MY_DEBUG
                                            Serial.println("exiting incoming message");
                                          #endif
                                            return;
                                          }
                                          
                                          void before() {
                                          
                                            // Setup the button
                                            pinMode(BUTTON_UP_PIN, INPUT_PULLUP);
                                            // Activate internal pull-up
                                          //  digitalWrite(BUTTON_UP_PIN, HIGH);
                                            //  attachInterrupt(digitalPinToInterrupt(BUTTON_UP_PIN), upButtonPress, FALLING);
                                          
                                            pinMode(BUTTON_DOWN_PIN, INPUT_PULLUP);
                                            // Activate internal pull-up
                                          //  digitalWrite(BUTTON_DOWN_PIN, HIGH);
                                            //  attachInterrupt(digitalPinToInterrupt(BUTTON_DOWN_PIN), downButtonPress, FALLING);
                                          
                                          //  pinMode(BUTTON_STOP_PIN, INPUT_PULLUP);
                                            // Activate internal pull-up
                                          //  digitalWrite(BUTTON_STOP_PIN, HIGH);
                                          
                                            // After setting up the button, setup debouncer
                                            debouncerUp.attach(BUTTON_UP_PIN);
                                            debouncerUp.interval(5);
                                            // After setting up the button, setup debouncer
                                            debouncerDown.attach(BUTTON_DOWN_PIN);
                                            debouncerDown.interval(5);
                                            // After setting up the button, setup debouncer
                                          //  debouncerStop.attach(BUTTON_STOP_PIN);
                                          //  debouncerStop.interval(5);
                                          
                                            // Make sure relays are off when starting up
                                            digitalWrite(RELAY_UP_PIN, RELAY_OFF);
                                            // Then set relay pins in output mode
                                            pinMode(RELAY_UP_PIN, OUTPUT);
                                          
                                            // Make sure relays are off when starting up
                                            digitalWrite(RELAY_DOWN_PIN, RELAY_OFF);
                                            // Then set relay pins in output mode
                                            pinMode(RELAY_DOWN_PIN, OUTPUT);
                                          }
                                          
                                          void presentation() {
                                            // Send the sketch version information to the gateway and Controller
                                            sendSketchInfo(SKETCH_NAME, SKETCH_VER);
                                            // Register all sensors to gw (they will be created as child devices)
                                            present(CHILD_ID_COVER, S_COVER, PRESENT_MESSAGE, IS_ACK);
                                            // present(CHILD_ID_SET, S_CUSTOM);
                                          }
                                          
                                          void setup(void) {
                                            //set up roll time if the saved value is not 255
                                            #ifdef MY_DEBUG
                                            Serial.println("getting rolltime from eeprom: ");
                                            #endif
                                            float tmpRollTime = loadState(CHILD_ID_SET);
                                            if (tmpRollTime != 0xff) {
                                              rollTime = tmpRollTime;
                                            }
                                            #ifdef MY_DEBUG
                                            Serial.println(String(rollTime));
                                            #endif
                                            
                                            int state = loadState(CHILD_ID_COVER);
                                            
                                            #ifdef MY_DEBUG
                                            Serial.println("getting state from eeprom: ");
                                            Serial.println(String(state));
                                            #endif
                                            
                                          //  if (state == 0xff) {
                                          //    initShutters();
                                          //  } else {
                                              currentShutterLevel = state;
                                              requestedShutterLevel = state;
                                          //  }
                                          }
                                          
                                          void loop(void) {
                                            if (!initial_state_sent) {
                                          #ifdef MY_DEBUG
                                              Serial.println("Sending initial value");
                                          #endif
                                              sendState();
                                              
                                             // send(msgCode.set('20.0'));
                                              //    #ifdef MY_DEBUG
                                              //    Serial.println("Requesting initial value from controller");
                                              //    #endif
                                              //    request(CHILD_ID_COVER, V_PERCENTAGE);
                                              //    wait(2000, C_SET, V_PERCENTAGE);
                                              initial_state_sent = true;
                                            }
                                          
                                            debouncerUp.update();
                                            value = debouncerUp.read();
                                            if (value == 0 && value != oldValueUp) {
                                              if(isMoving){
                                                shuttersHalt();
                                              }  
                                              else{
                                              calibrateUp = false;
                                              calibratedUp = false;
                                              changeShuttersLevel(STATE_UP);
                                              }
                                              //state = UP;
                                              //sendState();
                                            }
                                            oldValueUp = value;
                                          
                                            debouncerDown.update();
                                            value = debouncerDown.read();
                                            if (value == 0 && value != oldValueDown) {
                                              if(isMoving){
                                                shuttersHalt();
                                              }  
                                              else{
                                              calibrateDown = false;
                                              calibratedDown = false;
                                              changeShuttersLevel(STATE_DOWN);
                                              }    
                                              //state = DOWN;
                                              //sendState();
                                            }
                                            oldValueDown = value;
                                          
                                          /*  debouncerStop.update();
                                            value = debouncerStop.read();
                                            if (value == 0 && value != oldValueStop) {
                                              shuttersHalt();
                                              //state = IDLE;
                                              //sendState();
                                            }
                                            oldValueStop = value;
                                          */
                                            if(currentShutterLevel != 100)
                                            {
                                              calibrateUp = false;
                                              calibratedUp = false;
                                            }
                                            if(currentShutterLevel != 0)
                                            {
                                              calibrateDown = false;
                                              calibratedDown = false;
                                            }
                                            
                                            if (isMoving) 
                                            {
                                              unsigned long _now = millis();
                                              if (_now - lastLevelTime >= timeOneLevel * 1000) {
                                                if (directionUpDown == DIRECTION_UP) {
                                                  currentShutterLevel += 1;
                                                } else {
                                                  currentShutterLevel -= 1;
                                                }
                                                currentShutterLevel = constrain(currentShutterLevel, 0, 100);
                                                #ifdef MY_DEBUG
                                                Serial.println(String(requestedShutterLevel));
                                                Serial.println(String(currentShutterLevel));
                                                #endif
                                                lastLevelTime = millis();
                                                send(msgPercentage.set(currentShutterLevel));
                                              }
                                              if (currentShutterLevel == requestedShutterLevel) 
                                              {
                                                if(currentShutterLevel == 0 && !calibratedDown)
                                                {
                                                  if(calibrateDown == false)
                                                  {
                                                    calibrateDown = true;
                                                    calibratedDown = false;
                                                    calibrationStartTime = _now;
                                                  }
                                                  else 
                                                  {
                                                    if(calibratedDown == false)
                                                    {
                                                      if (_now - calibrationStartTime >= calibrationTime * 1000)
                                                      {
                                                       calibratedDown = true;
                                                      }
                                                    }
                                                  }
                                                }
                                                else if (currentShutterLevel == 100 && !calibratedUp)
                                                {
                                                  if(calibrateUp == false)
                                                  {
                                                    calibrateUp = true;
                                                    calibratedUp = false;
                                                    calibrationStartTime = _now;
                                                  }
                                                  else 
                                                  {
                                                    if(calibratedUp == false)
                                                    {
                                                      if (_now - calibrationStartTime >= calibrationTime * 1000)
                                                      {
                                                       calibratedUp = true;
                                                      }
                                                    }
                                                  }
                                                }
                                                else
                                                {
                                                  shuttersHalt();
                                                }
                                              }
                                            } 
                                            else 
                                            {
                                              if (requestedShutterLevel != currentShutterLevel) 
                                              {
                                                if (requestedShutterLevel > currentShutterLevel) {
                                                  shuttersUp();
                                                }
                                                else {
                                                  shuttersDown();
                                                }
                                                lastLevelTime = millis();
                                              }
                                            }
                                          }
                                          
                                          pepsonP Offline
                                          pepsonP Offline
                                          pepson
                                          wrote on last edited by
                                          #37

                                          And is any chance to run gateway on RPI3 but on old default driver not with NEW DRIVER ?

                                          Anybody has any solution for my problem with communication on version 2.3.0 ?

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          18

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.1k

                                          Posts


                                          Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • MySensors
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular