This commit is contained in:
2026-03-20 21:16:58 +08:00
parent 286ff98b8e
commit 90c3d919df
248 changed files with 94554 additions and 0 deletions

39
user/Compute/VHHCompute.c Executable file
View File

@@ -0,0 +1,39 @@
#include "../main/SystemInclude.h"
// for compute buffer
float RRExtGain;
u16 RRExtGainRes;
/******************************************************************************/
void RHCircuitParameterInit(void)
{
// A type external gain res
RRExtGainRes = (u16)ReadParameterFromEEPROM(RR_GAINRES, RR_GAINRES_WIDTH, RR_GAINRES_DEFAULT);
RRExtGain = (float)RR_OPGAIN_RES;
RRExtGain /= (float)RRExtGainRes;
RRExtGain += 1.0;
RRExtGain = 1.0/RRExtGain;
}
/******************************************************************************/
void ComputeRRParameter(void)
{
float tmpRR;
//===========================================================================
// compute VRR ADC INPUT
tmpSLA = (u32)voltageDetected[RRIDX];
tmpSLA -= (u32)32768;
tmpRR = (float)VRR_VREF;
tmpRR *= (float)tmpSLA;
tmpRR += (float)VRR_VDC;
voltageDetected[NVRR] = (u16)tmpRR;
//===========================================================================
// compute RR
tmpRR *= (float)RRExtGain;
tmpRR = (VRR_RREF*tmpRR)/(VREF-tmpRR);
voltageDetected[NRR] = (u16)tmpRR;
voltageDetected[NRR] = MovingAverage(voltageDetected[NRR], 30, NRR);
}