@@ -113,24 +113,26 @@ public Q_SLOTS:
113
113
void stop ();
114
114
void start ();
115
115
void restart ();
116
- void commandLogWrite (QString message);
116
+ void calibrationLogWrite (QString message = " " );
117
+ void commandLogWrite (QString message = " " );
117
118
void updateFaultStatus (bool value);
118
119
void updateMotorPosition (double position);
119
- void updateDIGIOUI (uint32_t *registerValue);
120
- void updateFaultRegisterUI (uint32_t *registerValue);
121
- void updateMTDiagnosticRegisterUI (uint32_t *registerValue);
122
- void updateMTDiagnosticsUI (uint32_t *registerValue);
120
+ void updateDIGIOUI (uint16_t *registerValue);
121
+ void updateFaultRegisterUI (uint16_t *registerValue);
122
+ void updateMTDiagnosticRegisterUI (uint16_t *registerValue);
123
+ void updateMTDiagnosticsUI (uint16_t *registerValue);
123
124
Q_SIGNALS:
124
125
void runningChanged (bool );
125
126
void canCalibrateChanged (bool );
126
127
void updateUtilityUI ();
128
+ void calibrationLogWriteSignal (QString message);
127
129
void commandLogWriteSignal (QString message);
128
130
void updateFaultStatusSignal (bool value);
129
131
void motorPositionChanged (double position);
130
- void DIGIORegisterChanged (uint32_t *registerValue);
131
- void FaultRegisterChanged (uint32_t *registerValue);
132
- void DIAG1RegisterChanged (uint32_t *registerValue);
133
- void DIAG2RegisterChanged (uint32_t *registerValue);
132
+ void DIGIORegisterChanged (uint16_t *registerValue);
133
+ void FaultRegisterChanged (uint16_t *registerValue);
134
+ void DIAG1RegisterChanged (uint16_t *registerValue);
135
+ void DIAG2RegisterChanged (uint16_t *registerValue);
134
136
private:
135
137
ADMTController *m_admtController;
136
138
iio_context *m_ctx;
@@ -142,15 +144,16 @@ public Q_SLOTS:
142
144
143
145
const char *rotationChannelName, *angleChannelName, *countChannelName, *temperatureChannelName;
144
146
145
- double rotation, angle, count, temp = 0.0 , amax, rotate_vmax, dmax, disable, target_pos, current_pos, ramp_mode,
147
+ double rotation, angle, count, temp = 0.0 ,
148
+ motor_rpm, amax, rotate_vmax, dmax, disable, target_pos, current_pos, ramp_mode,
146
149
afeDiag0, afeDiag1, afeDiag2;
147
150
148
151
QPushButton *openLastMenuButton, *calibrationStartMotorButton,
149
152
*calibrateDataButton, *extractDataButton, *clearCalibrateDataButton,
150
153
*clearCommandLogButton, *applySequenceButton, *readAllRegistersButton;
151
154
QButtonGroup *rightMenuButtonGroup;
152
155
153
- QLineEdit *motorTargetPositionLineEdit, *graphUpdateIntervalLineEdit, *displayLengthLineEdit,
156
+ QLineEdit *acquisitionMotorRPMLineEdit, *calibrationMotorRPMLineEdit, * motorTargetPositionLineEdit, *graphUpdateIntervalLineEdit, *displayLengthLineEdit,
154
157
*dataGraphSamplesLineEdit, *tempGraphSamplesLineEdit,
155
158
*acquisitionMotorCurrentPositionLineEdit,
156
159
*calibrationH1MagLineEdit, *calibrationH2MagLineEdit,
@@ -179,7 +182,8 @@ public Q_SLOTS:
179
182
MenuSectionWidget *rightMenuSectionWidget;
180
183
MenuCollapseSection *rotationCollapse, *angleCollapse, *countCollapse, *tempCollapse;
181
184
MenuCombo *m_dataGraphChannelMenuCombo, *m_dataGraphDirectionMenuCombo, *m_tempGraphDirectionMenuCombo, *m_calibrationMotorRampModeMenuCombo,
182
- *sequenceTypeMenuCombo, *conversionTypeMenuCombo, *cnvSourceMenuCombo, *convertSynchronizationMenuCombo, *angleFilterMenuCombo, *eighthHarmonicMenuCombo;
185
+ *sequenceTypeMenuCombo, *conversionTypeMenuCombo, *cnvSourceMenuCombo, *convertSynchronizationMenuCombo, *angleFilterMenuCombo, *eighthHarmonicMenuCombo,
186
+ *calibrationModeMenuCombo;
183
187
184
188
QTabWidget *tabWidget, *calibrationDataGraphTabWidget, *resultDataTabWidget;
185
189
@@ -213,7 +217,7 @@ public Q_SLOTS:
213
217
214
218
HorizontalSpinBox *motorMaxVelocitySpinBox, *motorAccelTimeSpinBox, *motorMaxDisplacementSpinBox, *motorTargetPositionSpinBox;
215
219
216
- CustomSwitch *calibrationDisplayFormatSwitch,
220
+ CustomSwitch *acquisitionMotorDirectionSwitch, *calibrationMotorDirectionSwitch, * calibrationDisplayFormatSwitch,
217
221
*DIGIO0ENToggleSwitch, *DIGIO0FNCToggleSwitch,
218
222
*DIGIO1ENToggleSwitch, *DIGIO1FNCToggleSwitch,
219
223
*DIGIO2ENToggleSwitch, *DIGIO2FNCToggleSwitch,
@@ -226,10 +230,12 @@ public Q_SLOTS:
226
230
227
231
QFuture<void > m_deviceStatusThread, m_currentMotorPositionThread,
228
232
m_acquisitionUIThread, m_acquisitionDataThread, m_acquisitionGraphThread,
229
- m_calibrationUIThread, m_utilityUIThread, m_utilityThread;
233
+ m_calibrationUIThread, m_calibrationStreamThread, m_calibrationWaitVelocityThread, m_calibrationContinuousThread,
234
+ m_resetMotorToZeroThread, m_utilityUIThread, m_utilityThread;
230
235
QFutureWatcher<void > m_deviceStatusWatcher, m_currentMotorPositionWatcher,
231
236
m_acquisitionUIWatcher, m_acquisitionDataWatcher, m_acquisitionGraphWatcher,
232
- m_calibrationUIWatcher, m_utilityUIWatcher, m_utilityWatcher;
237
+ m_calibrationUIWatcher, m_calibrationStreamWatcher, m_calibrationWaitVelocityWatcher, m_calibrationContinuousWatcher,
238
+ m_resetMotorToZeroWatcher, m_utilityUIWatcher, m_utilityWatcher;
233
239
234
240
ToolTemplate* createAcquisitionWidget ();
235
241
ToolTemplate* createCalibrationWidget ();
@@ -239,6 +245,7 @@ public Q_SLOTS:
239
245
void readDeviceProperties ();
240
246
void initializeADMT ();
241
247
bool readSequence ();
248
+ bool writeSequence (const map<string, int > &settings);
242
249
void applySequence ();
243
250
bool changeCNVPage (uint32_t page);
244
251
void initializeMotor ();
@@ -256,6 +263,8 @@ public Q_SLOTS:
256
263
void updateLineEditValues ();
257
264
void startAcquisition ();
258
265
void stopAcquisition ();
266
+ void updateAcquisitionMotorRPM ();
267
+ void updateAcquisitionMotorRotationDirection ();
259
268
void getAcquisitionSamples (int sampleRate);
260
269
double getAcquisitionParameterValue (const AcquisitionDataKey &key);
261
270
void plotAcquisition (QVector<double >& list, PlotChannel* channel);
@@ -276,30 +285,43 @@ public Q_SLOTS:
276
285
void startCalibrationUITask ();
277
286
void stopCalibrationUITask ();
278
287
void calibrationUITask (int sampleRate);
288
+ void updateCalibrationMotorRPM ();
289
+ void updateCalibrationMotorRotationDirection ();
279
290
void getCalibrationSamples ();
280
291
void startCalibration ();
281
292
void stopCalibration ();
282
- void startMotor ();
283
- void startMotorContinuous ();
293
+ void startContinuousCalibration ();
294
+ void stopContinuousCalibration ();
295
+ void startCalibrationStreamThread ();
296
+ void stopCalibrationStreamThread ();
297
+ void startWaitForVelocityReachedThread (int mode);
298
+ void stopWaitForVelocityReachedThread ();
299
+ void waitForVelocityReached (int mode, int sampleRate);
300
+ int calculateContinuousCalibrationSampleRate (double motorRPS, int samplesPerCycle);
301
+ void configureConversionType (int mode);
302
+ void configureCalibrationSequenceSettings ();
303
+ void getStreamedCalibrationSamples (int microSampleRate);
304
+ void startOneShotCalibration ();
284
305
void postCalibrateData ();
285
306
void resetAllCalibrationState ();
286
307
void computeSineCosineOfAngles (QVector<double > graphDataList);
287
308
void populateAngleErrorGraphs ();
288
309
void populateCorrectedAngleErrorGraphs ();
310
+ void clearHarmonicRegisters ();
289
311
void flashHarmonicValues ();
290
312
void calculateHarmonicValues ();
291
313
void updateCalculatedCoeffAngle ();
292
314
void updateCalculatedCoeffHex ();
293
315
void resetCalculatedCoeffAngle ();
294
316
void resetCalculatedCoeffHex ();
295
317
void displayCalculatedCoeff ();
296
- void calibrationLogWrite (QString message = " " );
297
318
void importCalibrationData ();
298
319
void extractCalibrationData ();
299
320
void toggleTabSwitching (bool value);
321
+ void toggleCalibrationButtonState (int state);
300
322
void canStartMotor (bool value);
301
323
void canCalibrate (bool );
302
- void toggleMotorControls (bool value);
324
+ void toggleCalibrationControls (bool value);
303
325
void clearCalibrationSamples ();
304
326
void clearCalibrationSineCosine ();
305
327
void clearPostCalibrationSamples ();
@@ -309,10 +331,17 @@ public Q_SLOTS:
309
331
310
332
#pragma region Motor Methods
311
333
bool moveMotorToPosition (double & position, bool validate = true );
334
+ void moveMotorContinuous ();
312
335
bool resetCurrentPositionToZero ();
313
336
void stopMotor ();
314
337
int readMotorAttributeValue (ADMTController::MotorAttribute attribute, double & value);
315
338
int writeMotorAttributeValue (ADMTController::MotorAttribute attribute, double value);
339
+ int readMotorRegisterValue (uint32_t address, uint32_t *value);
340
+ void setRampMode (bool motorRotationClockwise);
341
+ void getRampMode ();
342
+ void startResetMotorToZero ();
343
+ void stopResetMotorToZero ();
344
+ void resetMotorToZero ();
316
345
#pragma endregion
317
346
318
347
#pragma region Utility Methods
@@ -345,12 +374,7 @@ public Q_SLOTS:
345
374
void updateLineEditValue (QLineEdit* lineEdit, double value);
346
375
void toggleWidget (QPushButton *widget, bool value);
347
376
void changeCustomSwitchLabel (CustomSwitch *customSwitch, QString onLabel, QString offLabel);
348
- void changeStatusLEDColor (MenuControlButton *menuControlButton, QColor color, bool checked = true );
349
- void changeStatusLEDColor (QCheckBox *widget, const char *colorAttribute);
350
- void updateFaultStatusLEDColor (MenuControlButton *widget, bool value);
351
- void toggleStatusLEDColor (QCheckBox *widget, const char *trueAttribute, const char * falseAttribute, bool value);
352
- MenuControlButton *createStatusLEDWidget (const QString title, QColor color, QWidget *parent = nullptr );
353
- QCheckBox *createStatusLEDWidget (const QString &text, const char *colorAttribute, bool checked = false , QWidget *parent = nullptr );
377
+ QCheckBox *createStatusLEDWidget (const QString &text, QVariant variant = true , bool checked = false , QWidget *parent = nullptr );
354
378
MenuControlButton *createChannelToggleWidget (const QString title, QColor color, QWidget *parent = nullptr );
355
379
#pragma endregion
356
380
@@ -364,13 +388,16 @@ public Q_SLOTS:
364
388
void connectLineEditToRPSConversion (QLineEdit* lineEdit, double & vmax);
365
389
void connectLineEditToAMAXConversion (QLineEdit* lineEdit, double & amax);
366
390
void connectRegisterBlockToRegistry (RegisterBlockWidget* widget);
391
+ void connectLineEditToRPM (QLineEdit* lineEdit, double & variable);
367
392
#pragma endregion
368
393
369
394
#pragma region Convert Methods
370
395
double convertRPStoVMAX (double rps);
371
396
double convertVMAXtoRPS (double vmax);
372
397
double convertAccelTimetoAMAX (double accelTime);
373
398
double convertAMAXtoAccelTime (double amax);
399
+ double convertRPMtoRPS (double rpm);
400
+ double convertRPStoRPM (double rps);
374
401
#pragma endregion
375
402
376
403
#pragma region Debug Methods
0 commit comments