Skip to content

Commit

Permalink
403+support
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Wilson committed Sep 23, 2024
1 parent 9cf93a6 commit d8fa782
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
24 changes: 12 additions & 12 deletions main/self_test/self_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,18 +178,18 @@ void self_test(void * pvParameters)
case DEVICE_MAX:
case DEVICE_ULTRA:
case DEVICE_SUPRA:
if (GLOBAL_STATE->board_version != 402){
if(!DS4432U_test()) {
ESP_LOGE(TAG, "DS4432 test failed!");
display_msg("DS4432U:FAIL", GLOBAL_STATE);
return;
}
} else {
if (GLOBAL_STATE->board_version >= 402 && GLOBAL_STATE->board_version <= 499){
if (result != 0) {
ESP_LOGE(TAG, "TPS546 test failed!");
display_msg("TPS546:FAIL", GLOBAL_STATE);
return;
}
} else {
if(!DS4432U_test()) {
ESP_LOGE(TAG, "DS4432 test failed!");
display_msg("DS4432U:FAIL", GLOBAL_STATE);
return;
}
}
break;
case DEVICE_GAMMA:
Expand Down Expand Up @@ -291,15 +291,15 @@ void self_test(void * pvParameters)
case DEVICE_MAX:
case DEVICE_ULTRA:
case DEVICE_SUPRA:
if(GLOBAL_STATE->board_version != 402){
if (!INA260_power_consumption_pass(POWER_CONSUMPTION_TARGET_SUB_402, POWER_CONSUMPTION_MARGIN)) {
ESP_LOGE(TAG, "INA260 Power Draw Failed, target %.2f", (float)POWER_CONSUMPTION_TARGET_SUB_402);
if(GLOBAL_STATE->board_version >= 402 && GLOBAL_STATE->board_version <= 499){
if (!TPS546_power_consumption_pass(POWER_CONSUMPTION_TARGET_402, POWER_CONSUMPTION_MARGIN)) {
ESP_LOGE(TAG, "TPS546 Power Draw Failed, target %.2f", (float)POWER_CONSUMPTION_TARGET_402);
display_msg("POWER: FAIL", GLOBAL_STATE);
return;
}
} else {
if (!TPS546_power_consumption_pass(POWER_CONSUMPTION_TARGET_402, POWER_CONSUMPTION_MARGIN)) {
ESP_LOGE(TAG, "TPS546 Power Draw Failed, target %.2f", (float)POWER_CONSUMPTION_TARGET_402);
if (!INA260_power_consumption_pass(POWER_CONSUMPTION_TARGET_SUB_402, POWER_CONSUMPTION_MARGIN)) {
ESP_LOGE(TAG, "INA260 Power Draw Failed, target %.2f", (float)POWER_CONSUMPTION_TARGET_SUB_402);
display_msg("POWER: FAIL", GLOBAL_STATE);
return;
}
Expand Down
8 changes: 4 additions & 4 deletions main/tasks/power_management_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ void POWER_MANAGEMENT_task(void * pvParameters)
case DEVICE_MAX:
case DEVICE_ULTRA:
case DEVICE_SUPRA:
if (GLOBAL_STATE->board_version != 402) {
if (GLOBAL_STATE->board_version < 402 || GLOBAL_STATE->board_version > 499) {
// Configure GPIO12 as input(barrel jack) 1 is plugged in
gpio_config_t barrel_jack_conf = {
.pin_bit_mask = (1ULL << GPIO_NUM_12),
Expand Down Expand Up @@ -128,7 +128,7 @@ void POWER_MANAGEMENT_task(void * pvParameters)
case DEVICE_MAX:
case DEVICE_ULTRA:
case DEVICE_SUPRA:
if (GLOBAL_STATE->board_version == 402) {
if (GLOBAL_STATE->board_version >= 402 && GLOBAL_STATE->board_version <= 499) {
power_management->voltage = TPS546_get_vin() * 1000;
power_management->current = TPS546_get_iout() * 1000;
// calculate regulator power (in milliwatts)
Expand Down Expand Up @@ -177,7 +177,7 @@ void POWER_MANAGEMENT_task(void * pvParameters)
case DEVICE_ULTRA:
case DEVICE_SUPRA:

if (GLOBAL_STATE->board_version == 402) {
if (GLOBAL_STATE->board_version >= 402 && GLOBAL_STATE->board_version <= 499) {
power_management->chip_temp_avg = GLOBAL_STATE->ASIC_initalized ? EMC2101_get_external_temp() : -1;
power_management->vr_temp = (float)TPS546_get_temperature();
} else {
Expand All @@ -196,7 +196,7 @@ void POWER_MANAGEMENT_task(void * pvParameters)
ESP_LOGE(TAG, "OVERHEAT! VR: %fC ASIC %fC", power_management->vr_temp, power_management->chip_temp_avg );

EMC2101_set_fan_speed(1);
if (GLOBAL_STATE->board_version == 402) {
if (GLOBAL_STATE->board_version >= 402 && GLOBAL_STATE->board_version <= 499) {
// Turn off core voltage
VCORE_set_voltage(0.0, GLOBAL_STATE);
} else if (power_management->HAS_POWER_EN) {
Expand Down
4 changes: 2 additions & 2 deletions main/vcore.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ uint8_t VCORE_init(GlobalState * global_state) {
case DEVICE_MAX:
case DEVICE_ULTRA:
case DEVICE_SUPRA:
if (global_state->board_version == 402) {
if (global_state->board_version >= 402 && global_state->board_version <= 499) {
result = TPS546_init();
}
break;
Expand Down Expand Up @@ -75,7 +75,7 @@ bool VCORE_set_voltage(float core_voltage, GlobalState * global_state)
case DEVICE_MAX:
case DEVICE_ULTRA:
case DEVICE_SUPRA:
if (global_state->board_version == 402) {
if (global_state->board_version >= 402 && global_state->board_version <= 499) {
ESP_LOGI(TAG, "Set ASIC voltage = %.3fV", core_voltage);
TPS546_set_vout(core_voltage * (float)global_state->voltage_domain);
} else {
Expand Down

0 comments on commit d8fa782

Please sign in to comment.