use crate::telemetry::lib::get_adc_result;
use eps_api::EpsResult;
use rust_i2c::Command;
const TELEM_CMD: u8 = 0x10;
make_telemetry!(
VoltageFeedingBcr1 => {vec![0xE1, 0x10], |d| (0.032_253_7 * d) - 0.051_236_678},
CurrentBcr1Sa1a => {vec![0xE1, 0x14], |d| (0.978_131_613 * d) + 16.108_602_91},
CurrentBcr1Sa1b => {vec![0xE1, 0x15], |d| (0.999_566_912 * d) + 2.087_050_671},
ArrayTempSa1a => {vec![0xE1, 0x18], |d| (0.356_573_44 * d) - 273.884_02},
ArrayTempSa1b => {vec![0xE1, 0x19], |d| (0.356_573_44 * d) - 273.884_02},
SunDetectorSa1a => {vec![0xE1, 0x1C], |d| d},
SunDetectorSa1b => {vec![0xE1, 0x1D], |d| d},
VoltageFeedingBcr2 => {vec![0xE1, 0x20], |d| (0.032_096_106 * d) + 0.056_830_684},
CurrentBcr2Sa2a => {vec![0xE1, 0x24], |d| (0.976_340_483 * d) + 18.248_726_54},
CurrentBcr2Sa2b => {vec![0xE1, 0x25], |d| (0.971_278_847 * d) + 10.953_978_97},
ArrayTempSa2a => {vec![0xE1, 0x28], |d| (0.356_573_44 * d) - 273.884_02},
ArrayTempSa2b => {vec![0xE1, 0x29], |d| (0.356_573_44 * d) - 273.884_02},
SunDetectorSa2a => {vec![0xE1, 0x2C], |d| d},
SunDetectorSa2b => {vec![0xE1, 0x2D], |d| d},
VoltageFeedingBcr3 => {vec![0xE1, 0x30], |d| (0.010_021_041 * d) + 0.019_172_526},
CurrentBcr3Sa3a => {vec![0xE1, 0x34], |d| (0.979_728_933 * d) + 3.627_460_224},
CurrentBcr3Sa3b => {vec![0xE1, 0x35], |d| (0.982_520_653 * d) + 7.656_558_533},
ArrayTempSa3a => {vec![0xE1, 0x38], |d| (0.356_573_44 * d) - 273.884_02},
ArrayTempSa3b => {vec![0xE1, 0x39], |d| (0.356_573_44 * d) - 273.884_02},
SunDetectorSa3a => {vec![0xE1, 0x3C], |d| d},
SunDetectorSa3b => {vec![0xE1, 0x3D], |d| d},
BcrOutputCurrent => {vec![0xE2, 0x84], |d| (14.315_340_23 * d) + 25.431_078_9},
BcrOutputVoltage => {vec![0xE2, 0x80], |d| (0.009_049_712 * d) - 0.008_697_551},
CurrentDraw3V3 => {vec![0xE2, 0x05], |d| 0.001_327_547 * d},
CurrentDraw5V => {vec![0xE2, 0x15], |d| 0.001_327_547 * d},
OutputCurrent12V => {vec![0xE2, 0x34], |d| (2.069_546_232 * d) + 9.158_584_601},
OutputVoltage12V => {vec![0xE2, 0x30], |d| 0.013_468_447 * d},
OutputCurrentBattery => {vec![0xE2, 0x24], |d| (5.277_754_989 * d) + 7.128_757_361},
OutputVoltageBattery => {vec![0xE2, 0x20], |d| 0.000_901_295_7 * d},
OutputCurrent5v => {vec![0xE2, 0x14], |d| (5.244_380_133 * d) + 4.352_775_681},
OutputVoltage5v => {vec![0xE2, 0x10], |d| 0.005_846_589 * d},
OutputCurrent33v => {vec![0xE2, 0x04], |d| (5.255_897_808 * d) + 32.568_735_93},
OutputVoltage33v => {vec![0xE2, 0x00], |d| 0.004_288_677 * d},
OutputVoltageSwitch1 => {vec![0xE4, 0x10], |d| 0.013_458_119 * d},
OutputCurrentSwitch1 => {vec![0xE4, 0x14], |d| (1.337_509_933 * d) + 1.643_798_992},
OutputVoltageSwitch2 => {vec![0xE4, 0x20], |d| 0.013_447_282 * d},
OutputCurrentSwitch2 => {vec![0xE4, 0x24], |d| (1.337_575_789 * d) + 1.084_230_776},
OutputVoltageSwitch3 => {vec![0xE4, 0x30], |d| 0.008_997_091 * d},
OutputCurrentSwitch3 => {vec![0xE4, 0x34], |d| (6.233_851_836 * d) + 12.648_034_55},
OutputVoltageSwitch4 => {vec![0xE4, 0x40], |d| 0.008_991_18 * d},
OutputCurrentSwitch4 => {vec![0xE4, 0x44], |d| (6.211_055_525 * d) - 3.686_512_211},
OutputVoltageSwitch5 => {vec![0xE4, 0x50], |d| 0.005_854_875 * d},
OutputCurrentSwitch5 => {vec![0xE4, 0x54], |d| (1.334_023_552 * d) + 0.541_582_24},
OutputVoltageSwitch6 => {vec![0xE4, 0x60], |d| 0.005_855_28 * d},
OutputCurrentSwitch6 => {vec![0xE4, 0x64], |d| (1.339_674_94 * d) + 2.712_662_269},
OutputVoltageSwitch7 => {vec![0xE4, 0x70], |d| 0.005_852_332 * d},
OutputCurrentSwitch7 => {vec![0xE4, 0x74], |d| (1.330_454_623 * d) + 1.345_607_22},
OutputVoltageSwitch8 => {vec![0xE4, 0x80], |d| 0.004_297_822 * d},
OutputCurrentSwitch8 => {vec![0xE4, 0x84], |d| (1.339_713_413 * d) + 0.018_954_145},
OutputVoltageSwitch9 => {vec![0xE4, 0x90], |d| 0.004_297_481 * d},
OutputCurrentSwitch9 => {vec![0xE4, 0x94], |d| (1.330_468_189 * d) - 1.054_319_922},
OutputVoltageSwitch10 => {vec![0xE4, 0xA0], |d| 0.004_295_835 * d},
OutputCurrentSwitch10 => {vec![0xE4, 0xA4], |d| (1.337_542_094 * d) + 2.166_832_506},
BoardTemperature => {vec![0xE3, 0x08], |d| (0.356_573_44 * d) - 273.884_02},
);