Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

Commit

Permalink
Major v3.0 Release
Browse files Browse the repository at this point in the history
Major new release of software and firmware: v3.0.26

* No longer requires root access to run Python menu (now in menu.py)
* Control software runs outside of docker "python3 menu.py --help" 
* Streamlined firmware supporting arbitrary strings for OLED
* Camera view streamed to http://moab.local (only when plate is active)
* Ball colors besides orange work
* BOT INFO menu shows DHCP-assigned IP address to help ssh
* No longer restricted to three brains
* Custom brain names will show in the menu
* Graceful menu and firmware restarts if either crashes
* New `bot` CLI command to control and query Moab

Follow instructions at https://github.com/microsoft/moabian/wiki/Upgrade-from-2.4.1-to-3.0 to upgrade.

Co-authored-by: Scott Stanfield <[email protected]>
Co-authored-by: Kirill Polzounov <[email protected]>
Co-authored-by: polzounov <[email protected]>
Co-authored-by: John Alexander (MSFT) <[email protected]>
Co-authored-by: Scott Stanfield <[email protected]>
Co-authored-by: Denise Feirstein <[email protected]>
  • Loading branch information
6 people authored Mar 29, 2021
1 parent 29b623d commit de7a596
Show file tree
Hide file tree
Showing 219 changed files with 23,236 additions and 23,100 deletions.
61 changes: 61 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
### MOAB ###
**/*.csv
**/bot.json
**/tags
**/.ipynb_checkpoints/
**/*.pem
docker-compose.yml

### C ###

# Object files
*.o
*.a
*.so
*.so.*
*.dylib


### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*


### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
.Python

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
pythonenv*

# End of https://www.toptal.com/developers/gitignore/api/c,macos,python

694 changes: 18 additions & 676 deletions NOTICE

Large diffs are not rendered by default.

67 changes: 0 additions & 67 deletions bin/_exercise.py

This file was deleted.

111 changes: 0 additions & 111 deletions bin/_level.py

This file was deleted.

140 changes: 140 additions & 0 deletions bin/bot
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
#!/usr/bin/env bash
# vim:filetype=sh:

# http://www.binaryphile.com/bash/2018/07/26/approach-bash-like-a-developer-part-1-intro.html
# https://github.com/MatthewZito/sh/pull/1

IFS=$'\n'
set -o noglob
shopt -s nocasematch expand_aliases
alias args?='(( $# ))'
alias args_include?='include? "$*"'
alias fewer_args_than?='fewer_than? $#'

this_script="$(basename "$0")"
HERE=$(dirname "$BASH_SOURCE")

die () {
local rc=$?

present? ${2:-} && rc=$2
present? "${1:-}" && echo "$1" >&2
exit $rc
}

define () { IFS=$'\n' read -r -d '' ${1} || true; }
blank? () { [[ -z ${1:-} ]]; }
fewer_than? () { (( $1 < $2 )); }
include? () { [[ $IFS$1$IFS == *"$IFS$2$IFS"* ]]; }
present? () { [[ -n ${1:-} ]]; }
sourced? () { [[ ${FUNCNAME[1]} == source ]]; }

split () {
local i

for (( i = 0; i < ${#1}; i++ )); do
echo ${1:i:1}
done
}

strict_mode () {
case $1 in
on ) set -euo pipefail;;
off ) set +euo pipefail;;
esac
}

define HELP <<EOF
Usage:
bot [command]
COMMANDS:
bot version display firmware version string
bot reset fast firmware and menu restart
bot fw_reset fast firmware restart
bot log firwmare log stream (CTRL-A Q to quit)
bot shell firmware shell (advanced)
bot fanon force fan on
bot fanoff force fan off
bot csv show csv file
bot 4up 4-up tmux console for logs (CTRL-O Q to quit)
bot 2up 2-up tmux console for logs (CTRL-O Q to quit)
EOF


usage () {
local rc=0

present? ${1:-} && {
echo "$1$IFS"
rc=2
}
die "$HELP" $rc
}

main() {
blank? ${1:-} && die 0

case $1 in
reset ) reset;;
fwreset ) fw_reset;;
log ) fw_log;;
shell ) fw_log;;
ver | version ) fw_version;;
fanon ) fw_fanon;;
fanoff ) fw_fanoff;;
csv ) csv;;
4up ) 4up;;
2up ) 2up;;
esac
}

fw_log() { sudo minicom --device=/dev/ttyAMA0; }
fw_shell() { sudo minicom --device=/dev/ttyAMA0; }
fw_version() { fwversion; }
fw_fanoff() { raspi-gpio set 26 dl; }
fw_fanon() { raspi-gpio set 26 dh; }
fw_fanon() { raspi-gpio set 26 dh; }
csv() { tail -f /tmp/log.csv; }

reset() { sudo systemctl restart menu; }

fw_reset() {
raspi-gpio set 6 dh
sleep 0.1
raspi-gpio set 6 dl
}

4up() {
tmux -2 new-session -A -s "console" \; \
send-keys 'cd ~/moab/sw' 'C-m' \; \
split-window -v -p 50 \; \
send-keys 'tail -F /tmp/log.csv' 'C-m' \; \
split-window -h -p 50 \; \
send-keys 'bot log' 'C-m' \; \
select-pane -t 0 \; \
split-window -h -p 50 \; \
send-keys 'journalctl -f -u menu -u power' 'C-m' \; \
select-pane -t 0 \;
}

2up() {
tmux -2 new-session -A -s "console" \; \
send-keys 'cd ~/moab/sw' 'C-m' \; \
split-window -v -p 30 \; \
send-keys 'bot log' 'C-m' \; \
select-pane -t 0 \;
}



sourced? && return
strict_mode on

args_include? --help && usage
args? || usage "bot • Moab command-line tools"
fewer_args_than? 2 || usage "Error: wrong number of arguments"

[[ $TERM == "alacritty" ]] && TERM=xterm-256color
main $*

Loading

0 comments on commit de7a596

Please sign in to comment.