Changeset 78
- Timestamp:
- Sep 9, 2026, 4:41:33 PM (11 days ago)
- Location:
- trunk/fw_g473rct
- Files:
-
- 2 edited
-
Core/Src/main.c (modified) (7 diffs)
-
SES/src/eeprom.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/fw_g473rct/Core/Src/main.c
r77 r78 71 71 72 72 #define MAX_OVERCURRENT_RETRYS 3 73 #ifdef DEBUG 73 74 74 #define MX_IWDG_Init DoNothing 75 #endif 75 76 76 //#define USBPD_DPM_Run DoNothing 77 77 … … 192 192 MX_CRC_Init(); 193 193 MX_RTC_Init(); 194 //MX_IWDG_Init();194 MX_IWDG_Init(); 195 195 MX_TIM3_Init(); 196 196 #ifndef NO_USB_SUPPORT … … 216 216 case FIRST_START_ERROR: EEPROM_fullRestore(&sys_data); break; 217 217 } 218 219 HAL_IWDG_Refresh(&hiwdg);220 218 221 219 // Set Slave Address via user button … … 236 234 } 237 235 }*/ 238 HAL_IWDG_Refresh(&hiwdg); 236 237 #undef MX_IWDG_Init 238 MX_IWDG_Init(); 239 239 240 LoadBackupRegister(); 240 241 … … 253 254 if (HAL_ADCEx_Calibration_Start(&hadc4, ADC_DIFFERENTIAL_ENDED) != HAL_OK) Error_Handler(); 254 255 if (HAL_ADCEx_Calibration_Start(&hadc5, ADC_SINGLE_ENDED) != HAL_OK) Error_Handler(); 255 256 256 257 257 … … 630 630 #endif 631 631 632 // Buzzer signalize that we are now in Slave Address Setting mode632 // Buzzer signalizes that we are now in Slave Address Setting mode 633 633 startTime = HAL_GetTick(); 634 634 while (HAL_GetTick() - startTime < 300U) … … 639 639 HAL_GPIO_WritePin(BUZZER_GPIO_Port, BUZZER_Pin, BUZZER_OFF); 640 640 641 // We need to wait till button release(1 0s)641 // We need to wait till button release(15s) 642 642 startTime = HAL_GetTick(); 643 643 while (BTN_PRESSED == HAL_GPIO_ReadPin(GPIO_INPUT_BTN_MODE_GPIO_Port, GPIO_INPUT_BTN_MODE_Pin)) 644 { 645 if (HAL_GetTick() - startTime >= 60U * 1000U) return 0; 644 { // if we hold a user button pressed for a 15s, when we perform Factory Reset 645 if (HAL_GetTick() - startTime >= 15U * 1000U) 646 { 647 // Buzzer signalizes that we are now in Factory Reset mode 648 startTime = HAL_GetTick(); 649 while (HAL_GetTick() - startTime < 1000U) 650 { 651 HAL_GPIO_TogglePin(BUZZER_GPIO_Port, BUZZER_Pin); 652 HAL_Delay(50U); 653 } 654 HAL_GPIO_WritePin(BUZZER_GPIO_Port, BUZZER_Pin, BUZZER_OFF); 655 EEPROM_factoryRestore(&sys_data, 1); 656 return 0; 657 } 646 658 HAL_Delay(10U); 647 659 } -
trunk/fw_g473rct/SES/src/eeprom.c
r73 r78 412 412 eepromData.changedData.shuntVoltageFastOffset = data->s.parameter.shuntVoltageFastOffset; 413 413 414 415 414 eepromData.changedData.batteryCurrentGainRefTempShunt = data->s.parameter.batteryCurrentGainRefTempShunt; 416 415 eepromData.changedData.batteryCurrentGainRefTempChip = data->s.parameter.batteryCurrentGainRefTempChip; … … 472 471 473 472 474 eepromData.eepromState.writeCounter = eepromData.eepromState.writeCounter++;473 eepromData.eepromState.writeCounter++; 475 474 eepromData.eepromState.structureSize = sizeof(eeprom_stored_data_t); 476 475 eepromData.eepromState.revisionInfo = 0; … … 480 479 eepromData.deviceInfo.SN = data->s.parameter.sn; 481 480 482 EEPROM_Write(0, 0, (uint8_t*)&eepromData, sizeof(eeprom_stored_data_t));481 EEPROM_Write(0, 0, (uint8_t*)&eepromData, sizeof(eeprom_stored_data_t)); 483 482 484 483 return EEPROM_readConfig(data);
Note:
See TracChangeset
for help on using the changeset viewer.
