Updated driver display to have lap count
This commit is contained in:
@@ -7,6 +7,7 @@ volatile float vbat_global = 0;
|
|||||||
volatile float teng_global = 0;
|
volatile float teng_global = 0;
|
||||||
volatile int gps_trigger_global = 0;
|
volatile int gps_trigger_global = 0;
|
||||||
volatile uint32_t last_lap_time_global = 0;
|
volatile uint32_t last_lap_time_global = 0;
|
||||||
|
volatile uint16_t lap_count_global = 0;
|
||||||
|
|
||||||
void vbatGlobalRead(float &out) { out = vbat_global; }
|
void vbatGlobalRead(float &out) { out = vbat_global; }
|
||||||
|
|
||||||
@@ -23,3 +24,7 @@ void gpsTriggerGlobalWrite(const int &in) { gps_trigger_global = in; }
|
|||||||
void lastLapTimeGlobalRead(uint32_t &out) { out = last_lap_time_global; }
|
void lastLapTimeGlobalRead(uint32_t &out) { out = last_lap_time_global; }
|
||||||
|
|
||||||
void lastLapTimeGlobalWrite(const uint32_t &in) { last_lap_time_global = in; }
|
void lastLapTimeGlobalWrite(const uint32_t &in) { last_lap_time_global = in; }
|
||||||
|
|
||||||
|
void lapCountGlobalRead(uint16_t &out) { out = lap_count_global; }
|
||||||
|
|
||||||
|
void lapCountGlobalWrite(const uint16_t &in) { lap_count_global = in; }
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ extern volatile float vbat_global;
|
|||||||
extern volatile float teng_global;
|
extern volatile float teng_global;
|
||||||
extern volatile int gps_trigger_global;
|
extern volatile int gps_trigger_global;
|
||||||
extern volatile uint32_t last_lap_time_global;
|
extern volatile uint32_t last_lap_time_global;
|
||||||
|
extern volatile uint16_t lap_count_global;
|
||||||
|
|
||||||
void vbatGlobalRead(float& out);
|
void vbatGlobalRead(float& out);
|
||||||
void vbatGlobalWrite(const float& in);
|
void vbatGlobalWrite(const float& in);
|
||||||
@@ -18,5 +19,8 @@ void tengGlobalWrite(const float& in);
|
|||||||
void gpsTriggerGlobalRead(int& out);
|
void gpsTriggerGlobalRead(int& out);
|
||||||
void gpsTriggerGlobalWrite(const int& in);
|
void gpsTriggerGlobalWrite(const int& in);
|
||||||
|
|
||||||
void lastLapTimeGlobalRead(uint32_t& in);
|
void lastLapTimeGlobalRead(uint32_t& out);
|
||||||
void lastLapTimeGlobalWrite(const uint32_t& out);
|
void lastLapTimeGlobalWrite(const uint32_t& in);
|
||||||
|
|
||||||
|
void lapCountGlobalRead(uint16_t& out);
|
||||||
|
void lapCountGlobalWrite(const uint16_t& in);
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ LapCounter::~LapCounter() {}
|
|||||||
int LapCounter::init() {
|
int LapCounter::init() {
|
||||||
counting_ = false;
|
counting_ = false;
|
||||||
count_ = false;
|
count_ = false;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int LapCounter::loop() {
|
int LapCounter::loop() {
|
||||||
@@ -54,6 +55,7 @@ int LapCounter::loop() {
|
|||||||
|
|
||||||
lap_times_[lap_times_idx_] = lap_time;
|
lap_times_[lap_times_idx_] = lap_time;
|
||||||
count_++;
|
count_++;
|
||||||
|
lapCountGlobalWrite(count_);
|
||||||
|
|
||||||
last_trigger_time_ = time_cs;
|
last_trigger_time_ = time_cs;
|
||||||
|
|
||||||
|
|||||||
@@ -163,6 +163,9 @@ int Lcd::renderDriverPrimary() {
|
|||||||
|
|
||||||
int line_trigger;
|
int line_trigger;
|
||||||
gpsTriggerGlobalRead(line_trigger);
|
gpsTriggerGlobalRead(line_trigger);
|
||||||
|
|
||||||
|
uint16_t num_laps;
|
||||||
|
lapCountGlobalRead(num_laps);
|
||||||
|
|
||||||
display_->setCursor(0, 0);
|
display_->setCursor(0, 0);
|
||||||
this->print("GPS:");
|
this->print("GPS:");
|
||||||
@@ -173,24 +176,9 @@ int Lcd::renderDriverPrimary() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
display_->setCursor(7, 0);
|
display_->setCursor(7, 0);
|
||||||
this->print("TRIG:");
|
this->print("LAPS:");
|
||||||
switch (line_trigger) {
|
if (num_laps < 10) this->print('0');
|
||||||
case 0:
|
this->print(num_laps, 10);
|
||||||
this->print("I");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 1:
|
|
||||||
this->print("A");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
this->print("T");
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
this->print("NULL");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
display_->setCursor(0, 2);
|
display_->setCursor(0, 2);
|
||||||
this->print("SPD:");
|
this->print("SPD:");
|
||||||
|
|||||||
Reference in New Issue
Block a user