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: 9 additions & 6 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
]
}
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
],
"unwantedRecommendations": [
"ms-vscode.cpptools-extension-pack"
]
}
2 changes: 1 addition & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ platform = atmelavr
board = uno
framework = arduino
monitor_speed = 115200
lib_deps = DMXSerial
lib_deps = DMXSerial, DmxSimple
lib_ignore = DMXSerial, ESPDMX, WifiManager, Ethernet, WiFi, UIPEthernet
build_flags =
-D USE_DMXSimple=1
Expand Down
19 changes: 17 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,26 @@ uint8_t scaleSpeed(uint8_t sp, uint8_t dx, uint8_t dmax) {
return sp;
} else {
uint16_t ret = sp % 100;

ret = ret * 100;

ret = ret * dmax / dx;

if (sp < 10000 && ret * 4 < 10000) {
sp = 100 + (sp * 4);
ret = ret * 4;
}
if (sp > 10000 && sp < 200 && ret * 2 < 5500) {
sp = 200 + ((sp % 100) * 2);
ret = ret * 2;
}

ret = ret / 100;

if (sp < 200) {
ret = min(ret, (uint16_t) 99);
ret = min(ret, uint16_t(99));
} else {
ret = min(ret, (uint16_t) 54);
ret = min(ret, uint16_t(54));
}
return ret + (sp - (sp % 100));
}
Expand Down
2 changes: 1 addition & 1 deletion src/worker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void workerClass::step() {
newValue = oldValue;
chStep = queueItem->dimSpeed % 100;
if (chStep == 0) {
chStep = 1;
chStep = 1;
}
if (queueItem->dimSpeed >= 200) {
chInc = 8;
Expand Down