[BUG] Lua serial commands don't work with RC Track?

Found a hardware issue we should fix, or got a feature request? Post it here.
Post Reply
GTIspirit
Posts: 249
Joined: Wed Jan 09, 2013 11:20 am
Location: SE Michigan

[BUG] Lua serial commands don't work with RC Track?

Post by GTIspirit »

I tried this script, on all ports, 0 through 6. (7 is not valid)

Code: Select all

--initialize Aux serial port to 115200, 8, N, 1
initSer(4, 115200, 8, 0, 1)

function onTick()
 --read a line from the aux serial port with a 100ms timeout
 value = readSer(4, 100)
 if value ~= nil then
  println('read value: ' ..value)
 end
end
nothing happens it just sits there printing "read value: " with a blank. It's not a nil because the IF statement is true and the "read value:" prints. Except nothing prints. I tried all the ports. It's like the serial commands don't work with the RC Track 2.

script from: https://wiki.autosportlabs.com/RaceCapt ... erial_data
Last edited by GTIspirit on Fri May 08, 2020 11:40 am, edited 1 time in total.

GTIspirit
Posts: 249
Joined: Wed Jan 09, 2013 11:20 am
Location: SE Michigan

readSer not reliable?

Post by GTIspirit »

Doing a bit of digging around, sounds like the readSer command is problematic and it's preferable to use the readCSer command. Sounds like what I'm experiencing is similar to this:
viewtopic.php?p=26831#26831

It's probably no coincidence that Brent's GoPro Lua script uses readCSer instead of readSer.
https://wiki.autosportlabs.com/Automati ... Lua_Script

GTIspirit
Posts: 249
Joined: Wed Jan 09, 2013 11:20 am
Location: SE Michigan

Post by GTIspirit »

No response on any serial ports. I tried with/without the initSer command, tried 115200 and 921600 baud rates. Tried with all ports turned off, WiFi, Bluetooth, CAN, GPS.

Also tried sending the AT commands to the ESP8266 WiFi module. Still nothing.

Looks like the serial port commands via Lua don't work with the RCTrack2.

Code: Select all

setTickRate(10) --TickRate is in Hz
initSer(0, 115200, 8, 0, 1)
initSer(1, 115200, 8, 0, 1)
initSer(2, 115200, 8, 0, 1)
initSer(3, 115200, 8, 0, 1)
initSer(4, 115200, 8, 0, 1)
initSer(5, 115200, 8, 0, 1)
initSer(6, 115200, 8, 0, 1)


function onTick()
port0 = readSer(0,100)
println("Port 0: " ..port0)
port1 = readSer(1,100)
println("Port 1: " ..port1)
port2 = readSer(2,100)
println("Port 2: " ..port2)
port3 = readSer(3,100)
println("Port 3: " ..port3)
port4 = readSer(4,100)
println("Port 4: " ..port4)
port5 = readSer(5,100)
println("Port 5: " ..port5)
port6 = readSer(6,100)
println("Port 6: " ..port6)

end
ESP8266 AT Instruction Set

Post Reply