Skip to content

Commit dc3e0ac

Browse files
committed
first working awg
1 parent d5e3de2 commit dc3e0ac

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

m4/src/Peripherals/God.h

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,6 @@ class God {
908908

909909
// Track current position in voltage lists and loop
910910
int currentLoop = 0;
911-
int currentStep = 0;
912911
int totalDacSteps = numLoops * numDacStepsPerLoop;
913912
int currentDacStep = 0;
914913
int currentAdcReads = 0;
@@ -918,7 +917,6 @@ class God {
918917
DACController::setVoltageNoTransactionNoLdac(dacChannels[i], dacVoltageLists[i][0]);
919918
}
920919
currentDacStep++;
921-
currentStep = 1; // We've already set step 0
922920

923921
// Start ADC continuous conversion
924922
for (int i = 0; i < numAdcChannels; i++) {
@@ -944,22 +942,22 @@ class God {
944942
PeripheralCommsController::beginDacTransaction();
945943
#endif
946944
for (int i = 0; i < numDacChannels; i++) {
947-
float voltage = dacVoltageLists[i][currentStep];
945+
float voltage = dacVoltageLists[i][currentDacStep];
948946
DACController::setVoltageNoTransactionNoLdac(dacChannels[i], voltage);
949947
}
950948
#if !defined(__NEW_SHIELD__)
951949
PeripheralCommsController::endTransaction();
952950
#endif
953951

954-
TimingUtil::dacFlag = false;
955-
currentDacStep++;
956-
currentStep++;
957952

958953
// Check if we've completed a full sweep of voltages for this loop
959-
if (currentStep >= numDacStepsPerLoop) {
960-
currentStep = 0; // Reset to beginning of voltage list for next loop
954+
if (currentDacStep >= numDacStepsPerLoop) {
955+
currentDacStep = 0; // Reset to beginning of voltage list for next loop
961956
done = true; // Mark that we need to read ADC after settling
962957
}
958+
959+
TimingUtil::dacFlag = false;
960+
currentDacStep++;
963961
}
964962

965963
// Handle ADC flag - time to read ADC after settling

0 commit comments

Comments
 (0)