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

General Raspbian info for the C2

Discussion in 'Mods and Upgrades' started by OutsourcedGuru, Jul 8, 2017.

  1. OutsourcedGuru

    OutsourcedGuru Active Member

    Joined:
    Jun 3, 2017
    Messages:
    752
    Likes Received:
    141
    Earlier, I had a theory that the standard 4GB microSD wouldn't be enough for the Raspberry Pi NoIR v2 camera. So I thought I'd do a little math...

    Note that I upgraded mine to a 16GB microSD and running df during a streaming session:
    Code:
    $ df
    Filesystem     1K-blocks    Used Available Use% Mounted on
    /dev/root       15215832 2361304  12212912  17% /
    devtmpfs          437048       0    437048   0% /dev
    tmpfs             441384       0    441384   0% /dev/shm
    tmpfs             441384    6032    435352   2% /run
    tmpfs               5120       4      5116   1% /run/lock
    tmpfs             441384       0    441384   0% /sys/fs/cgroup
    /dev/mmcblk0p1     64456   21312     43144  34% /boot
    /dev/sda1         974604  684700    289904  71% /home/pi/.octoprint/uploads/USB
    So about 17% of that 16GB is in use now (2.72GB). If I were on that original 4GB drive it would be at 68% used, then. Not really sure if that's pushing the limit but I do know that UNIX systems have a way of eating up log space unless they're routinely groomed by an admin.

    Doing an ls -l /var/log shows me that already my Raspi is logging a variety of activities. I doubt if there's any buttons/wizards which clean all this up. (I remember having a Redhat Linux box which "logged itself to death" once.)

    I note that Samba appears to be available, although not loaded. Basically, this means that you could "share" a directory area either on the microSD or the USB disk itself. And then, you could "net use" that share from a Windows or OS X computer. In fact, you could even "net use" from the Raspi itself to a share on another computer. This means that you could technically just print files from the network. Basically, modifying /etc/samba/smb.conf, adding one or more smb users and starting the service is about all that's necessary. It's possible that they're using Samba to share the printer and nothing more.

    A ps -ax will show a variety of things running. I'm surprised to see haproxy running; I have no idea why they'd be using a load balancer on this. This one appears to be the communications thread to the RAMPS board: /sbin/agetty --keep-baud 115200 38400 9600 ttyS0 vt10.
     
  2. WheresWaldo

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

    Joined:
    Feb 18, 2015
    Messages:
    5,905
    Likes Received:
    3,593
    HAProxy is used so that you can have clean urls to access the OctoPi build as well as the webcam and access it via port 80.

    Notice I said it was OctoPi and not OctoPrint. that is because RoboOS is built on GuySoft's OctoPi and if you are interested in why certain things are in the build then you can see Guysoft's GITHUB for more information.

    If you remove all the nonessential packages you can actually get the image under 2GB.
     
    #2 WheresWaldo, Jul 8, 2017
    Last edited: Jul 8, 2017
  3. OutsourcedGuru

    OutsourcedGuru Active Member

    Joined:
    Jun 3, 2017
    Messages:
    752
    Likes Received:
    141
    So it's using pybonjour to advertise its hostname on the local network. As suggested before, you might not have to use the IP address to ssh into the Raspi or to get to OctoPrint.

    Looks like you can tweak ~/scripts/webcamDaemon if you want to change the default resolution or fps for that.

    If you want to embed your realtime stream, http://my-c2.local:8080/?action=stream and http://my-c2.local:8080/?action=snapshot for a single photo.

    On the http://my-c2.local OctoPrint server when it's not printing, you can do a number of keyboard shortcuts to control the motors.

    1 -> jog=0.1mm
    2 -> jog=1mm
    3 -> jog=10mm
    4 -> jog=100mm
    left/right cursor -> x-/x+
    up/down cursor -> y-/y+
    s and then...
    PgUp -> z-
    PgDn -> z+

    Looks like if you could edit /etc/wpa_supplicant/wpa_supplicant.conf you could manually add your wi-fi's credentials, if you had some UPPERCASE characters in your password, for example.

    If you're into SSL, it looks like https://my-c2.local also works (with a self-signed certificate).

    I'm thinking that the main OctoPrint HTML is under ~/oprint/bin/octoprint. I would guess that changing the following in index.html would allow you to see the manually-adjusted target hotend temperature rather than just a single digit of that (an existing style bug).

    Code:
    <div class=“input-append”>
    <input type="number" class="input-mini text-right tempInput" data-bind="attr: {placeholder: cleanTemperature(target()) }, value: newTarget, enable: $root.isOperational() &amp;&amp; $root.loginState.isUser(), event: { keyup: function(d, e) {$root.handleEnter(e, 'target', $data);} }" placeholder="205">
    <span class="add-on">°C</span>
    In this case, input-mini for Target needs to be changed to input-small, input-medium or input-large from the Bootstrap stylesheet.
     
  4. WheresWaldo

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

    Joined:
    Feb 18, 2015
    Messages:
    5,905
    Likes Received:
    3,593
    Personally I would just dump Robotheme and use the standard Octoprint interface.

    I already mentioned on the other thread with the user concerned about Upper case passphrases for wifi, that you could do it through the command line using ssh.

    Look at Guysoft's github and you can see how he installed Octoprint in a non-default directory. I was able to duplicate all the functionality of RoboOS without the additions that phone home and using the default OctoPrint installation.
     
  5. Kilrah

    Kilrah Well-Known Member

    Joined:
    Apr 18, 2017
    Messages:
    498
    Likes Received:
    332
    For the caps you can also use the onscreen shift key...
     
  6. OutsourcedGuru

    OutsourcedGuru Active Member

    Joined:
    Jun 3, 2017
    Messages:
    752
    Likes Received:
    141
    I spent an hour yesterday walking his scripts. He's actually impressive in his attention to detail. Creds to the guy.
     
  7. OutsourcedGuru

    OutsourcedGuru Active Member

    Joined:
    Jun 3, 2017
    Messages:
    752
    Likes Received:
    141
    Seriously, you'd have to be crazy to do this like me...

    Noting the modification for fixing the style bug on the OctoPrint in which only one of the three digits of the manually-set hotend target is currently displayed.

    Before: (see width of editable Target temperature)

    Screen Shot 2017-07-09 at 4.04.01 PM.png

    For piece of mind, I'm using ApplePi-Baker to make a before-image of my 16GB microSD before doing this. The next step involves making a modification to a single HTML file and then rebuilding the OctoPrint Python .egg file (which is like a .jar file in the Java world).

    Code:
    $ ssh pi@my-c2.local
    $ cd ~/OctoPrint/src/octoprint/templates/tabs
    nano temperature.jinja2
      # Edit line 26
      # Before:  class="input-mini text-right tempInput"
      # After: class="input-small text-right tempInput"
      Ctrl-O, Enter, Ctrl-X
    $ cd ~/OctoPrint
      # From your workstation visiting the OctoPrint screen, choose System -> Shutdown OctoPrint
    $ /usr/bin/python setup.py build
    $ sudo /usr/bin/python setup.py install
    $ cd dist
    $ ls -l
    -rw-r--r-- 1 pi   pi   2043652 Nov 21  2016 OctoPrint-1.2.17-py2.7.egg
    -rw-r--r-- 1 root root 2620589 Jul  9 17:34 OctoPrint-1.3.4.post0.dev0_gfe481e1-py2.7.egg
    -rw-r--r-- 1 pi   pi   2619443 Jun  3 07:48 OctoPrint-1.3.4-py2.7.egg
    $ cp OctoPrint-1.3.4-py2.7.egg OctoPrint-1.3.4-py2.7.egg.save
    $ cp OctoPrint-1.3.4.post0.dev0_gfe481e1-py2.7.egg OctoPrint-1.3.4-py2.7.egg
    
    Unfortunately, this doesn't appear to work.

    So... I'm going to restore the earlier image and revert back to that. I'll open an issue on the OctoPrint and OctoPi repositories and wait the unknown amount of time for both to fix this rather annoying bug. (I really don't like the idea that this is open sourced, compared with my inability to just fix something that's obviously wrong.)
     
  8. mark tomlinson

    mark tomlinson ༼ つ ◕_ ◕ ༽つ
    Staff Member

    Joined:
    Feb 21, 2013
    Messages:
    23,912
    Likes Received:
    7,338
    Don't know if it ever came up, but I loathe Python (and I get paid to write code*).


    *herding cats is easier
     
  9. OutsourcedGuru

    OutsourcedGuru Active Member

    Joined:
    Jun 3, 2017
    Messages:
    752
    Likes Received:
    141
    Recently had a go at raspberrypi.org's forum where I was trying to convince them that JavaScript is a legitimate language and that they should not only include it in their forum under languages, they should encourage more examples in it. I got nothing but grief from 80% of the Python-ers over there. :mad:
     
  10. mark tomlinson

    mark tomlinson ༼ つ ◕_ ◕ ༽つ
    Staff Member

    Joined:
    Feb 21, 2013
    Messages:
    23,912
    Likes Received:
    7,338
    Well, I hate to (*cough*) be associated with that lot, but I kind-of agree ;)
    However, in my boat, BOTH of them are scripting languages (like, say HTML).
     
  11. mark tomlinson

    mark tomlinson ༼ つ ◕_ ◕ ༽つ
    Staff Member

    Joined:
    Feb 21, 2013
    Messages:
    23,912
    Likes Received:
    7,338
    But regardless of what you use, the work you get done is what matters. I don't care if you write it in APL (which I also loathed) if your code works... it works and is a good thing
     
  12. OutsourcedGuru

    OutsourcedGuru Active Member

    Joined:
    Jun 3, 2017
    Messages:
    752
    Likes Received:
    141
    It sucks that I see the problem, I *finally* find the underlying HTML file and figure out their stylesheet(s), *finally* figure out how to re-compile this pile of code... and then... nothing. Okay, it cooks up another egg. Okay, I over copy the one that should be the live one. Nothing. Pfft.

    I'm used to having more control over things than this. I've just spent about four hours sleuthing this thing and it's not worth it if I can't easily tweak the software side.
     
  13. Kilrah

    Kilrah Well-Known Member

    Joined:
    Apr 18, 2017
    Messages:
    498
    Likes Received:
    332
    You're trying to edit the stock Octoprint theme, not the Robo theme.

    Live code for the Robo theme is in /home/pi/oprint/lib/python2.7/site-packages/octoprint_robotheme/static
     
    OutsourcedGuru and WheresWaldo like this.
  14. WheresWaldo

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

    Joined:
    Feb 18, 2015
    Messages:
    5,905
    Likes Received:
    3,593
    Just fork the octoprint_robotheme repository and then edit code to your hearts content. It is then as simple as removing the original octoprint_robotheme add on then adding yours by specifying the GITHUB and then enjoy or detest your new code. Restoring the original is just as simple as reversing the steps. Absolutely no need to edit anything directly on the rPi. There is at least that to be said about open source software.

    After all robotheme is implemented as an OctoPrint addon.
     
    mark tomlinson likes this.
  15. OutsourcedGuru

    OutsourcedGuru Active Member

    Joined:
    Jun 3, 2017
    Messages:
    752
    Likes Received:
    141
    Sweet Jebus! Thanks, dude.

    :laugh: Look at that path. No wonder I couldn't find it. Who in their right mind would put the website under lib?
     
  16. OutsourcedGuru

    OutsourcedGuru Active Member

    Joined:
    Jun 3, 2017
    Messages:
    752
    Likes Received:
    141
    I may eventually write-up a great big coder's manual for this thing (like I did for my oscilloscope, given the absence of same). I just have to first get into the correct development cycle for this.
     
  17. Kilrah

    Kilrah Well-Known Member

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

    The whole python "virtual environment" principle basically makes a completely new, isolated copy of python in which all packages related to the project are installed so as not to interfer with other stuff.
     
  18. OutsourcedGuru

    OutsourcedGuru Active Member

    Joined:
    Jun 3, 2017
    Messages:
    752
    Likes Received:
    141
    I'll give you that.

    If you've got a one-trick-pony like the Robo I suppose that's alright.
     
  19. Kilrah

    Kilrah Well-Known Member

    Joined:
    Apr 18, 2017
    Messages:
    498
    Likes Received:
    332
    It's not Robo-specific, it's Octoprint that's designed to use the Python virtual environment system.
     
    mark tomlinson and Geof like this.
  20. mark tomlinson

    mark tomlinson ༼ つ ◕_ ◕ ༽つ
    Staff Member

    Joined:
    Feb 21, 2013
    Messages:
    23,912
    Likes Received:
    7,338
    Yea, can't blame this one on Robo... just the Python people...
     

Share This Page