diff --git a/board/boards/uno.h b/board/boards/uno.h index 09a611e722924c..bd9337a3a0c1d7 100644 --- a/board/boards/uno.h +++ b/board/boards/uno.h @@ -173,14 +173,14 @@ void uno_init(void) { // Turn on phone regulator set_gpio_output(GPIOB, 4, 1); - // Initialize IR PWM and set to 50% for now + // Initialize IR PWM and set to 0% set_gpio_alternate(GPIOB, 7, GPIO_AF2_TIM4); pwm_init(TIM4, 2); - uno_set_ir_power(50U); + uno_set_ir_power(0U); - // Initialize fan and set to 20% + // Initialize fan and set to 0% fan_init(); - uno_set_fan_power(20U); + uno_set_fan_power(0U); // Initialize harness harness_init(); diff --git a/board/main.c b/board/main.c index 3b5aa63ac7d58d..3bcae876e203d0 100644 --- a/board/main.c +++ b/board/main.c @@ -293,11 +293,19 @@ int usb_cb_control_msg(USB_Setup_TypeDef *setup, uint8_t *resp, bool hardwired) break; // **** 0xb0: set IR power case 0xb0: - current_board->set_ir_power(setup->b.wValue.w); + if(power_save_status == POWER_SAVE_STATUS_DISABLED){ + current_board->set_ir_power(setup->b.wValue.w); + } else { + puts("Setting IR power not allowed in power saving mode\n"); + } break; // **** 0xb1: set fan power case 0xb1: - current_board->set_fan_power(setup->b.wValue.w); + if(power_save_status == POWER_SAVE_STATUS_DISABLED){ + current_board->set_fan_power(setup->b.wValue.w); + } else { + puts("Setting fan power not allowed in power saving mode\n"); + } break; // **** 0xb2: get fan rpm case 0xb2: diff --git a/board/power_saving.h b/board/power_saving.h index 9c0a70b4e67952..d397884f6e6a8f 100644 --- a/board/power_saving.h +++ b/board/power_saving.h @@ -46,10 +46,11 @@ void set_power_save_state(int state) { set_gpio_output(GPIOA, 14, enable); } - // Switch IR and fan - // TODO: Remove powering these back up. Should be done on device - current_board->set_ir_power(enable ? 50U : 0U); - current_board->set_fan_power(enable ? 20U : 0U); + // Switch off IR and fan when in power saving + if(!enable){ + current_board->set_ir_power(0U); + current_board->set_fan_power(0U); + } power_save_status = state; }