WIP: windowMain UI entry point + manifest/telemetry extensions (rescued uncommitted work from IdeaProjects working copy)
All checks were successful
build / build-test (push) Successful in 2m57s

This commit is contained in:
Jan-Peter von Hunnius 2026-09-01 12:32:12 +02:00
parent 62967fc17b
commit 1176ba8612
3 changed files with 42 additions and 6 deletions

View file

@ -1,8 +1,13 @@
-- main.lua - Entry point for ACTelemetry CSP Lua app -- main.lua - Entry point for ACTelemetry CSP Lua app
-- CSP calls script.update(dt) every frame; we delegate to the telemetry module. -- CSP calls script.update(dt) every frame; we delegate to the telemetry module.
-- CSP calls script.windowMain(dt) to draw the app window.
local telemetry = require("src.telemetry") local telemetry = require("src.telemetry")
function script.update(dt) function script.update(dt)
telemetry.update(dt) telemetry.update(dt)
end end
function script.windowMain(dt)
ui.text("AC Telemetry ●")
end

View file

@ -6,6 +6,18 @@ Name = ACTelemetry
Author = jan Author = jan
Version = 1.0.0 Version = 1.0.0
Description = Sends car telemetry data as JSON over UDP for external dashboards and analysis tools. Description = Sends car telemetry data as JSON over UDP for external dashboards and analysis tools.
REQUIRED_VERSION = 0
[SCRIPT] [CORE]
Script = main.lua LAZY = NONE
[WINDOW_...]
ID = main
NAME = AC Telemetry
ICON = icon.png
FUNCTION_MAIN = windowMain
FLAGS = NO_SCROLLBAR,NO_SCROLL_WITH_MOUSE,NO_BACKGROUND,NO_TITLE_BAR,FADING,FLOATING_TITLE_BAR
SIZE = 160, 30
MIN_SIZE = 160, 30
PADDING = 0
VISIBLE = 1

View file

@ -6,13 +6,32 @@ local json = require("src.json")
local telemetry = {} local telemetry = {}
local socket = require("socket.udp") local ac_available = type(ac) == "table" and type(ac.getCarState) == "function"
local udp = socket()
if ac_available then
ac.log("[ACTelemetry] Before require('socket')")
else
print("[ACTelemetry] Before require('socket')")
end
local socket = require("socket")
if ac_available then
ac.log("[ACTelemetry] require('socket') succeeded, type = " .. type(socket))
else
print("[ACTelemetry] require('socket') succeeded, type = " .. type(socket))
end
local udp = socket.udp()
if ac_available then
ac.log("[ACTelemetry] socket.udp() succeeded, type = " .. type(udp))
else
print("[ACTelemetry] socket.udp() succeeded, type = " .. type(udp))
end
local last_send_time = 0 local last_send_time = 0
local ac_available = type(ac) == "table" and type(ac.getCarState) == "function"
local buf_g_forces = { x = 0, y = 0, z = 0 } local buf_g_forces = { x = 0, y = 0, z = 0 }
local buf_wheel_slip = { 0, 0, 0, 0 } local buf_wheel_slip = { 0, 0, 0, 0 }
local buf_suspension_travel = { 0, 0, 0, 0 } local buf_suspension_travel = { 0, 0, 0, 0 }