|
@@ -170,9 +170,9 @@ void ADC1MeasTask (void* arg) {
|
|
|
float voltage = voltageWave[i][samplesCounter % SAMPLE_BUFFER_LENGTH];
|
|
|
float current = currentWave[i][samplesCounter % SAMPLE_BUFFER_LENGTH];
|
|
|
#else
|
|
|
- float voltage = adcData.adcDataBuffer[UL1 + i] * deltaADC * U_CHANNEL_CONST * gainCorrection * U_MeasCorrectionData[i].gain + U_MeasCorrectionData[i].offset;
|
|
|
- float ref = (float)adcData.adcDataBuffer[IL1Ref + i];
|
|
|
- float adcVal = (float)adcData.adcDataBuffer[IIL1 + i];
|
|
|
+ float voltage = (adcData.adcDataBuffer[UL1 + i] & 0xFFFF) * deltaADC * U_CHANNEL_CONST * gainCorrection * U_MeasCorrectionData[i].gain + U_MeasCorrectionData[i].offset;
|
|
|
+ float ref = (float)(adcData.adcDataBuffer[IL1Ref + i] & 0xFFFF);
|
|
|
+ float adcVal = (float)(adcData.adcDataBuffer[UL1 + i] >> 16);
|
|
|
float current = (adcVal - ref) * deltaADC * I_CHANNEL_CONST * gainCorrection * I_MeasCorrectionData[i].gain + I_MeasCorrectionData[i].offset;
|
|
|
#endif
|
|
|
voltageAcc[i] += voltage * voltage;
|
|
@@ -199,7 +199,7 @@ void ADC1MeasTask (void* arg) {
|
|
|
samplesCounter = 0;
|
|
|
DbgLEDToggle(DBG_LED3);
|
|
|
}
|
|
|
- float fanFBVoltage = adcData.adcDataBuffer[FanFB] * deltaADC * -4.35 + 12;
|
|
|
+ float fanFBVoltage = (adcData.adcDataBuffer[FanFB] & 0xFFFF) * deltaADC * -4.35 + 12;
|
|
|
sensorsInfo.fanVoltage = fanFBVoltage;
|
|
|
|
|
|
osMutexRelease (resMeasurementsMutex);
|
|
@@ -364,18 +364,20 @@ void EncoderTask (void* arg) {
|
|
|
}
|
|
|
}
|
|
|
while (pdTRUE) {
|
|
|
- float encoderValue = *encoderTaskArg->pvEncoder;
|
|
|
osMessageQueueGet (encoderTaskArg->dataQueue, &pinStates, 0, osWaitForever);
|
|
|
+ float encoderValue = *encoderTaskArg->pvEncoder;
|
|
|
if (osMutexAcquire (sensorsInfoMutex, osWaitForever) == osOK) {
|
|
|
if (encoderStates[(step + 1) % 4] == pinStates) {
|
|
|
step++;
|
|
|
- encoderValue += 360.0 / ENCODER_X_IMP_PER_TURN;
|
|
|
+ encoderValue++;
|
|
|
+// encoderValue += 360.0 / ENCODER_X_IMP_PER_TURN;
|
|
|
// printf ("Forward\n");
|
|
|
} else if (encoderStates[(step - 1) % 4] == pinStates) {
|
|
|
- encoderValue -= 360.0 / ENCODER_X_IMP_PER_TURN;
|
|
|
- if (encoderValue < 0) {
|
|
|
- encoderValue = 360.0 + encoderValue;
|
|
|
- }
|
|
|
+ encoderValue--;
|
|
|
+// encoderValue -= 360.0 / ENCODER_X_IMP_PER_TURN;
|
|
|
+// if (encoderValue < 0) {
|
|
|
+// encoderValue = 360.0 + encoderValue;
|
|
|
+// }
|
|
|
// printf ("Reverse\n");
|
|
|
step--;
|
|
|
} else {
|