The code applies a "low pass filter" (not sure what this is), that calculation has:
offsetV = offsetV + ((sampleV-offsetV)/1024);
offsetI = offsetI + ((sampleI-offsetI)/1024);
I'm a bit suspicious for the 1024 value: should this be 4096 for a 12 bit resolution ADC? Many places in the code use ADC_COUNTS which translates to ADC_BITS<<1 (power of 2), for 12-bit ADC this results to 4096.
More of a question than an issue (at this point).
The code applies a "low pass filter" (not sure what this is), that calculation has: offsetV = offsetV + ((sampleV-offsetV)/1024); offsetI = offsetI + ((sampleI-offsetI)/1024);
I'm a bit suspicious for the 1024 value: should this be 4096 for a 12 bit resolution ADC? Many places in the code use ADC_COUNTS which translates to ADC_BITS<<1 (power of 2), for 12-bit ADC this results to 4096.
Like I said, more of a question out of ignorance.