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
All checks were successful
build / build-test (push) Successful in 2m57s
This commit is contained in:
parent
62967fc17b
commit
1176ba8612
3 changed files with 42 additions and 6 deletions
5
main.lua
5
main.lua
|
|
@ -1,8 +1,13 @@
|
|||
-- 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.windowMain(dt) to draw the app window.
|
||||
|
||||
local telemetry = require("src.telemetry")
|
||||
|
||||
function script.update(dt)
|
||||
telemetry.update(dt)
|
||||
end
|
||||
|
||||
function script.windowMain(dt)
|
||||
ui.text("AC Telemetry ●")
|
||||
end
|
||||
|
|
|
|||
16
manifest.ini
16
manifest.ini
|
|
@ -6,6 +6,18 @@ Name = ACTelemetry
|
|||
Author = jan
|
||||
Version = 1.0.0
|
||||
Description = Sends car telemetry data as JSON over UDP for external dashboards and analysis tools.
|
||||
REQUIRED_VERSION = 0
|
||||
|
||||
[SCRIPT]
|
||||
Script = main.lua
|
||||
[CORE]
|
||||
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
|
||||
|
|
|
|||
|
|
@ -6,13 +6,32 @@ local json = require("src.json")
|
|||
|
||||
local telemetry = {}
|
||||
|
||||
local socket = require("socket.udp")
|
||||
local udp = socket()
|
||||
local ac_available = type(ac) == "table" and type(ac.getCarState) == "function"
|
||||
|
||||
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 ac_available = type(ac) == "table" and type(ac.getCarState) == "function"
|
||||
|
||||
local buf_g_forces = { x = 0, y = 0, z = 0 }
|
||||
local buf_wheel_slip = { 0, 0, 0, 0 }
|
||||
local buf_suspension_travel = { 0, 0, 0, 0 }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue