make PCARS usermod compatible with WLED > 0.10.0

This commit is contained in:
Alexander Over 2020-08-30 21:27:52 +02:00
parent 427b5bd126
commit 0afe0f8fbd
No known key found for this signature in database
GPG Key ID: 90323B1C3679775A

View File

@ -18,25 +18,6 @@ u16 PCARS_maxRPM;
long PCARS_lastRead = millis() - 2001; long PCARS_lastRead = millis() - 2001;
float PCARS_rpmRatio; float PCARS_rpmRatio;
void userSetup()
{
UDP.begin(PCARS_localUdpPort);
}
void userConnected()
{
// new wifi, who dis?
}
void userLoop()
{
PCARS_readValues();
if (PCARS_lastRead > millis() - 2000) {
PCARS_buildcolorbars();
}
}
void PCARS_readValues() { void PCARS_readValues() {
int PCARS_packetSize = UDP.parsePacket(); int PCARS_packetSize = UDP.parsePacket();
@ -48,7 +29,7 @@ void PCARS_readValues() {
if (len == 1367) { // Telemetry packet. Ignoring everything else. if (len == 1367) { // Telemetry packet. Ignoring everything else.
PCARS_lastRead = millis(); PCARS_lastRead = millis();
arlsLock(realtimeTimeoutMs, REALTIME_MODE_GENERIC); realtimeLock(realtimeTimeoutMs, REALTIME_MODE_GENERIC);
// current RPM // current RPM
memcpy(&PCARS_tempChar, &PCARS_packet[124], 2); memcpy(&PCARS_tempChar, &PCARS_packet[124], 2);
PCARS_RPM = (PCARS_tempChar[1] << 8) + PCARS_tempChar[0]; PCARS_RPM = (PCARS_tempChar[1] << 8) + PCARS_tempChar[0];
@ -93,4 +74,22 @@ void PCARS_buildcolorbars() {
} }
colorUpdated(5); colorUpdated(5);
strip.show(); strip.show();
}
void userSetup()
{
UDP.begin(PCARS_localUdpPort);
}
void userConnected()
{
// new wifi, who dis?
}
void userLoop()
{
PCARS_readValues();
if (PCARS_lastRead > millis() - 2000) {
PCARS_buildcolorbars();
}
} }