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
10 changes: 8 additions & 2 deletions reflash/screen.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func ScreenInit() {

img = image.NewRGBA(image.Rect(0, 0, fb_min, fb_min))
ips := make([]string, 0)
Draw(0, "IDLE", 0, ips)
Draw(0, "IDLE", 0, ips, "")
}

func ScreenClose() {
Expand All @@ -92,7 +92,7 @@ func ScreenClose() {
}

// TODO: This is horrobly inefficient and should be optimized.
func Draw(progress float32, state string, rot int, ips []string) {
func Draw(progress float32, state string, rot int, ips []string, version string) {
// No framebuffer mapped → ScreenInit either failed (headless) or was
// never called (tests). Skip rendering entirely; updateDisplay still
// keeps its bookkeeping in sync.
Expand All @@ -116,6 +116,12 @@ func Draw(progress float32, state string, rot int, ips []string) {
for i, s := range ips {
drawText(img, s, 20, (fb_min/2)+125+(20*i))
}
// The screen is sometimes the only information available (e.g. no
// network reachable yet) - show the running version so it's visible
// without needing the web UI.
if version != "" {
drawText(img, version, 16, (fb_min/2)+125+(20*len(ips))+20)
}
} else {
if fb_min > 700 {
drawLogo(img, (fb_min/2)-250)
Expand Down
9 changes: 5 additions & 4 deletions reflash/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ var images_folder string
var options_file string
var log_file string
var http_port string
var reflashVersion string

var last_size_check time.Time
var bytes_last int
Expand Down Expand Up @@ -201,6 +202,8 @@ func ServerInit() {
BytesTotal: 1,
}

reflashVersion = runCommandReturnString("get-reflash-version")

logInfo("-- Server started at " + time.Now().Format("15:04:05") + " --")
expandUsb()
mountUsb(MODE_RO)
Expand All @@ -220,10 +223,8 @@ func ServerInit() {
updateDisplay()
}()

version := runCommandReturnString("get-reflash-version")

fs := http.FileServer(http.Dir(static_dir))
fmt.Println("Starting Reflash go server " + version + " env '" + env + "'")
fmt.Println("Starting Reflash go server " + reflashVersion + " env '" + env + "'")
http.Handle("/", fs)
http.HandleFunc("/api/get_info", getInfo)
http.HandleFunc("/api/stream_log", streamLog)
Expand Down Expand Up @@ -471,7 +472,7 @@ func updateDisplay() {
}
state.Lock()
if oldState.State != state.State || oldState.Progress != state.Progress || oldRotation != options.ScreenRotation || !slices.Equal(oldState.IPs, state.IPs) {
Draw(float32(state.Progress)/100, state.State, options.ScreenRotation, state.IPs)
Draw(float32(state.Progress)/100, state.State, options.ScreenRotation, state.IPs, reflashVersion)
oldState.State = state.State
oldState.Progress = state.Progress
oldRotation = options.ScreenRotation
Expand Down
Loading