Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions ESP32/Digifiz/main/display_next.c
Original file line number Diff line number Diff line change
Expand Up @@ -1095,3 +1095,18 @@ void fireDigifiz() {
}
led_strip_refresh(led_strip);
}

// Fill all display segments with a single color ignoring display mask
void fillAllSegmentsWithColor(uint8_t r, uint8_t g, uint8_t b)
{
if (!led_strip) {
return;
}
for (uint16_t i = 0; i < DIGIFIZ_DISPLAY_NEXT_LEDS + DIGIFIZ_BACKLIGHT_LEDS; i++) {
led_strip_set_pixel(led_strip, i,
((uint32_t)r * ((uint32_t)backlightLevel)) / 100,
((uint32_t)g * ((uint32_t)backlightLevel)) / 100,
((uint32_t)b * ((uint32_t)backlightLevel)) / 100);
}
led_strip_refresh(led_strip);
}
7 changes: 7 additions & 0 deletions ESP32/Digifiz/main/display_next.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ extern "C" {

#define USE_DISPLAY_LEDS

// Test mode identifiers
#define TEST_MODE_CYCLE 1
#define TEST_MODE_STATIC 2
#define TEST_MODE_COLOR 3

enum
{
DIGIT_NUMBER_0 = 0b0111111,
Expand Down Expand Up @@ -191,6 +196,8 @@ void setBackLightsHeatIndicator(bool onoff);
void setBackWindowHeatIndicator(bool onoff);
void processIndicators();

void fillAllSegmentsWithColor(uint8_t r, uint8_t g, uint8_t b);

void deinit_leds(void);

extern ColoringScheme digifizCustom;
Expand Down
23 changes: 20 additions & 3 deletions ESP32/Digifiz/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,10 +244,17 @@ void displayUpdate(void *pvParameters) {
spd_m /= 100;
}

if (!digifiz_parameters.option_testmode_on.value)
uint8_t tmode = digifiz_parameters.test_mode.value;
if (!digifiz_parameters.option_testmode_on.value || tmode == TEST_MODE_CYCLE)
{
spd_m_speedometer += (spd_m-spd_m_speedometer)*0.5;
rpm = readLastRPM();
rpm = readLastRPM();
}
if (digifiz_parameters.option_testmode_on.value && tmode == TEST_MODE_STATIC)
{
spd_m_speedometer = digifiz_parameters.test_static_speed.value;
rpm = digifiz_parameters.test_static_rpm.value;
averageRPM = (float)rpm;
}
//For test fuel intake
//spd_m_speedometer = 60.0f;
Expand All @@ -269,6 +276,16 @@ void displayUpdate(void *pvParameters) {
averageRPM += (0-averageRPM)*0.5;
}
gear_estimator_set_input(rpm, spd_m);

if (digifiz_parameters.option_testmode_on.value && tmode == TEST_MODE_COLOR)
{
fillAllSegmentsWithColor(digifiz_parameters.test_color_r.value,
digifiz_parameters.test_color_g.value,
digifiz_parameters.test_color_b.value);
xSemaphoreGive(displayMutex); // Give back the mutex
vTaskDelayUntil(&lastWakeTime, rateCalculationPeriod);
continue;
}


//For test fuel intake
Expand All @@ -282,7 +299,7 @@ void displayUpdate(void *pvParameters) {
setSpeedometerData((uint16_t)spd_m_speedometer);
//setSpeedometerData(gear_estimator_get_current_gear()); // Convert to integer km/h);
current_averageSpeed += (spd_m_speedometer-current_averageSpeed)*0.01;
if (digifiz_parameters.option_testmode_on.value)
if (digifiz_parameters.option_testmode_on.value && tmode == TEST_MODE_CYCLE)
{
spd_m_speedometer+=1;
if (spd_m_speedometer>499)
Expand Down
43 changes: 43 additions & 0 deletions ESP32/Digifiz/main/params_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,49 @@ extern "C" {
.value = 0, \
.max = 1, \
) \
PARAM( \
U8, \
test_mode, \
.p_name = "Test mode type", \
.p_info = "1-cycle, 2-static, 3-color",\
.value = 1, \
.max = 3, \
) \
PARAM( \
U16, \
test_static_speed, \
.p_name = "Static speed", \
.p_info = "Speed for static test",\
.value = 100, \
) \
PARAM( \
U16, \
test_static_rpm, \
.p_name = "Static RPM", \
.p_info = "RPM for static test",\
.value = 3000, \
) \
PARAM( \
U8, \
test_color_r, \
.p_name = "Test color R", \
.p_info = "Red component for color test",\
.value = 255, \
) \
PARAM( \
U8, \
test_color_g, \
.p_name = "Test color G", \
.p_info = "Green component for color test",\
.value = 0, \
) \
PARAM( \
U8, \
test_color_b, \
.p_name = "Test color B", \
.p_info = "Blue component for color test",\
.value = 0, \
) \
PARAM( \
U8, \
rpmOptions_redline_segments, \
Expand Down