BLE fixed

This commit is contained in:
vanarebane 2025-03-02 10:52:02 +02:00
parent 95fc1c23e2
commit 2735ded7d4
4 changed files with 52 additions and 4 deletions

View File

@ -51,7 +51,7 @@
<button id="setmobile" class="statebtns" data-cmd="STM">Green</button>
<button id="setlocked" class="statebtns" data-cmd="STL">Blue</button>
</div>
<button id="profileconfig" >SmartKnob Config</button><br>
<button id="profileconfig" >SmartKnob Profile</button><br>
<div class="profileconfig_dialog">
<div class="profilegroup">

View File

@ -13,7 +13,7 @@
// ####
// Hardware-specific motor calibration constants.
// Run calibration once at startup, then update these constants with the calibration results.
static const float ZERO_ELECTRICAL_OFFSET = 4.7;
static const float ZERO_ELECTRICAL_OFFSET = 4.08; // 6.5; //6.21;
static const Direction FOC_DIRECTION = Direction::CW;
static const int MOTOR_POLE_PAIRS = 7;
@ -38,7 +38,7 @@ static const float IDLE_CORRECTION_MAX_ANGLE_RAD = 5 * PI / 180;
static const float IDLE_CORRECTION_RATE_ALPHA = 0.0005;
MotorTask::MotorTask(const uint8_t task_core) : Task("Motor", 2500, 1, task_core) {
MotorTask::MotorTask(const uint8_t task_core) : Task("Motor", 4000, 1, task_core) {
queue_ = xQueueCreate(5, sizeof(Command));
assert(queue_ != NULL);
}

View File

@ -57,7 +57,7 @@ build_flags =
-DNUM_LEDS=8
-DSENSOR_MT6701=1
-DSK_STRAIN=1
-DSK_INVERT_ROTATION=1
-DSK_INVERT_ROTATION=0
-DSK_ALS=1
-DPIN_UH=25 #26

View File

@ -0,0 +1,48 @@
#include <SPI.h>
#include "MT6701.h"
MT6701 encoder;
#define MT_DATA 37
#define MT_CLOCK 13
#define CSN_PIN 14 // CSN pin of NT6701
int pushButton = 4;
void setup() {
Serial.begin(115200);
SPI.begin(MT_CLOCK, MT_DATA, 38, 15);
// put your setup code here, to run once:
encoder.initializeSSI(CSN_PIN);
// Hom many poles should be emulated
encoder.uvwModeSet(4);
// Chip could be setting in ABZ mode wtih MODE pin
pinMode(pushButton, INPUT_PULLUP);
}
void loop() {
float angle = encoder.angleRead();
Serial.print("Angle:");
Serial.println(angle);
// Serial.print("MOSI: ");
// Serial.println(MOSI);
// Serial.print("MISO: ");
// Serial.println(MISO);
// Serial.print("SCK: ");
// Serial.println(SCK);
// Serial.print("SS: ");
// Serial.println(SS);
// read the input pin:
// int buttonState = digitalRead(pushButton);
// // // print out the state of the button:
// Serial.println(buttonState);
delay(100); // delay in between reads for stability
}