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

#ifndef PHFETSOS_CONFIG_H_
#define PHFETSOS_CONFIG_H_

#include "stdint.h"
#include "time.h"

// data_cfg[TIMESTAMP] config types new 9 Apr 2022
#define TYPE_TIMESTAMP_OFF  0
#define TYPE_US_DATETIME    1
#define TYPE_EPOCH_MSEC     2

void configuration_menu(void);
void print_config_data_fields(void);
void config_data_fields(void);
void config_data_fields_none(int prnFlg);
void config_data_fields_all(int prnFlg);
void config_data_fields_glider(int prnFlg);
void config_data_fields_mfet(int prnFlg);
void config_data_fields_mphox(int prnFlg);
void config_data_fields_m2m_mphox(int prnFlg);
void config_data_fields_nanofet(int prnFlg);
void config_data_fields_wirewalker(int prnFlg);

void config_two_pump_beams_v1(void);

void apf_mosos_config(void);

void print_write_config_data_fields(uint32_t printFlg, uint32_t writeFlg, uint32_t padFlg);
void pump_sequencer_setup(void);

int print_write_metadata_header(const time_t currentTime, uint32_t printFlg, uint32_t writeFlg);
int write_metadata_header(const time_t currentTime);
void print_metadata_header(const time_t currentTime);

void print_sys_samp_data_structure(void);  // for debug
void print_sys_data_structure(void);  // for qa and debug

int print_write_data_header(uint32_t printFlg, uint32_t writeFlg);
void print_data_header(void);
int  write_data_header(void);
void print_config(void);    //m2m

void get_header(void);
int enter_deployment_note(uint32_t timeout);
void enter_metadata(void);
void enter_pH_sensor_cal_coeff(void);
void get_pH_sensor_cal_coeff(void);
void import_pH_sensor_cal_coeff(void);
void export_pH_sensor_cal_coeff();
void change_baud_rate(void);

void print_all_metadata(void);  // print out all metadata

void edit_appcfg_fields(void);
void exercise_iso(void);

void copy_edit_sys_data_structure(void);

void config_adc24_sampling_parms(void);

void user_select_ctd(void);
void user_select_timestamp(void);



uint8_t edit_uc(uint8_t *uint_data, uint8_t negLim, uint8_t posLim);
uint32_t edit_uint(uint32_t *uint_data, uint32_t negLim, uint32_t posLim);
float edit_float(float *float_data, float negLim, float posLim);
float edit_expfloat(float *float_data, float negLim, float posLim);
uint32_t edit_string(char *char_data, uint32_t max_chars);

void parse_cal_packet(char *bufPtr);
void set_cal_filename(char *filename_ptr);
void send_last_sample(void);

#endif /* CONFIG_H_ */
