Skip to content

Commit 0b99ed9

Browse files
committed
add ignition timming
1 parent a96af37 commit 0b99ed9

1 file changed

Lines changed: 6 additions & 12 deletions

File tree

src/ESP32_DevkitC_3.5_SPI.ino

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ bool clientConnected = true;
5454

5555
uint8_t iat = 0, clt = 0;
5656
uint8_t refreshRate = 0;
57-
unsigned int rpm = 6000, lastRpm, vss = 0;
57+
unsigned int rpm = 0, lastRpm, vss = 0;
5858
int mapData, tps, adv, fp;
5959
float bat = 0.0, afrConv = 0.0;
6060
bool syncStatus, fan, ase, wue, rev, launch, airCon, dfco;
@@ -96,20 +96,14 @@ void setup()
9696
CAN0.begin(1000000); // 1Mbps
9797
CAN0.watchFor(0x360); // RPM, MAP, TPS
9898
CAN0.watchFor(0x361); // Fuel Pressure
99+
CAN0.watchFor(0x362); // Ignition Angle (Leading)
99100
CAN0.watchFor(0x368); // AFR 01
100-
// CAN0.watchFor(0x370); // VSS
101+
CAN0.watchFor(0x370); // VSS
101102
CAN0.watchFor(0x372); // Voltage
102103
CAN0.watchFor(0x3E0); // CLT, IAT
103104
CAN0.watchFor(0x3E4); // Indicator
104105

105-
xTaskCreatePinnedToCore(
106-
canTask,
107-
"CAN Task",
108-
4096,
109-
NULL,
110-
1,
111-
NULL,
112-
0);
106+
xTaskCreatePinnedToCore(canTask, "CAN Task", 4096, NULL, 1, NULL, 0);
113107

114108
Serial.println("CAN mode aktif.");
115109
}
@@ -308,7 +302,7 @@ void handleCANCommunication()
308302
}
309303
case 0x362:
310304
{ // Ignition Advance
311-
uint16_t adv_raw = (can_message.data.byte[4] << 8) | can_message.data.byte[5]; // Byte 2-3
305+
uint16_t adv_raw = (can_message.data.byte[4] << 8) | can_message.data.byte[5]; // Byte 4-5
312306
adv = adv_raw / 10.0;
313307
break;
314308
}
@@ -578,7 +572,7 @@ void startUpDisplay()
578572
display.drawString("RPM", 190, 120);
579573
itemDraw(true);
580574
spr.loadFont(AA_FONT_LARGE);
581-
for (int i = rpm; i >= 0; i -= 250)
575+
for (int i = 6000; i >= 0; i -= 250)
582576
{
583577
drawRPMBarBlocks(i);
584578
spr.createSprite(100, 50);

0 commit comments

Comments
 (0)