/*
 * test.h
 *
 *  Created on: Apr 23, 2021
 *      Author: Thom Maughan, tm@mbari.org
 */


#ifndef PHFETSOS_TEST_H_
#define PHFETSOS_TEST_H_



void test_menu(void);

void display_battery_boardSensors(void);
//2 -- ISFET, References and Thermistor volts
void display_ph_ref_therm_volts(void);
//3 -- Calc pH using Int Ref and Thermistor
void display_calcd_pH_intRef_therm(void);
//4 -- Calc pH using Ext Ref, Thermistor and Salinity
void display_calcd_pH_extRef_therm_sal(float Salinity);
//5 -- Communicate with Instrument
void communicate_with_instruments(void);
//6 -- Power Output Tests for AUXx and Pump
int power_output_tests(void);
//8 -- Test 24bit ADC and MUX channels
void test_24bit_adc_mux(void);
//D -- Data Header print
//extern void print_data_header(void);
//M -- Meta Data print
//extern void print_metadata_header(const time_t currentTime);
//Q -- QA and setup after board manufacture
int board_qa_and_init(int initFlg);


void display_ph_ref_therm_volts(void);

int test_sampling_mcap(int qaFlg);

void print_qa_report(void);


//                      Vrse_B    Vrsi_B       Vrse        Vrsi        Ik           Vk          Ib         Vsrc (Vb)    Vtherm
//  Min               -69.206E-3  674.859E-3  -799.255E-3 -55.220E-3  272.924E-3  -500.566E-3 -399.632E-3 518.000E-6  994.313E-3
//  Average           -63.100E-3  676.335E-3  -794.182E-3 -54.759E-3  297.348E-3  -500.276E-3 -397.081E-3 588.731E-6  996.386E-3
//  Max               -58.295E-3  677.115E-3  -789.627E-3 -54.212E-3  318.038E-3  -499.881E-3 -394.773E-3 684.000E-6  998.184E-3
//  Std Deviation     4.353E-3    994.544E-6  3.776E-3    384.434E-6  17.849E-3   263.776E-6  1.904E-3    62.743E-6   1.786E-3

// average             0.063000    0.676000   -0.794000   -0.055000    0.297000   -0.500000   -0.397000    0.000589    0.996000
//std dev mcap         0.004353    0.000995    0.003776    0.000384    0.017849    0.000264    0.002000    0.000063    0.001786
//std dev jensenian    0.000040    0.000019    0.000021    0.000016    0.000462    0.000128    0.000013    0.000003    0.000096


// from noise analysis spreadsheet 19Apr2021 (5 Jensenians, 3 MCAPS), min and max determined by informed guess, need a bigger sample of mcaps
//         VrseB  VrsiB    Vrse    Vrsi    Ik       Vk      Ib     Vb  Vtherm
//    max -0.057  0.679   -0.786  -0.0535 0.335   -0.498  -0.393  0.0007  1
//    min -0.0705 0.673   -0.801  -0.0565 0.258   -0.501  -0.401  0.0005  0.992

#define VRSI_MIN        -0.0565
#define VRSI_MAX        -0.0535
#define VRSI_B_MIN      0.673
#define VRSI_B_MAX      0.679
#define VRSE_MIN        -0.801
#define VRSE_MAX        -0.786
#define VRSE_B_MIN      -0.0705
#define VRSE_B_MAX      -0.057
#define IK_MIN          0.258
#define IK_MAX          0.335
#define VK_MIN          -0.501
#define VK_MAX          -0.498
#define IB_MIN          -0.401
#define IB_MAX          -0.393
#define VB_MIN          0.0001  //0.0005
#define VB_MAX          0.002  // 0.00075 //0.0007
#define VTHERM_MIN      0.992
#define VTHERM_MAX      1.00




#endif

