Skip to content

Commit

Permalink
Beep when connected to DebugTool, bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
meowmeowahr committed Mar 5, 2023
1 parent 4a6c8b9 commit 0896576
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions DebugTool.spin2
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ obj
eye_pwm : "jm_pwm" ' pwm for displays

strs : "ka_strings" ' string manipulation
timer1 : "jm_ez_timer" ' timer for leds
timer1 : "jm_ez_timer" ' timer
prng : "jm_prng" ' TEMPORARY RNG
nstr : "jm_nstr" ' number-to-string

Expand Down Expand Up @@ -178,8 +178,8 @@ var { globals }

byte running

long disp_scstack[128]
byte disp_cog
long update_scstack[128]
byte upd_cog

byte serial_buf[BUFFER_SIZE]

Expand Down Expand Up @@ -212,7 +212,7 @@ pub main() | r, d, tc, tf, p, h, status, tc_left, tc_right, ta, tb, tc2, td, te
tsns.BAD_RESET : error_state := 6
tsns.NO_DEVICE : error_state := 7

disp_cog := cogspin(newcog, display_cog(), @disp_scstack) ' display cog
upd_cog := cogspin(newcog, update_cog(), @update_scstack) ' cog

repeat
if running == 1
Expand All @@ -229,11 +229,17 @@ pub check_serial() | index, i, v, vn, len, c
index := cmd_index(@cmdstr)

if index == 1
term.fstr1(string("error=%d", 10), error_state)
term.fstr1(string("chip=%s", 10), string("Propeller 2"))
term.str(string("root=P2 Kevinbot Board", 10))
fstr20(string("pins=DISP_A:%d..P%d,DISP_B:%d..P%d,RPI_RX:%d,RPI_TX:%d,CAMERA_LED:%d,LED:%d,SDA:%d,SCL:%d,VOLT1_P:%d,VOLT2_P:%d,LEFT_MOT:%d,RIGHT_MOT:%d,LEFT_ENC_A:%d,LEFT_ENC_B:%d,RIGHT_ENC_A:%d,RIGHT_ENC_B:%d,ONE_WIRE:%d,BUZZER_PIN:%d", 10), ...
DISPLAYA_BASE_PIN, DISPLAYA_BASE_PIN + 8, DISPLAYB_BASE_PIN, DISPLAYB_BASE_PIN + 8, RPI_RX, RPI_TX, CAMERA_LED, LED, SDA, SCL, VOLT1_P, VOLT2_P, LEFT_MOT, RIGHT_MOT, LEFT_ENC_A, LEFT_ENC_B, RIGHT_ENC_A, RIGHT_ENC_B, ONE_WIRE, BUZZER_PIN)

tone(50, 1000, 50)
tone(60, 750, 100)
tone(50, 1000, 50)
tone(60, 750, 100)


pub tone(amp, freq, length)

Expand All @@ -242,14 +248,16 @@ pub tone(amp, freq, length)
beeper.write(0)


pub display_cog()
pub update_cog()

setup_display() ' setup display after starting cogs

waitms(500)

repeat
waitct(0)
if timer1.millis() >= 1000
if error_state > 0
term.fstr1(string("error=%d", 10), error_state)


pub parse(p_src, p_cstr, p_vstr) : result | len, sep, x, c
Expand Down

0 comments on commit 0896576

Please sign in to comment.