Refactor calibration constants and update travel snippet documentation

This commit is contained in:
alvinlollo
2026-10-09 15:01:43 +11:00
parent 1c241952fb
commit 39f561a23f
2 changed files with 7 additions and 3 deletions
+2 -2
View File
@@ -65,8 +65,8 @@
}, },
"DCMotorTravelDistance": { "DCMotorTravelDistance": {
"prefix": "MoveCm", "prefix": "MoveCm",
"body": "// Distance = ${1:30}cm, Speed = ${2:speedVar}\nboard.Move(${3:FORWARD}, ${4:POWER}, (#${1:30}*${2:speedVar}), ${5:COAST});", "body": "// Distance = ${1:30}cm, Speed = ${2:speedVar} (ms/cm)\nboard.Move(${3:FORWARD}, ${4:POWER}, (#${1:30}*${2:speedVar}), ${5:COAST});",
"description": "Moves DC motor for a distance in cm (using #cm*Variable syntax)" "description": "Moves DC motor for a distance in cm (using #cm*Variable syntax, ensure speedVar is ms/cm)"
}, },
"SetDCMotorCalibration": { "SetDCMotorCalibration": {
"prefix": "SetDCMotorCalibration", "prefix": "SetDCMotorCalibration",
+5 -1
View File
@@ -1,11 +1,15 @@
#include <Studuino.h> #include <Studuino.h>
#include <Clock.h> // Keep the complete smoke-test dependency set in clangd's database. #include <Clock.h> // Keep the complete smoke-test dependency set in clangd's database.
// DC Motor Calibration (0-100)
#define M1_CALIB 100
#define M2_CALIB 100
Studuino board; Studuino board;
void setup() { void setup() {
board.InitSensorPort(PORT_A0, PIDLED); board.InitSensorPort(PORT_A0, PIDLED);
byte calib[] = { 100, 100 }; byte calib[] = { M1_CALIB, M2_CALIB };
board.SetDCMotorCalibration(calib); board.SetDCMotorCalibration(calib);
} }