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
5 changes: 5 additions & 0 deletions package_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ A full-featured self-balancing skateboard package.
## New in 1.3
This version reworks a lot of the core control mechanisms and adds Setpoint Smoothing to all Tilts. Due to this, boards will behave slightly differently and tunes might need adjusting.

### Recent additions
- LED status bar can now be disabled above a configurable speed while still allowing duty/current utilization indicators to remain active
- New GUI options for the LED speed cutoff and enable/disable toggle
- Improved compatibility with config restore workflows when new settings are introduced

Changelog highlights:
- Reworked internal timing for better vibration rejection and more consistent tune behavior across setups
- Setpoint Smoothing for all Tilts (ATR, Torque Tilt, Brake Tilt, Turn Tilt, Remote)
Expand Down
2 changes: 2 additions & 0 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ $(REFLOAT_SOURCES): $(CONF_GEN_HEADERS) conf/conf_general.h

$(CONF_GEN_FILES) &: conf/settings.xml
$(VESC_TOOL) --xmlConfToCode conf/settings.xml
sed -i 's/conf->leds.status.speed_off_threshold, 10000/conf->leds.status.speed_off_threshold, 1/g' conf/confparser.c
sed -i 's/conf->leds.status.speed_off_threshold = buffer_get_float16(buffer, 10000/conf->leds.status.speed_off_threshold = buffer_get_float16(buffer, 1/g' conf/confparser.c
# !!! make xml config loading in vesc_tool work with LTO !!!
sed -i "s/^uint8_t data_/__attribute__((used)) uint8_t data_/g" conf/confxml.c

Expand Down
2 changes: 2 additions & 0 deletions src/conf/datatypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ typedef struct {

typedef struct {
uint16_t idle_timeout;
bool disable_soc_above_speed;
float speed_off_threshold;
float motor_utilization_threshold;
float red_bar_percentage;
bool show_sensors_while_running;
Expand Down
39 changes: 39 additions & 0 deletions src/conf/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2746,6 +2746,7 @@ p, li { white-space: pre-wrap; }
<enumNames>Rainbow Fade</enumNames>
<enumNames>Rainbow Roll</enumNames>
</leds.front.mode>

<leds.front.brightness>
<longName>Front Brightness</longName>
<type>1</type>
Expand Down Expand Up @@ -3440,6 +3441,40 @@ p, li { white-space: pre-wrap; }
<cDefine>CFG_DFLT_LEDS_STATUS_SHOW_SENSORS_WHILE_RUNNING</cDefine>
<valInt>1</valInt>
</leds.status.show_sensors_while_running>
<leds.status.disable_soc_above_speed>
<longName>Disable SOC Status Above Speed</longName>
<type>5</type>
<transmittable>1</transmittable>
<description>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Roboto'; ; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;When enabled, the normal SOC/status bar turns fully off once the board is moving faster than the configured cutoff speed. Duty cycle / motor utilization still shows if it crosses its threshold.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</description>
<cDefine>CFG_DFLT_LEDS_STATUS_DISABLE_SOC_ABOVE_SPEED</cDefine>
<valInt>0</valInt>
</leds.status.disable_soc_above_speed>
<leds.status.speed_off_threshold>
<longName>Status Off Speed Threshold</longName>
<type>1</type>
<transmittable>1</transmittable>
<description>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Roboto'; ; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Board speed in km/h above which the normal SOC/status bar is turned off when the toggle above is enabled. The duty cycle and motor utilization indicators still override this cutoff when their thresholds are reached.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</description>
<cDefine>CFG_DFLT_LEDS_STATUS_SPEED_OFF_THRESHOLD</cDefine>
<editorDecimalsDouble>0</editorDecimalsDouble>
<editorScale>1</editorScale>
<editAsPercentage>0</editAsPercentage>
<maxDouble>80</maxDouble>
<minDouble>0</minDouble>
<showDisplay>0</showDisplay>
<stepDouble>1</stepDouble>
<valDouble>4</valDouble>
<vTxDoubleScale>1</vTxDoubleScale>
<suffix>km/h</suffix>
<vTx>7</vTx>
</leds.status.speed_off_threshold>
<leds.status.motor_utilization_threshold>
<longName>Motor Utilization Threshold</longName>
<type>1</type>
Expand Down Expand Up @@ -4188,6 +4223,8 @@ p, li { white-space: pre-wrap; }
<ser>leds.status.brightness_headlights_on</ser>
<ser>leds.status.show_sensors_while_running</ser>
<ser>leds.status.motor_utilization_threshold</ser>
<ser>leds.status.disable_soc_above_speed</ser>
<ser>leds.status.speed_off_threshold</ser>
<ser>leds.status.red_bar_percentage</ser>
<ser>leds.status.idle_timeout</ser>
<ser>leds.status_idle.mode</ser>
Expand Down Expand Up @@ -4446,6 +4483,8 @@ p, li { white-space: pre-wrap; }
<param>leds.status.brightness_headlights_on</param>
<param>leds.status.show_sensors_while_running</param>
<param>leds.status.motor_utilization_threshold</param>
<param>leds.status.disable_soc_above_speed</param>
<param>leds.status.speed_off_threshold</param>
<param>leds.status.red_bar_percentage</param>
<param>leds.status.idle_timeout</param>
<param>::sep::Status Idle</param>
Expand Down
58 changes: 56 additions & 2 deletions src/leds.c
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,9 @@ static void status_animate(
float blend,
float idle_blend
) {
const float speed_kph = fabsf(motor->speed);
const bool moving = speed_kph > 0.5f;

if (fabsf(VESC_IF->mc_get_rpm()) > ERPM_MOVING_THRESHOLD) {
leds->status_idle_time = current_time;
}
Expand All @@ -565,6 +568,44 @@ static void status_animate(
rate_limitf(&leds->status_utilization_blend, 0.0f, SB_RATE);
}

const bool soc_off_by_speed =
leds->cfg->status.disable_soc_above_speed && moving &&
speed_kph >= leds->cfg->status.speed_off_threshold;
const float soc_off_hyst = 1.0f;
const float soc_on_threshold = leds->cfg->status.speed_off_threshold - soc_off_hyst;
const bool soc_should_be_off =
leds->cfg->status.disable_soc_above_speed &&
(soc_off_by_speed ||
(leds->status_soc_blend < 0.5f && moving && speed_kph > soc_on_threshold));

float target_soc_blend = 1.0f;
if (leds->cfg->status.disable_soc_above_speed) {
if (!moving) {
target_soc_blend = 1.0f;
} else if (speed_kph >= leds->cfg->status.speed_off_threshold) {
target_soc_blend = 0.0f;
} else if (speed_kph <= soc_on_threshold && leds->status_soc_blend <= 0.5f) {
target_soc_blend = 1.0f;
} else {
target_soc_blend = leds->status_soc_blend;
}
}
if (soc_should_be_off) {
target_soc_blend = 0.0f;
}
rate_limitf(&leds->status_soc_blend, target_soc_blend, SB_RATE);

float soc_blend = leds->status_soc_blend;
if (soc_should_be_off || target_soc_blend <= 0.05f) {
idle_blend = 0.0f;
soc_blend = 0.0f;
}

if (soc_should_be_off && leds->status_utilization_blend <= 0.0f) {
strip_set_color(leds, strip, 0x00000000, 0.0f, 1.0f);
return;
}

if (idle_blend > 0.0f) {
if (strip == &leds->front_strip) {
strip_set_color(leds, strip, 0x00000000, strip->brightness, blend);
Expand All @@ -580,10 +621,16 @@ static void status_animate(

if (idle_blend < 1.0f) {
const bool reverse = strip == &leds->front_strip;

if (leds->status_utilization_blend < 1.0f) {
const float battery = VESC_IF->mc_get_battery_level(NULL);
anim_battery_bar(
leds, strip, battery, reverse, fminf(blend, 1.0f - idle_blend), current_time
leds,
strip,
battery,
reverse,
fminf(blend, soc_blend),
current_time
);
}

Expand All @@ -601,7 +648,13 @@ static void status_animate(
}

anim_progress_bar(
leds, strip, max_sat, max_color, true, reverse, leds->status_utilization_blend
leds,
strip,
max_sat,
max_color,
true,
reverse,
leds->status_utilization_blend * blend
);
}

Expand Down Expand Up @@ -798,6 +851,7 @@ void leds_init(Leds *leds) {
leds->motor_utilization_threshold = 0.0f;
leds->status_utilization_blend = 0.0f;
leds->status_idle_blend = 0.0f;
leds->status_soc_blend = 1.0f;
leds->status_idle_time = 0.0f;
leds->status_animation_start = 0.0f;

Expand Down
1 change: 1 addition & 0 deletions src/leds.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ typedef struct {
float motor_utilization_threshold;
float status_utilization_blend;
float status_idle_blend;
float status_soc_blend;
float status_idle_time;
float status_animation_start;

Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.3.1-beta1
1.3.1-beta2