arduino: working altsoftserial with WT61 IMU
This commit is contained in:
3
arduino/.gitignore
vendored
Normal file
3
arduino/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# arduino test files
|
||||||
|
|
||||||
|
test/
|
||||||
@@ -83,15 +83,11 @@ void imu_init() {
|
|||||||
// Sets WT61 to 9600/20Hz - see IMU.md for command reference
|
// Sets WT61 to 9600/20Hz - see IMU.md for command reference
|
||||||
// Idempotent: if already at 9600, command is garbled and ignored
|
// Idempotent: if already at 9600, command is garbled and ignored
|
||||||
imuSerial.begin(115200);
|
imuSerial.begin(115200);
|
||||||
|
imu_send_cmd(0x64); // 9600 baud / 20Hz
|
||||||
/* uncomment after I wire up Nano D9 -> WT61 RX*/
|
delay(100); // Let WT61 process and restart
|
||||||
// imu_send_cmd(0x64); // 9600 baud / 20Hz
|
|
||||||
// delay(100); // Let WT61 process and restart
|
|
||||||
|
|
||||||
// Switch to working baud rate
|
// Switch to working baud rate
|
||||||
// imuSerial.begin(9600);
|
imuSerial.begin(9600);
|
||||||
/* uncomment after I wire up Nano D9 -> WT61 RX*/
|
|
||||||
|
|
||||||
rxIndex = 0;
|
rxIndex = 0;
|
||||||
currentData = {0};
|
currentData = {0};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,17 +12,24 @@ static unsigned long lastTelemetryTime = 0;
|
|||||||
void setup() {
|
void setup() {
|
||||||
pinMode(LED_BUILTIN, OUTPUT);
|
pinMode(LED_BUILTIN, OUTPUT);
|
||||||
|
|
||||||
|
comms_init(); // Hardware Serial first so we can debug
|
||||||
|
Serial.println(F("[INIT] comms ok"));
|
||||||
|
|
||||||
voltage_init();
|
voltage_init();
|
||||||
|
Serial.println(F("[INIT] voltage ok"));
|
||||||
|
|
||||||
imu_init(); // AltSoftSerial on pins 8(RX)/9(TX)
|
imu_init(); // AltSoftSerial on pins 8(RX)/9(TX)
|
||||||
comms_init(); // Hardware Serial to Pi at 115200
|
Serial.println(F("[INIT] imu ok"));
|
||||||
|
|
||||||
// Let IMU warm up a bit before calibrating
|
// Let IMU warm up a bit before calibrating
|
||||||
// (WT61 needs a moment to stabilize after power-on)
|
// (WT61 needs a moment to stabilize after power-on)
|
||||||
delay(500);
|
delay(500);
|
||||||
|
|
||||||
|
Serial.println(F("[INIT] calibrating..."));
|
||||||
// Zero calibration - current position becomes reference
|
// Zero calibration - current position becomes reference
|
||||||
// Blocks for ~250ms while sampling
|
// Blocks for ~250ms while sampling
|
||||||
imu_calibrate();
|
imu_calibrate();
|
||||||
|
Serial.println(F("[INIT] calibration done, entering loop"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
|||||||
Reference in New Issue
Block a user