Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@
"BMPGDBSerialPort": "/dev/ttyACM0",
},
"osx": {
// "BMPGDBSerialPort": "/dev/cu.usbmodem72ADB7F21",
"BMPGDBSerialPort": "/dev/cu.usbmodem72AE45F31",
// "BMPGDBSerialPort": "/dev/cu.usbmodem72AE45F31",
"BMPGDBSerialPort": "/dev/cu.usbmodem72AE30F31",
}
},
{
Expand Down
229 changes: 125 additions & 104 deletions production/production_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,25 @@ echo "-----------------------"
while :
do

NOW=`date -u +'%d/%m/%Y - %H:%M:%S'`

echo ""
read -p "Press Enter key to start, or Ctrl-C to quit"
echo "" >> log.txt
read -p "Press Enter key to start, or Ctrl-C to quit"

# Automatically assign port depending if MacOS or Linux
if [ "`uname`" = Darwin ]; then
PORT=`ls /dev/cu.usbmodem*1 2> /dev/null | grep "cu."`
PORT=`ls /dev/cu.usbmodem*1 2> /dev/null`
else
PORT=/dev/ttyACM0 2> /dev/null
PORT=`ls /dev/ttyACM0 2> /dev/null`
fi

# Create timestamp
NOW=`date -u +'%d/%m/%Y - %H:%M:%S'`
if [ $? -eq 1 ]; then
echo "$NOW - Error: Programmer not found" | tee -a log.txt
continue
fi

# Unlock chip
# Unlock chip (and ignore errors)
echo "$NOW - Unlocking chip" | tee -a log.txt
arm-none-eabi-gdb \
-nx \
Expand All @@ -44,105 +48,122 @@ do
-ex "monitor erase_mass" \
2> /dev/null

# If successful, continue otherwise throw and error and return to top of loop
if [ $? -eq 0 ]; then

# Get and print device ID
echo -n "$NOW - " | tee -a log.txt
arm-none-eabi-gdb \
-nx \
--batch-silent \
-ex "target extended-remote ${PORT}" \
-ex "monitor swd_scan" \
-ex "attach 1" \
-ex "set logging file /dev/stdout" \
-ex "set logging enabled on" \
-ex "monitor read deviceid" \
-ex "set logging enabled off" \
2> /dev/null \
| tee -a log.txt

# Get and print device address
echo -n "$NOW - " | tee -a log.txt
arm-none-eabi-gdb \
-nx \
--batch-silent \
-ex "target extended-remote ${PORT}" \
-ex "monitor swd_scan" \
-ex "attach 1" \
-ex "set logging file /dev/stdout" \
-ex "set logging enabled on" \
-ex "monitor read deviceaddr" \
-ex "set logging enabled off" \
2> /dev/null \
| tee -a log.txt

# Program sections
echo "$NOW - Programming chip. Please wait"
arm-none-eabi-gdb \
-nx \
--batch-silent \
-ex "target extended-remote ${PORT}" \
-ex 'monitor swd_scan' \
-ex 'attach 1' \
-ex 'load' \
-ex 'compare-sections' \
-ex 'kill' \
frame-firmware-v*.hex \
2> /dev/null

# If successful, start the camera focusing script otherwise throw error
if [ $? -eq 0 ]; then
echo "$NOW - Programmed successfully" | tee -a log.txt
echo -n " Press y if display is working, otherwise n"
read -s -n1 input

# If okay, test the microphone
if [ $input == "y" ]; then
echo -e -n $"\r\033[2K"
echo "$NOW - Display okay" | tee -a log.txt

echo -e -n " Recording audio\r"
python test_microphone_script.py
echo -e -n $"\r\033[2K"
echo -n " Press y if microphone is working, otherwise n"
read -s -n1 input

# Run the camera focusing script
if [ $input == "y" ]; then
echo -e -n $"\r\033[2K"
echo "$NOW - Microphone okay" | tee -a log.txt

python focus_camera_script.py 2> /dev/null

# Done
if [ $? -eq 0 ]; then

echo -e -n $"\r\033[2K"
echo "$NOW - Camera focused" | tee -a log.txt
echo "$NOW - Done" | tee -a log.txt

else
echo -e -n $"\r\033[2K"
echo "$NOW - Error: Could not connect to start focusing" | tee -a log.txt
fi

else
echo -e -n $"\r\033[2K"
echo "$NOW - Error: Microphone not working" | tee -a log.txt
fi

else
echo -e -n $"\r\033[2K"
echo "$NOW - Error: Display not working" | tee -a log.txt
fi

else
echo "$NOW - Error: Chip could not be programmed" | tee -a log.txt
fi

else
if [ $? -eq 1 ]; then
echo "$NOW - Error: Chip not found" | tee -a log.txt
continue
fi

# Get and print device ID
echo -n "$NOW - " | tee -a log.txt
arm-none-eabi-gdb \
-nx \
--batch-silent \
-ex "target extended-remote ${PORT}" \
-ex "monitor swd_scan" \
-ex "attach 1" \
-ex "set logging file /dev/stdout" \
-ex "set logging enabled on" \
-ex "monitor read deviceid" \
-ex "set logging enabled off" \
2> /dev/null \
| tee -a log.txt

# Get and print device address
echo -n "$NOW - " | tee -a log.txt
arm-none-eabi-gdb \
-nx \
--batch-silent \
-ex "target extended-remote ${PORT}" \
-ex "monitor swd_scan" \
-ex "attach 1" \
-ex "set logging file /dev/stdout" \
-ex "set logging enabled on" \
-ex "monitor read deviceaddr" \
-ex "set logging enabled off" \
2> /dev/null \
| tee -a log.txt

# Program sections
echo "$NOW - Programming chip. Please wait"
arm-none-eabi-gdb \
-nx \
--batch-silent \
-ex "target extended-remote ${PORT}" \
-ex 'monitor swd_scan' \
-ex 'attach 1' \
-ex 'load' \
-ex 'compare-sections' \
-ex 'kill' \
frame-firmware-v*.hex \
2> /dev/null

if [ $? -eq 1 ]; then
echo "$NOW - Error: Chip could not be programmed" | tee -a log.txt
continue
fi

echo "$NOW - Programmed successfully" | tee -a log.txt

# Short delay to allow the chip to boot
sleep 3

# Test display/LED
echo -e -n " Running display/LED test\r"
python test_display_led_script.py 2> /dev/null

if [ $? -eq 1 ]; then
echo -e -n $"\r\033[2K"
echo "$NOW - Error: Could not connect to start microphone test" | tee -a log.txt
continue
fi

echo -n " Press y if display/LED is working, otherwise n"
read -s -n1 input

if [ $input == "n" ]; then
echo -e -n $"\r\033[2K"
echo "$NOW - Error: Display/LED not working" | tee -a log.txt
continue
fi

echo -e -n $"\r\033[2K"
echo "$NOW - Display/LED okay" | tee -a log.txt

# Test microphone
echo -e -n " Recording audio\r"
python test_microphone_script.py 2> /dev/null

if [ $? -eq 1 ]; then
echo -e -n $"\r\033[2K"
echo "$NOW - Error: Could not connect to start microphone test" | tee -a log.txt
continue
fi

echo -e -n $"\r\033[2K"
echo -n " Press y if microphone is working, otherwise n"
read -s -n1 input

if [ $input == "n" ]; then
echo -e -n $"\r\033[2K"
echo "$NOW - Error: Microphone not working" | tee -a log.txt
continue
fi

echo -e -n $"\r\033[2K"
echo "$NOW - Microphone okay" | tee -a log.txt

# Run the camera focusing script
python test_focus_camera_script.py 2> /dev/null

if [ $? -eq 1 ]; then
echo -e -n $"\r\033[2K"
echo "$NOW - Error: Could not connect to start focusing" | tee -a log.txt
continue
fi

echo -e -n $"\r\033[2K"
echo "$NOW - Camera focused" | tee -a log.txt

echo "$NOW - Done" | tee -a log.txt

done
38 changes: 38 additions & 0 deletions production/test_display_led_script.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
from frameutils import Bluetooth
import asyncio

lua_script = """
if frame.HARDWARE_VERSION == 'Frame' then
width = 640
height = 400
t = string.rep('\\xFF', width * height / 8)
frame.display.bitmap(1, 1, width, 2, 2, t)
frame.display.show()
frame.sleep(1)
frame.display.bitmap(1, 1, width, 2, 9, t)
frame.display.show()
frame.sleep(1)
frame.display.bitmap(1, 1, width, 2, 13, t)
frame.display.show()
frame.sleep(1)
else
frame.led.set_color(100, 0, 0)
frame.sleep(1)
frame.led.set_color(0, 100, 0)
frame.sleep(1)
frame.led.set_color(0, 0, 100)
frame.sleep(1)
end
"""


async def main():
b = Bluetooth()
await b.connect()
await b.upload_file(lua_script, "main.lua")
await b.send_reset_signal()
await asyncio.sleep(3)
await b.disconnect()


asyncio.run(main())
Original file line number Diff line number Diff line change
Expand Up @@ -701,9 +701,15 @@ async def main():
local state = 'CAPTURE'
local state_time = 0

frame.camera.set_gain(0)
frame.camera.set_shutter(550)
frame.camera.set_white_balance(255, 255, 255)
if frame.HARDWARE_VERSION == 'Frame Lite' then
frame.camera.set_gain(0)
frame.camera.set_shutter(330)
frame.camera.set_white_balance(255, 120, 220)
else
frame.camera.set_gain(0)
frame.camera.set_shutter(550)
frame.camera.set_white_balance(255, 255, 255)
end

while true do
if state == 'CAPTURE' then
Expand Down
Loading