Skip to content

Commit 2d1b556

Browse files
committed
admt: Added turn count to acquisition tab
- Removed raw motor target and current position - Added reset motor position button - Revised ABS angle turn count calculation - Code cleanup Signed-off-by: John Lloyd Juanillo <[email protected]>
1 parent 4f49ae8 commit 2d1b556

File tree

4 files changed

+64
-127
lines changed

4 files changed

+64
-127
lines changed

plugins/admt/include/admt/admtcontroller.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,8 @@ class SCOPY_ADMT_EXPORT ADMTController : public QObject
191191
const uint32_t HarmonicPages[HARMONIC_REGISTER_COUNT] = {0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02};
192192
const uint32_t SensorRegisters[SENSOR_REGISTER_COUNT] = {0x03, 0x05, 0x08, 0x10, 0x11, 0x12, 0x13,
193193
0x18, 0x1D, 0x1E, 0x20, 0x23, 0x14};
194-
const uint32_t SensorPages[SENSOR_REGISTER_COUNT] = {UINT32_MAX, UINT32_MAX, UINT32_MAX, 0x00, 0x00, 0x00, 0x00,
195-
0x00, 0x00, 0x00, 0x00, 0x00, 0x02};
194+
const uint32_t SensorPages[SENSOR_REGISTER_COUNT] = {0x00, UINT32_MAX, UINT32_MAX, 0x00, 0x00, 0x00, 0x00,
195+
0x00, 0x00, 0x00, 0x00, 0x00, 0x02};
196196

197197
const uint32_t
198198
RampGeneratorDriverFeatureControlRegisters[RAMP_GENERATOR_DRIVER_FEATURE_CONTROL_REGISTER_COUNT] = {

plugins/admt/include/admt/harmoniccalibration.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,6 @@ public Q_SLOTS:
272272
void startDeviceStatusMonitor();
273273
void stopDeviceStatusMonitor();
274274
void getDeviceFaultStatus(int sampleRate);
275-
void startCurrentMotorPositionMonitor();
276-
void stopCurrentMotorPositionMonitor();
277275
void currentMotorPositionTask(int sampleRate);
278276
bool resetGENERAL();
279277
void stopTasks();
@@ -357,7 +355,7 @@ public Q_SLOTS:
357355
int readMotorRegisterValue(uint32_t address, uint32_t *value);
358356
void setRampMode(bool motorRotationClockwise);
359357
void getRampMode();
360-
void startResetMotorToZero();
358+
void startResetMotorToZero(bool enableWatcher = false);
361359
void stopResetMotorToZero();
362360
void resetMotorToZero();
363361
#pragma endregion
@@ -387,8 +385,6 @@ public Q_SLOTS:
387385
#pragma endregion
388386

389387
#pragma region UI Helper Methods
390-
void updateLabelValue(QLabel *label, int channelIndex);
391-
void updateLabelValue(QLabel *label, ADMTController::MotorAttribute attribute);
392388
bool updateChannelValue(int channelIndex);
393389
void updateLineEditValue(QLineEdit *lineEdit, double value);
394390
void toggleWidget(QPushButton *widget, bool value);
@@ -406,6 +402,7 @@ public Q_SLOTS:
406402
void connectLineEditToDouble(QLineEdit *lineEdit, double &variable);
407403
void connectLineEditToNumberWrite(QLineEdit *lineEdit, double &variable,
408404
ADMTController::MotorAttribute attribute);
405+
void connectLineEditToMotorTurnCount(QLineEdit *lineEdit, int &variable, int min, int max);
409406
void connectMenuComboToNumber(MenuCombo *menuCombo, double &variable);
410407
void connectMenuComboToNumber(MenuCombo *menuCombo, int &variable);
411408
void connectLineEditToRPSConversion(QLineEdit *lineEdit, double &vmax);

plugins/admt/src/admtcontroller.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,12 +1213,12 @@ uint16_t ADMTController::setGeneralRegisterBitMapping(uint16_t currentRegisterVa
12131213
int ADMTController::getAbsAngleTurnCount(uint16_t registerValue)
12141214
{
12151215
// Bits 15:8: Turn count in quarter turns
1216-
uint8_t turnCount = (registerValue & 0xFF00) >> 8;
1216+
uint8_t turnCount = (registerValue >> 8) & 0xFC;
12171217

1218-
if(turnCount <= 0xD7) {
1218+
if(turnCount <= 0xD4) {
12191219
// Straight binary turn count
12201220
return turnCount / 4; // Convert from quarter turns to whole turns
1221-
} else if(turnCount >= 0xD8 && turnCount <= 0xDB) {
1221+
} else if(turnCount == 0xD8) {
12221222
// Invalid turn count
12231223
return turnCount / 4;
12241224
} else {

0 commit comments

Comments
 (0)