Skip to content

Commit f6af6ff

Browse files
remove serial_hello and add logging
1 parent 7f16cb7 commit f6af6ff

File tree

12 files changed

+85
-40
lines changed

12 files changed

+85
-40
lines changed

Cargo.lock

Lines changed: 31 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ regex = "1.10.5"
2525
anyhow = "1.0.86"
2626
serde = { version = "1.0", features = ["derive"] }
2727
serde_json = "1.0"
28+
log = "0.4"
29+
env_logger = "0.11"
2830

2931
[target.'cfg(target_os = "linux")'.dependencies]
3032
nix = { version = "0.29", features = ["fs", "process", "signal"] }

drive/carts/launcher.p8

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ apps={
1515

1616
select=0
1717
function _init()
18-
serial_hello()
1918
end
2019

2120
function _update()

drive/carts/main_menu.p8

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ app_menu=menu_new({
1717

1818
function _init()
1919
app_cursor_y = target_app_cursor_y()
20-
21-
serial_hello()
2220
end
2321

2422
function wait(a) for i = 1,a do flip() end end

drive/carts/os.p8

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ carts=ls(cart_dir)
101101
labels=ls(label_dir)
102102

103103
function _init()
104-
serial_hello()
105104
load_label()
106105
poke(0x5f34,0x2) -- enabled inverted draw
107106
end

drive/carts/pexsplore.p8

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,6 @@ function _init()
216216
--for i=0,15 do pal(i,i+128,2) end
217217
----memset(0x5f78,0xff,8)
218218

219-
serial_hello()
220-
221219
carts=menu_new(serial_ls(cart_dir))
222220
labels=ls(label_dir)
223221
for cart in all(carts.items) do

drive/carts/pexsplore_home.p8

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ function cam_scroll_tween(v_start, v_end)
3737
end
3838

3939
function _init()
40-
serial_hello()
41-
4240
categories:set_wrap(false)
4341
categories:add_hook(6, function(self)
4442
cam_scroll_tween(cam_y, 0)

drive/carts/serial.p8

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,16 @@ chan_buf_size=0x1000
5454

5555
-- read init message (host os provides some information)
5656
-- see https://github.com/nlordell/p8-controller for discussion on caveats with serial read and write
57+
-- currently unused
5758
function serial_hello()
58-
serial_readline()
59-
serial_writeline('hello:')
60-
printh('got hello message')
59+
hello_msg=serial_readline()
60+
-- we are using 'E' as the special placeholder message the os sends
61+
if hello_msg != 'E' then
62+
printh('got incorrect hello message')
63+
else
64+
serial_writeline('hello:')
65+
printh('got hello message')
66+
end
6167
end
6268

6369
function serial_ls(dir)

drive/carts/splashscreen.p8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function _init()
4040
fade = 0
4141
start_time=time()
4242

43-
serial_hello()
43+
-- serial_hello()
4444
end
4545

4646
function _update()

drive/config.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ foreground_sleep_ms 2 // number of milliseconds to sleep each frame. Try 10 to c
3030

3131
background_sleep_ms 10 // number of milliseconds to sleep each frame when running in the background
3232

33-
sessions 6 // number of times program has been run
33+
sessions 11 // number of times program has been run
3434

3535
// (scancode) hold this key down and left-click to simulate right-click
3636
rmb_key 0 // 0 for none 226 for LALT

0 commit comments

Comments
 (0)