Skip to content

Commit

Permalink
Merge pull request #26 from DexterInd/develop
Browse files Browse the repository at this point in the history
Bring Scratch and line follower into master
  • Loading branch information
RobertLucian authored Apr 3, 2019
2 parents ea61c81 + 480334c commit 2e47128
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 38 deletions.
23 changes: 16 additions & 7 deletions Scratch_GUI/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,26 @@ sudo rm -f /usr/share/raspi-ui-overrides/applications/scratch.desktop
sudo rm -f /usr/share/applications/scratch.desktop
sudo lxpanelctl restart
# Make shortcut executable
sudo chmod +x $PIHOME/Desktop/Scratch_Start.desktop # Desktop shortcut permissions.

# sudo rm /usr/share/applications/scratch.desktop # Remove the Scratch Start button in the Menu
# Desktop shortcut permissions.
sudo chmod +x $PIHOME/Desktop/Scratch_Start.desktop
# Remove the Scratch Start button in the Menu
# sudo rm /usr/share/applications/scratch.desktop

######
# Added these to solve the menu problem of scratch. Then removed them.
# These are removed for now, the call up the Scratch Gui, not the scratch start.
# sudo rm /usr/share/raspi-ui-overrides/applications/scratch.desktop # Remove the Scratch Start button in the Menu
# sudo cp /home/pi/$DEXTER/Scratch_GUI/Scratch_Start.desktop /usr/share/applications/scratch.desktop # Copy the Scratch_Start to the Menu
# sudo cp /home/pi/$DEXTER/Scratch_GUI/Scratch_Start.desktop /usr/share/raspi-ui-overrides/applications/scratch.desktop # Copy the Scratch_Start to the Menu
# sudo chmod 777 /usr/share/applications/scratch.desktop # Menu Shortcut Permissions.
# sudo chmod 777 /usr/share/raspi-ui-overrides/applications/scratch.desktop # Menu Shortcut Permissions.
# Desktop shortcut permissions.
# sudo rm /usr/share/raspi-ui-overrides/applications/scratch.desktop
# Remove the Scratch Start button in the Menu
# Copy the Scratch_Start to the Menu
# sudo cp /home/pi/$DEXTER/Scratch_GUI/Scratch_Start.desktop /usr/share/applications/scratch.desktop
# Copy the Scratch_Start to the Menu
# sudo cp /home/pi/$DEXTER/Scratch_GUI/Scratch_Start.desktop /usr/share/raspi-ui-overrides/applications/scratch.desktop
# Menu Shortcut Permissions.
# sudo chmod 777 /usr/share/applications/scratch.desktop
# Menu Shortcut Permissions.
# sudo chmod 777 /usr/share/raspi-ui-overrides/applications/scratch.desktop

# # Make run_scratch_gui executable.
sudo chmod +x $FINAL_SCRATCH_PATH/Scratch_Start.sh
Expand Down Expand Up @@ -136,6 +144,7 @@ if [ $VERSION -eq '8' ] ; then
echo "remoteconnectiondialog = 0" > /home/pi/.scratch.ini
elif [ $VERSION -eq '9' ] ; then
# associate Scratch file to our program
sudo apt-get install nuscratch
cp -f $FINAL_SCRATCH_PATH/mimeapps.list $PIHOME/.config/
fi

Expand Down
17 changes: 13 additions & 4 deletions miscellaneous/auto_detect_robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,21 @@

import sys
import time # import the time library for the sleep function
from smbus import SMBus

import os
import serial
from shutil import copyfile
import re

bus = SMBus(1)
# if GoPiGo3 installed as standalone on Raspbian
# then smbus is not installed.
# but there's no need to detect the robots that require it
try:
from smbus import SMBus
bus = SMBus(1)
except:
bus = None

detected_robot = "None"
detectable_robots = ["GoPiGo3","GoPiGo","BrickPi3","BrickPi+","GrovePi","PivotPi"]

Expand Down Expand Up @@ -235,9 +243,10 @@ def remove_symlink(src):

def remove_desktop_control(file):
try:
os.remove(file) # Delete the GoPiGo3 file.
os.remove(file) # Delete the file.
except OSError as e:
print("File Not Found:" + file + " " + str(e))
pass #quiet is better for the user. This error seems important
# print("File Not Found: " + file + " " + str(e))
# print(e)

def remove_control_panel(detected_robot_list):
Expand Down
54 changes: 27 additions & 27 deletions miscellaneous/auto_detect_rpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,31 +37,31 @@
# Having the hardware revision number is useful when working with hardware or software.

RPI_VARIANTS = {
"0002" : ["Model B Rev 1", "RPI1"],
"0002" : ["Model B Rev v1.0", "RPI1"],

"0003" : ["Model B Rev 1 ECN0001 (no fuses, D14 removed)", "RPI1"],
"0003" : ["Model B Rev v1.0 ECN0001 (no fuses, D14 removed)", "RPI1"],

"0004" : ["Model B Rev 2", "RPI1"],
"0005" : ["Model B Rev 2", "RPI1"],
"0006" : ["Model B Rev 2", "RPI1"],
"0004" : ["Model B Rev v2.0", "RPI1"],
"0005" : ["Model B Rev v2.0", "RPI1"],
"0006" : ["Model B Rev v2.0", "RPI1"],

"0007" : ["Model A", "RPI1"],
"0008" : ["Model A", "RPI1"],
"0009" : ["Model A", "RPI1"],
"0007" : ["Model A v2.0", "RPI1"],
"0008" : ["Model A v2.0", "RPI1"],
"0009" : ["Model A v2.0", "RPI1"],

"000d" : ["Model B Rev 2", "RPI1"],
"000e" : ["Model B Rev 2", "RPI1"],
"000f" : ["Model B Rev 2", "RPI1"],
"000d" : ["Model B Rev v2.0", "RPI1"],
"000e" : ["Model B Rev v2.0", "RPI1"],
"000f" : ["Model B Rev v2.0", "RPI1"],

"0010" : ["Model B+", "RPI1"],
"0013" : ["Model B+", "RPI1"],
"900032" : ["Model B+", "RPI1"],
"0010" : ["Model B+ v1.2", "RPI1"],
"0013" : ["Model B+ v1.2", "RPI1"],
"900032" : ["Model B+ v1.2", "RPI1"],

"0011" : ["Compute Module", "RPI-COMPUTE-MODULE"],
"0014" : ["Compute Module", "RPI-COMPUTE-MODULE"],
"0011" : ["Compute Module v1.0", "RPI-COMPUTE-MODULE"],
"0014" : ["Compute Module v1.0", "RPI-COMPUTE-MODULE"],

"0012" : ["Model A+", "RPI1"],
"0015" : ["Model A+", "RPI1"],
"0012" : ["Model A+ v1.1", "RPI1"],
"0015" : ["Model A+ v1.1", "RPI1"],

"a01040" : ["Pi 2 Model B v1.0", "RPI2"],

Expand All @@ -74,14 +74,14 @@

"900093" : ["Pi Zero v1.3", "RPI0"],

"9000C1" : ["Pi Zero W", "RPI0"],
"9000C1" : ["Pi Zero W v1.1", "RPI0"],

"a02082" : ["Pi 3 Model B", "RPI3"],
"a22082" : ["Pi 3 Model B", "RPI3"],
"a32082" : ["Pi 3 Model B", "RPI3"],
"a52082" : ["Pi 3 Model B", "RPI3"],
"a020d3" : ["Pi 3 Model B+", "RPI3B+"],
"9020e0" : ["Pi 3 Model A+", "RPI3A+"]
"a02082" : ["Pi 3 Model B v1.2", "RPI3"],
"a22082" : ["Pi 3 Model B v1.2", "RPI3"],
"a32082" : ["Pi 3 Model B v1.2", "RPI3"],
"a52082" : ["Pi 3 Model B v1.2", "RPI3"],
"a020d3" : ["Pi 3 Model B+ v1.3", "RPI3B+"],
"9020e0" : ["Pi 3 Model A+ v1.0", "RPI3A+"]
}

# represents indexes for each corresponding key in the above dictionary
Expand All @@ -107,7 +107,7 @@ def getRPIHardwareRevCode():
if revision in RPI_VARIANTS.keys():
rpi_description = RPI_VARIANTS[revision][RPI_MODEL_AND_PCBREV]
else:
rpi_description = "NOT_FOUND"
rpi_description = "NOT_FOUND_" + revision

return rpi_description

Expand Down Expand Up @@ -135,7 +135,7 @@ def getRPIGenerationCode():
if revision in RPI_VARIANTS.keys():
rpi_description = RPI_VARIANTS[revision][RPI_GENERATION_MODEL]
else:
rpi_description = "NOT_FOUND"
rpi_description = "NOT_FOUND_" + revision

return rpi_description

Expand Down

0 comments on commit 2e47128

Please sign in to comment.