This formula cannot work correctly with a gain of 128, because it will overflow when multiplying. The constant should be declared unsigned (16777216u). Then everything will be ok.
#define AD7794_ADC_MAX_UP 16777216
result = (adcRaw * Channel[currentCh].vRef) / (AD7794_ADC_MAX_UP * Channel[currentCh].gain); //Unipolar formula
https://github.com/NHBSystems/NHB_AD7794/blob/af71f8e0f3ee304d96244e48dc4ab5652c7b3cfa/src/NHB_AD7794.cpp#L319 https://github.com/NHBSystems/NHB_AD7794/blob/af71f8e0f3ee304d96244e48dc4ab5652c7b3cfa/src/NHB_AD7794.h#L48C2-L48C9
This formula cannot work correctly with a gain of 128, because it will overflow when multiplying. The constant should be declared unsigned (16777216u). Then everything will be ok.