Skip to content

File PduCalStore.h

FileList > Firmware > Libraries > PowerMonitor > PduCalStore.h

Go to the source code of this file

PDU per-board calibration in a reserved flash page — append-only log, newest valid wins (#216). More...

  • #include <stdint.h>
  • #include "PduConfig.h"
  • #include "PduMath.h"

Namespaces

Type Name
namespace OpenSkyhawk
Thin wrapper over Adafruit_ADS1115; see ADS1115.h .
namespace Pdu

Classes

Type Name
class CalStore
The reserved flash page holding the calibration log.

Detailed Description

The F103 has no EEPROM, so calibration lives in the last 1 KB flash page (PDU_CAL_PAGE_ADDR), outside the firmware image: the PDU builds set board_upload.maximum_size = 64512 so the build fails before code can grow into it, and an OpenOCD upload erases only the sectors it writes, so a reflash keeps the calibration.

The page holds up to 32 fixed 32-byte records. save() writes the next empty slot; load() returns the last slot whose magic and CRC check out. The page is erased only when it is full, so a power cut can lose at most the record being written — never the previous good one — except during the rare full-page erase.

Copyright:

GPL-2.0-only — see Firmware/LICENSE


The documentation for this class was generated from the following file Firmware/Libraries/PowerMonitor/PduCalStore.h