debugging

This commit is contained in:
Wolfgang Hottgenroth 2020-11-05 18:10:39 +01:00
parent 6b4cb2037e
commit 238d4ae4b0
Signed by: wn
GPG Key ID: 6C1E5E531E0D5D7F

View File

@ -114,6 +114,20 @@ static void eepromHourlyUpdateDeviceStats(void *handle) {
}
void eepromInit() {
uint8_t txBuf[] = { 5, 0 }
uint8_t rxBuf[2];
logMsg("1");
__EEPROM_CS(LOW);
HAL_SPI_TransmitReceive(&eepromSpi, txBuf, rxBuf, 2, HAL_MAX_DELAY);
__EEPROM_CS(HIGH);
logMsg("2, %02x %02x", 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);
@ -128,7 +142,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++) {
@ -138,7 +152,7 @@ void eepromInit() {
eepromWrite(addr, emptyBlock, sizeof(emptyBlock));
}
}
*/
eepromHeader.s.magic = EEPROM_MAGIC;
eepromHeader.s.activeBlock = 0;
@ -163,4 +177,5 @@ void eepromInit() {
schAdd(eepromHourlyUpdateDeviceStats, NULL, 0, 60 * 1000);
coloredMsg(LOG_GREEN, "eeI, hourly device stats update scheduled");
*/
}