Merge pull request #1125 from CyberLine/master

make PCARS usermod compatible with WLED > 0.10.0
This commit is contained in:
Aircoookie 2020-08-30 22:01:09 +02:00 committed by GitHub
commit 55f071e4a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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];
@ -94,3 +75,21 @@ 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();
}
}