/* Copyright 2025 by COG9 Enterprises LLC
 * All rights reserved.
 * Title: record.h
 * Author: Jed Marti KI7NNP
 * Description: Prototypes, constants for record
 * Created: Mon Oct  6 10:32:46 2025
 * Revision History:
 *   Sun Dec 14 12:40:04 2025 - add temperature to list.
 */


#ifndef record_h
#define record_h

// The data record stored in SEEPROM. There are 4 types of records.
//  Command    start ma
typedef struct {
  uint8_t  dateTime[7];
  uint16_t mampsA;
  uint16_t mampsB;
  uint16_t mampsC;
  uint16_t zeroes;
} recordAmperage;

// Command    start mav
typedef struct {
  uint8_t  dateTime[7];
  uint16_t mampsA;
  uint16_t mampsB;
  uint16_t mampsC;
  uint16_t battery;
  uint16_t voltA;
  uint16_t voltB;
  uint16_t voltC;
  uint16_t zeroes;
} recordAmperageVoltage;


// Command   start mat
typedef struct {
  uint8_t  dateTime[7];
  uint16_t mampsA;
  uint16_t mampsB;
  uint16_t mampsC;
  uint8_t  tempA;
  uint8_t  tempB;
  uint8_t  tempC;
  uint8_t  tempX;
  uint16_t zeroes;
} recordAmperageTemperature;

// Command   start all (or just start).
typedef struct {
  uint8_t  dateTime[7];          // See ds1340.ino
  uint16_t mampsA;
  uint16_t mampsB;
  uint16_t mampsC;
  uint16_t battery;              // Battery voltage * 10.
  uint16_t voltA;
  uint16_t voltB;
  uint16_t voltC;
  uint8_t  tempA;                // Temperatures, fahrenheit == 0 not there or below 0.
  uint8_t  tempB;
  uint8_t  tempC;
  uint8_t  tempX;
  uint16_t zeroes;               // Write a few extra 0's so the date looks bad and we can stop.
} recordAll;

enum {
      rAmps,
      rAmpsVolts,
      rAmpsTemps,
      rAll};


// The INA219 addresses.
enum {
      MONITORA    = 0x40,
      MONITORB    = 0x41,
      MONITORC    = 0x44
};


void initSEEPROM(void);
void initRecorder(void);
void PowerPageScreen(void);
void getLifeTime(void);
void getReadings(void);
void startRecording(void);
void stopRecording(void);

// See cterm.ino
void ctermDump(void);

// See csv.ino
void csvDump(void);
#endif
