• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

MMM-Navigate, Navigation inside MagicMirror with Rotary Encoder

Scheduled Pinned Locked Moved System
45 Posts 6 Posters 16.8k Views 5 Watching
Loading More Posts
  • 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.
  • E Offline
    Eisblume
    last edited by May 25, 2019, 5:47 PM

    @AxLed
    Yes very interesting experiences :-) !

    Could you explain my how to start “Tagesschau in 100 Sekunden” in MMM-Navigate ??

    1 Reply Last reply Reply Quote 0
    • A Offline
      AxLed Module Developer
      last edited by May 25, 2019, 6:22 PM

      @Eisblume
      You need two things:

      • first: a modules which is able to stream 100Sec Tagesschau, i made a fork see MMM-Podcast2
      • second: the right config (i posting only the relevant part)
      ....
      {
      			module: 'MMM-Podcast2',
      			config: {
      				// See 'Configuration options' for more information.
      				omxargs: ' --win 0,0,1920,1080  -o both '
      			}
      		},
      {
      			module: "MMM-Navigate",
      			header: "Navigation",
      			position: "top_right",
      			config: {
      					Alias: [
      						'Tagesschau 100 Sekunden',
      						'Herunterfahren'
      					],
      					Action: [
      						{notification:'BUTTON_PRESSED',payload:''},
      						{notification: "REMOTE_ACTION", payload: {action: "SHUTDOWN"}}
      					],
      					GPIOPins: [26,20,19]//rotary cw, rotary ccw, rotary press (BCM Numbering)
      					},
      		},
      ...
      

      AxLED

      E 1 Reply Last reply May 25, 2019, 8:40 PM Reply Quote 0
      • E Offline
        Eisblume @AxLed
        last edited by May 25, 2019, 8:40 PM

        @AxLed said in MMM-Navigate, Navigation inside MagicMirror with Rotary Encoder:

        {notification:‘BUTTON_PRESSED’,payload:‘’},

        Thanks. Works perfect !!!

        1 Reply Last reply Reply Quote 0
        • K Offline
          keineAhnung123
          last edited by Jan 8, 2021, 5:08 PM

          Hello @AxLed ,

          Two things:

          First

          I have the same issue like @Eisblume :

          The click doesnt work.
          When i then start a sample code to test the rotary encoder (from like here), the click works in the sample code.
          If i start the Magic Mirror after that again, then the click works there too.

          Maybe there is a missing initialization of the rotary encoder in your code?

          Second

          Is there a possibility to get more config possibilities?
          Like starting the module hidden or shortening the time of the hiding process?

          Thanks in advance :)

          1 Reply Last reply Reply Quote 0
          • A Offline
            AxLed Module Developer
            last edited by Jan 8, 2021, 6:36 PM

            @keineAhnung123,

            to your first issue:

            • is only click not working or is rotation also not working?
              Because rotation and click (Button press) uses the same library (onOff).
            • on which pin is click connected, as the pi GPIO Pins have different features?
            • what versions you are using (pi, OS, MM-Version)?

            To your second issue.

            • MMM-Navigate uses the MM notification system, so you can do almost everything you want. What are you trying to to, maybe i can give you a sample for your config.js
            • for shortening time of hidding see MM Docs -> search for hide, there is a parameter for speed.

            Regards

            AxLED

            1 Reply Last reply Reply Quote 0
            • K Offline
              keineAhnung123
              last edited by Jan 9, 2021, 8:33 AM

              Hello @AxLed , thanks for your reply

              first

              • rotation works fine but the button press does not
              • i use your standard configuration so it seems to be BCM 19
              • PI 3 B+, stretch, MM 2.14.0

              I tried MMM-Buttons too. Same problem there. I first have to run a sample script with python and after that the button works in MM too. It uses the onoff library too.

              I found a strange behaviour:
              I start MM -> button click doesnt work
              I start python test script and after that MM -> button click works
              When i restart the Raspberry PI and start MM (without the python test script) -> button click works
              When i shutdown the Raspberry PI and cut off the connection to an electricity source and restart the PI after that -> button click doesnt work

              Thats strange isnt it?

              second

              I changed the hiding time from 10000 to 2000 cause i prefer a shorter time.
              Is there a way to start the module hidden?
              I tried following:

                  // Define start sequence.
              
                  start: function() {
              
                      Log.info("Starting module: " + this.name);
              
                      this.sendConfig();//pass config to node_helper.js
              
                      this.hide();
              
                  },
              

              and this

                  //Helper, to use module without Rotary Encoder and without GPIO Pins, like developing in Pixel VM
              
                  notificationReceived: function(notification, payload) {
              
                      if(notification === "CW" || notification === "CCW" || notification === "PRESSED"){
              
                          this.naviaction({inputtype: ""+ notification +""});
              
                      }
              
                      if(notification === "SHELLCOMMAND"){
              
                           this.sendSocketNotification(notification, payload);
              
                      } 
              
                      if(notification === "MODULE_DOM_CREATED"){
              
                           this.hide();
              
                      }
              
                  },
              

              but both didnt take effect :(

              third

              I found an reproducable error:
              When i start MM and first rotate counterclockwise there is an error in the MM console:

              [09.01.2021 09:11.07.337] [LOG]   MMM-Navigate, listen on GPIO PINs (BCM): 26,20,19
              
              [09.01.2021 09:11.18.306] [ERROR] Whoops! There was an uncaught exception...
              [09.01.2021 09:11.18.321] [ERROR] ReferenceError: lastdir is not defined
                  at tick (/home/pi/MagicMirror/modules/MMM-Navigate/node_helper.js:92:39)
                  at /home/pi/MagicMirror/modules/MMM-Navigate/node_helper.js:66:4
                  at /home/pi/MagicMirror/modules/MMM-Navigate/node_modules/onoff/onoff.js:135:9
                  at Array.forEach (<anonymous>)
                  at pollerEventHandler (/home/pi/MagicMirror/modules/MMM-Navigate/node_modules/onoff/onoff.js:134:32)
              

              It doesnt effect the functionality but just wanted to mention it… ;)

              1 Reply Last reply Reply Quote 0
              • A Offline
                AxLed Module Developer
                last edited by Jan 9, 2021, 10:59 AM

                @keineAhnung123,

                thanks for feedback.
                first:
                Idea A:

                • maybe the pin 19 is the problem, because it is not only a GPIO pin rather it has SPI features. Can you change to BCM16 (and change it in config.js as well) and try it?

                Idea B:

                • Do you use capacitors for debouncing? If not, you can change debouncing value of following line: https://github.com/Ax-LED/MMM-Navigate/blob/master/node_helper.js#L37

                second:

                • Which module should start hidden? MMM-Navigate?

                third:
                I tried to reproduce on my pi 3 and get no error, so i checked the code.
                You can add following line as new line 19 in node_helper.js
                var lastdir = '';

                AxLED

                1 Reply Last reply Reply Quote 0
                • K Offline
                  keineAhnung123
                  last edited by Jan 9, 2021, 11:13 AM

                  @AxLed
                  I will try that later. Thanks
                  And yes, i want to start MMM-Navigate hidden. Is that possible?

                  1 Reply Last reply Reply Quote 0
                  • A Offline
                    AxLed Module Developer
                    last edited by Jan 9, 2021, 7:41 PM

                    @keineAhnung123 ,

                    informations to your second issue:
                    Your request is not provided by MMM-Navigate, maybe it is possible with one of the following modules (untested):

                    • MMM-ModuleScheduler
                    • MMM-ModuleToggle

                    AxLED

                    1 Reply Last reply Reply Quote 0
                    • K Offline
                      keineAhnung123
                      last edited by Jan 10, 2021, 10:36 AM

                      Hello @AxLed

                      first

                      • Idea A: didnt solve the problem. Still no click
                      • Idea B: I tried capacitors and software debouncing. Still no click

                      I will use this python script to get the click working:

                      import RPi.GPIO as GPIO
                      GPIO.setmode(GPIO.BCM)
                      BUTTON_PIN = 16
                      GPIO.setup(BUTTON_PIN, GPIO.IN, pull_up_down = GPIO.PUD_UP)
                      

                      and start it within node_helper.js:

                      var child_process = require('child_process');
                      
                      module.exports = NodeHelper.create({
                      	// Subclass start method.
                        start: function() {
                      		var self = this;
                      		this.loaded = false;
                      		this.createRoutes();
                      		child_process.execFile('python', ['/home/pi/MagicMirror/modules/MMM-Navigate/ky-040-initialisieren.py']);
                      	},
                      

                      Now it works.

                      Btw: In intializeRotary-function (node_helper.js) there ist a CLK and DT.read and also a CLK and DT.watch instruction. For the SW there is only a SW.watch but not a read instruction. Is that right? Just wanted to mention. Im not an expert in programming.

                      third
                      Yes, the error is gone :)

                      1 Reply Last reply Reply Quote 0
                      • 1
                      • 2
                      • 3
                      • 4
                      • 5
                      • 4 / 5
                      • First post
                        Last post
                      Enjoying MagicMirror? Please consider a donation!
                      MagicMirror created by Michael Teeuw.
                      Forum managed by Sam, technical setup by Karsten.
                      This forum is using NodeBB as its core | Contributors
                      Contact | Privacy Policy