1. Got a question or need help troubleshooting? Post to the troubleshooting forum or Search the forums!

Some software tips and tricks

Discussion in 'Software' started by Kilrah, Jul 9, 2017.

  1. Kilrah

    Kilrah Well-Known Member

    Joined:
    Apr 18, 2017
    Messages:
    498
    Likes Received:
    332
    A little list of the few tweaks I did to my system to get it how I want it, after backing up /making a copy of the card of course:

    Connect via ssh to your printer either via ip (seen on the LCD in Network->Network status) or [printer-name.local], user: pi, password: raspberry

    Basic configuration:
    Code:
    sudo raspi-config
    - Expand filesystem (I had a 8GB card, but the partition is sized for 4GB)
    - Change user password (that ssh password)
    - Internationalization options (choose correct timezone)
    - Advanced Options - Change Hostname (customise printer name)

    Start webcam automatically on startup:
    Code:
    crontab -e
    Confirm creation
    At the bottom of the file add:
    @reboot ~/scripts/webcam start

    Change hotspot name/pw (e.g. to match the new printer name you chose earlier):
    Code:
    sudo nano /etc/netconnectd.yaml
    psk: [desired password]
    ssid: [desired name]
     
    supercazzola and OutsourcedGuru like this.
  2. mark tomlinson

    mark tomlinson ༼ つ ◕_ ◕ ༽つ
    Staff Member

    Joined:
    Feb 21, 2013
    Messages:
    23,912
    Likes Received:
    7,338
    This may be incorrect for certain DHCP non-routeable IP address ranges. It works fine if your router is using 192.168.x, but I have several others and most of them it will still try to display it as a 192 subnet (when it is not) and what you get on the screen is a bogus IP address :)
     
  3. Kilrah

    Kilrah Well-Known Member

    Joined:
    Apr 18, 2017
    Messages:
    498
    Likes Received:
    332
    Interesting! Didn't know of the display bug.
     
  4. mark tomlinson

    mark tomlinson ༼ つ ◕_ ◕ ༽つ
    Staff Member

    Joined:
    Feb 21, 2013
    Messages:
    23,912
    Likes Received:
    7,338
    It is funny/sad.
    Mine for example show up on the LCD as something like: 198.105.254.130 when the actual IP is: 10.0.0.174

    This is true on the Robo Beta and R1 that we have adapted to use Robo OS via a Pi and LCD as well as the C2 from whence I copied that hardware :)
     
  5. mark tomlinson

    mark tomlinson ༼ つ ◕_ ◕ ༽つ
    Staff Member

    Joined:
    Feb 21, 2013
    Messages:
    23,912
    Likes Received:
    7,338
    As far as I am concerned they need to correctly work for any IP range/subnet and certainly all of the non-routeable ones: 10.0.0.0 - 10.255.255.255, 172.16.0.0 - 172.31.255.255, 192.168.0.0 - 192.168.255.255


    I have a sneaky suspicion that they defaulted their code to 192.168.0.0 - 192.168.255.255
     
  6. Kilrah

    Kilrah Well-Known Member

    Joined:
    Apr 18, 2017
    Messages:
    498
    Likes Received:
    332
    I don't talk python but the relevant code is unreadable regardless of language... and I have no idea what it's doing trying to connect to Google's DNS servers.

    Code:
    def get_ip(self):
            return [l for l in ([ip for ip in socket.gethostbyname_ex(socket.gethostname())[2] if not ip.startswith("127.")][:1], [[(s.connect(('8.8.8.8', 53)), s.getsockname()[0], s.close()) for s in [socket.socket(socket.AF_INET, socket.SOCK_DGRAM)]][0][1]]) if l][0][0]
    
     
    #6 Kilrah, Jul 9, 2017
    Last edited: Jul 9, 2017
  7. mark tomlinson

    mark tomlinson ༼ つ ◕_ ◕ ༽つ
    Staff Member

    Joined:
    Feb 21, 2013
    Messages:
    23,912
    Likes Received:
    7,338
  8. WheresWaldo

    WheresWaldo Volunteer ( ͠° ͟ʖ ͡°)
    Staff Member

    Joined:
    Feb 18, 2015
    Messages:
    5,905
    Likes Received:
    3,593
    I think the issue is in the roboLCD not really OctoPrint. Robo used to have the source code on GITHUB but I can't find it now. It is using the Kivy library and was a fork of someone else's base, but I can't remember who. It still might be in Allen McAfee's GITHUB

    https://github.com/AllenMcAfee/OctoPrint-Lcd
     
    mark tomlinson likes this.
  9. mark tomlinson

    mark tomlinson ༼ つ ◕_ ◕ ༽つ
    Staff Member

    Joined:
    Feb 21, 2013
    Messages:
    23,912
    Likes Received:
    7,338
    Yep, I agree. Someone made a silly assumption somewhere.
     
  10. Kilrah

    Kilrah Well-Known Member

    Joined:
    Apr 18, 2017
    Messages:
    498
    Likes Received:
    332
  11. WheresWaldo

    WheresWaldo Volunteer ( ͠° ͟ʖ ͡°)
    Staff Member

    Joined:
    Feb 18, 2015
    Messages:
    5,905
    Likes Received:
    3,593
    I tried adding a few issues that I found in both McAfee's and Victor's GITHUB, buit they appear to just have ignored them, so I gave up.
     
  12. OutsourcedGuru

    OutsourcedGuru Active Member

    Joined:
    Jun 3, 2017
    Messages:
    752
    Likes Received:
    141
    Pretty sure that 198 IP address was the factory in China. I posted about this but it got deleted, FWIW.
     
  13. mark tomlinson

    mark tomlinson ༼ つ ◕_ ◕ ༽つ
    Staff Member

    Joined:
    Feb 21, 2013
    Messages:
    23,912
    Likes Received:
    7,338
    Maybe, but it is confusing because when I added the LCD mod and RoboOS to all of the other printers (which is cool, BTW) they all do the same thing, but with a slightly different IP. So it is almost like it is somehow mangling the actual IP address... To be clear they ARE connecting and do work, the LCD just reports the IP address as something hogwash...
     
  14. OutsourcedGuru

    OutsourcedGuru Active Member

    Joined:
    Jun 3, 2017
    Messages:
    752
    Likes Received:
    141
    Well, I know that on my MacBook if I plug it into its own ethernet switch as an island unto itself, it will generate and use some seemingly-random private IP address which isn't 198.168.x.x.

    I used the knowledge I'd obtained from the factory IP address to manually set the MacBook and use a back-to-back ethernet cable to talk to the printer, btw. That worked out great.
     
  15. mark tomlinson

    mark tomlinson ༼ つ ◕_ ◕ ༽つ
    Staff Member

    Joined:
    Feb 21, 2013
    Messages:
    23,912
    Likes Received:
    7,338
    There doesn't appear to be any easy way to stop/fix what these are reporting. It could well be a software glitch with the RoboOS.
    Just understand that if you are not on the 'normal' non-routeable subnet you may see weird things.

    They still work as expected, you can reach them via putty (or a web browser) at the expected fixed ip they are assigned. you just can't believe the LCD :)
     
  16. OutsourcedGuru

    OutsourcedGuru Active Member

    Joined:
    Jun 3, 2017
    Messages:
    752
    Likes Received:
    141
    Not that this will help you much but you might want to check your config.yaml. It's got a section in there where you could list localNetworks and 10.0.0.0/8 is missing from that.

    https://github.com/foosel/OctoPrint...1439003128/docs/configuration/config_yaml.rst

    And if you've tried to assign static IP addresses then this might help: https://github.com/guysoft/OctoPi/issues/219
     
    #16 OutsourcedGuru, Jul 12, 2017
    Last edited: Jul 12, 2017
  17. mark tomlinson

    mark tomlinson ༼ つ ◕_ ◕ ༽つ
    Staff Member

    Joined:
    Feb 21, 2013
    Messages:
    23,912
    Likes Received:
    7,338
    Only the LCD is suffering from any issues here. The Pi is fine and OctoPrint is fine.
    Simply what is displayed on the LCD as the IP address (if you punch down to that page) is incorrect.
     
  18. OutsourcedGuru

    OutsourcedGuru Active Member

    Joined:
    Jun 3, 2017
    Messages:
    752
    Likes Received:
    141
    There is an Ethernet nic and a wi-fi nic. You're expecting to see the wi-fi adapter's address on the LCD and you're probably seeing the factory-set Ethernet nic's adapter, right?

    ssh -> Raspi
    sudo ifconfig -a
    sudo hostname --ip-address
    sudo ip addr show

    I prefer ifconfig. If it's not otherwise installed:

    sudo apt-get install wireless-tools
     
  19. mark tomlinson

    mark tomlinson ༼ つ ◕_ ◕ ༽つ
    Staff Member

    Joined:
    Feb 21, 2013
    Messages:
    23,912
    Likes Received:
    7,338
    Nope it shows neither one of those correctly.
    In my case one is a 192.1.168.x subnet and the other is 10.0.0.x and what it displays on the LCD is nowhere close to correct for either one :)

    Bad LCD code...

    If I go on the Pi with Putty it displays the correct addresses. The LCD does NOT. so .. not the Pi at fault
     
  20. OutsourcedGuru

    OutsourcedGuru Active Member

    Joined:
    Jun 3, 2017
    Messages:
    752
    Likes Received:
    141
    Jebus. I guess I'll walk the code to see what it's trying to do. It's probably a wonky grep attempt.
     

Share This Page