debugging
This commit is contained in:
@ -21,10 +21,10 @@ static const uint8_t EEPROM_WREN = 0x06;
|
||||
static const uint32_t EEPROM_MAGIC = 0xaffe0000;
|
||||
|
||||
|
||||
static const uint8_t NUM_OF_BLOCKS;
|
||||
// static const uint8_t NUM_OF_BLOCKS;
|
||||
|
||||
typedef union {
|
||||
struct s_eepromHeader {
|
||||
struct __attribute__((__packed__)) s_eepromHeader {
|
||||
uint32_t magic;
|
||||
uint32_t writeCounter;
|
||||
uint8_t activeBlock;
|
||||
@ -36,7 +36,7 @@ static const uint16_t EEPROM_HEADER_ADDR = 0;
|
||||
static t_eepromHeader eepromHeader;
|
||||
|
||||
typedef union {
|
||||
struct s_deviceStats {
|
||||
struct __attribute__((__packed__)) s_deviceStats {
|
||||
uint32_t totalRunningHours;
|
||||
uint32_t totalPowercycles;
|
||||
uint32_t totalRequests;
|
||||
@ -48,11 +48,12 @@ typedef union {
|
||||
static const uint16_t DEVICE_STATS_ADDR = 32;
|
||||
static t_deviceStats deviceStats;
|
||||
|
||||
static const uint16_t BLOCK_ADDR[] = { 64, 4128 };
|
||||
// static const uint8_t NUM_OF_BLOCKS;
|
||||
// static const uint16_t BLOCK_ADDR[] = { 64, 4128 };
|
||||
|
||||
|
||||
typedef union {
|
||||
struct s_spiMsg {
|
||||
struct __attribute__((__packed__)) s_spiMsg {
|
||||
uint8_t cmd;
|
||||
uint16_t addr;
|
||||
uint8_t data[32];
|
||||
@ -114,20 +115,6 @@ static void eepromHourlyUpdateDeviceStats(void *handle) {
|
||||
}
|
||||
|
||||
void eepromInit() {
|
||||
|
||||
uint8_t txBuf[] = { 5, 0 };
|
||||
uint8_t rxBuf[2];
|
||||
|
||||
logMsg("1");
|
||||
__EEPROM_CS(LOW);
|
||||
// HAL_StatusTypeDef r = HAL_SPI_TransmitReceive(&hspi2, txBuf, rxBuf, 2, HAL_MAX_DELAY);
|
||||
__EEPROM_CS(HIGH);
|
||||
logMsg("2, %02x %02x %02x", 0, rxBuf[0], rxBuf[1]);
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
logMsg("eeI, read header, %d, %d", sizeof(eepromHeader), sizeof(eepromHeader.b));
|
||||
eepromRead(EEPROM_HEADER_ADDR, eepromHeader.b, sizeof(eepromHeader));
|
||||
coloredMsg(LOG_RED, "eeI, magic: %08x", eepromHeader.s.magic);
|
||||
@ -142,7 +129,7 @@ void eepromInit() {
|
||||
coloredMsg(LOG_RED, "eeI, about to write device stats for the first time");
|
||||
eepromWrite(DEVICE_STATS_ADDR, deviceStats.b, sizeof(deviceStats));
|
||||
|
||||
|
||||
/*
|
||||
uint8_t emptyBlock[32];
|
||||
memset(emptyBlock, 0, sizeof(emptyBlock));
|
||||
for (uint8_t i = 0; i < 2; i++) {
|
||||
@ -152,7 +139,7 @@ void eepromInit() {
|
||||
eepromWrite(addr, emptyBlock, sizeof(emptyBlock));
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
eepromHeader.s.magic = EEPROM_MAGIC;
|
||||
eepromHeader.s.activeBlock = 0;
|
||||
@ -177,5 +164,4 @@ void eepromInit() {
|
||||
|
||||
schAdd(eepromHourlyUpdateDeviceStats, NULL, 0, 60 * 1000);
|
||||
coloredMsg(LOG_GREEN, "eeI, hourly device stats update scheduled");
|
||||
*/
|
||||
}
|
||||
|
@ -189,8 +189,8 @@ void my_setup_2() {
|
||||
frontendInit();
|
||||
frontendSetThreshold(240);
|
||||
|
||||
// schAdd(scheduleMBusRequest, NULL, 0, 1000);
|
||||
// schAdd(triggerMBusRequest, NULL, 0, 100);
|
||||
schAdd(scheduleMBusRequest, NULL, 0, 1000);
|
||||
schAdd(triggerMBusRequest, NULL, 0, 100);
|
||||
}
|
||||
|
||||
void my_loop() {
|
||||
|
Reference in New Issue
Block a user