Updating configuration to reflect new simled code

This commit is contained in:
Paul Dino Jones 2025-02-25 22:13:49 -05:00
parent 9c0cadffdf
commit 84f336f40c
3 changed files with 94 additions and 2 deletions

29
conf/basic_rpms.lua Normal file
View File

@ -0,0 +1,29 @@
-- start led, end led, color
-- set_led_range_to_color(1, 5, YELLOW);
-- led, color
-- set_led_to_color(3, ORANGE);
-- current colors
-- RED
-- GREEN
-- BLUE
-- YELLOW
-- ORANGE
if simdata.rpm >= simdata.maxrpm-500 then
set_led_range_to_color(1, 6, RED)
elseif simdata.rpm >= 4000 then
set_led_range_to_color(1, 4, YELLOW)
elseif simdata.rpm >= 3000 then
set_led_range_to_color(1, 3, GREEN)
elseif simdata.rpm >= 2000 then
set_led_range_to_rgb_color(1, 2, 0, 255, 0)
-- set_led_to_rgb_color also available
elseif simdata.rpm >= 1000 then
set_led_to_color(1, GREEN)
end

View File

@ -1,5 +1,7 @@
configs = ({
sim = 0;
sim = "default";
// one can also specify sim by using the "short-name" for example "ac". also, "acc", "ace", "ams2", "et", "at" and "rf2"
//sim = "ac";
car = "default";
devices = ( { device = "USB";
type = "Tachometer";
@ -63,6 +65,19 @@ configs = ({
effect = "ABS";
tyre = "ALL"; // this will have to be documented, this tells the code to spin both motors
motors = 8;
devpath = "/dev/ttyACM0";}
devpath = "/dev/ttyACM0";},
{ device = "Serial";
type = "SimWind";
config = "None";
baud = 115200;
devpath = "/dev/simdev1"; },
{ device = "Serial";
type = "Simleds";
numleds = 6;
startled = 1;
endled = 6;
config = "None";
baud = 115200;
devpath = "/dev/simdev0"; }
);
});

48
conf/rpms_and_flags.lua Normal file
View File

@ -0,0 +1,48 @@
-- from simapi.h
-- SIMAPI_FLAG_GREEN = 0,
-- SIMAPI_FLAG_YELLOW = 1,
-- SIMAPI_FLAG_RED = 2,
-- SIMAPI_FLAG_CHEQUERED = 3,
-- SIMAPI_FLAG_BLUE = 4,
-- SIMAPI_FLAG_WHITE = 5,
-- SIMAPI_FLAG_BLACK = 6,
-- SIMAPI_FLAG_BLACK_WHITE = 7,
-- SIMAPI_FLAG_BLACK_ORANGE = 8,
-- SIMAPI_FLAG_ORANGE = 9
led_clear_all()
if simdata.rpm > 0 and simdata.maxrpm > 0 then
rpmmargin = .05*simdata.maxrpm;
rpminterval = (simdata.maxrpm-rpmmargin) / 6;
litleds = 0
for i = 1,6 do
if simdata.rpm >= (rpminterval * i) then
litleds = i;
end
end
color = GREEN
if litleds > 3 and litleds < 6 then
color = YELLOW
end
if litleds >= 6 then
color = RED
end
set_led_range_to_color(1, litleds, color)
end
if simdata.playerflag == 0 then
set_led_range_to_color(7, 48, GREEN)
end
if simdata.playerflag == 1 then
set_led_range_to_color(7, 48, YELLOW)
end
if simdata.playerflag == 4 then
set_led_range_to_color(7, 48, BLUE)
end