Dynalab implementation

JSON protocol implemented in this version to send the data to the
server. Correction of the rpmhz value due to an offset angle of the hall
effect captors.
This commit is contained in:
Martin Girard committed 2026-09-23 14:42:10 +02:00
1 parent d2318b6903
commit fdd4597233
4 files changed
+391 -20

No files matched your search

+3 -1
View File
@@ -9,6 +9,7 @@ volatile unsigned long timestamp2 = 0;
volatile bool new_rpm = false;
const unsigned long deltat_lambda = 100000;
unsigned long last_lambda = 0;
unsigned long last_deltat = 0;
typedef uint8_t data_type;
@@ -115,10 +116,11 @@ void loop() {
// put your main code here, to run repeatedly:
if (new_rpm){
unsigned long deltat = timestamp1 - timestamp2;
float rpmhz = 500000.0 / deltat;
float rpmhz = 1000000.0 / (deltat + last_deltat);
new_rpm = false;
data_packet speed_packet = pack(SPEED,timestamp1,rpmhz);
Serial.write((uint8_t*)&speed_packet, sizeof(data_packet));
last_deltat = deltat;
//Serial.print("Speed: ");
//Serial.println(rpmhz);
}