Skip to content

Commit

Permalink
status: single read instead of three
Browse files Browse the repository at this point in the history
  • Loading branch information
gerryd committed Oct 20, 2023
1 parent 0af6ae6 commit 063bc37
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions status.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"os"
"time"

"encoding/binary"
"encoding/json"

"github.com/google/renameio"
Expand Down Expand Up @@ -34,17 +33,16 @@ func (s *StatusCmd) Run(c *Context) error {
for next {
output := &outputData{}

buf := readmem(c, Region { Region: "RAM", Addr: 0x0000e184 }, 2)
output.Width = int(binary.LittleEndian.Uint16(buf))

buf = readmem(c, Region { Region: "RAM", Addr: 0x0000e18c }, 2)
output.Height = int(binary.LittleEndian.Uint16(buf))

buf = readmem(c, Region { Region: "RAM", Addr: 0x0000e180 }, 1)
buf := readmem(c, Region { Region: "RAM", Addr: 0x0000e180 }, 16)

if (len(buf) == 0) {
continue
}

output.Width = (int(buf[5]) * 256) + int(buf[4])
output.Height = (int(buf[13]) * 256) + int(buf[12])

} else if (buf[0] > 0) {
if (int(buf[0:1][0]) > 0) {
output.Signal = "yes"
} else {
output.Signal = "no"
Expand Down

0 comments on commit 063bc37

Please sign in to comment.