Lower fan setting on boot (#2119)

* Lower fan setting on boot

* fix build
This commit is contained in:
Adeeb Shihadeh
2025-03-02 09:24:16 -08:00
committed by GitHub
parent d8d3ab6c3e
commit 2e654a0840
4 changed files with 3 additions and 22 deletions

View File

@@ -1,7 +1,5 @@
#include "usb_declarations.h"
bool usb_enumerated = false;
static uint8_t response[USBPACKET_MAX_SIZE];
// current packet
@@ -124,13 +122,6 @@ static char to_hex_char(uint8_t a) {
return ret;
}
void usb_tick(void) {
static uint16_t usb_last_frame_num = 0U;
uint16_t current_frame_num = (USBx_DEVICE->DSTS & USB_OTG_DSTS_FNSOF_Msk) >> USB_OTG_DSTS_FNSOF_Pos;
usb_enumerated = (current_frame_num != usb_last_frame_num);
usb_last_frame_num = current_frame_num;
}
static void usb_setup(void) {
static uint8_t device_desc[] = {
DSCR_DEVICE_LEN, USB_DESC_TYPE_DEVICE, //Length, Type

View File

@@ -23,8 +23,6 @@ typedef union _USB_Setup {
} b;
} USB_Setup_TypeDef;
extern bool usb_enumerated;
void usb_init(void);
void refresh_can_tx_slots_available(void);
@@ -109,7 +107,5 @@ void refresh_can_tx_slots_available(void);
#define ENDPOINT_RCV 0x80
#define ENDPOINT_SND 0x00
// packet read and write
void usb_tick(void);
// ***************************** USB port *****************************
void can_tx_comms_resume_usb(void);

View File

@@ -60,9 +60,6 @@ void tick_handler(void) {
}
}
// tick drivers at 8Hz
usb_tick();
// decimated to 1Hz
if ((loop_counter % 8) == 0U) {
#ifdef DEBUG

View File

@@ -155,7 +155,6 @@ static void tick_handler(void) {
// tick drivers at 8Hz
fan_tick();
usb_tick();
harness_tick();
simple_watchdog_kick();
sound_tick();
@@ -264,11 +263,9 @@ static void tick_handler(void) {
// Also disable IR when the heartbeat goes missing
current_board->set_ir_power(0U);
// Run fan when device is up, but not talking to us
// * bootloader enables the SOM GPIO on boot
// * fallback to USB enumerated where supported
bool enabled = usb_enumerated || current_board->read_som_gpio();
fan_set_power(enabled ? 50U : 0U);
// Run fan when device is up but not talking to us.
// The bootloader enables the SOM GPIO on boot.
fan_set_power(current_board->read_som_gpio() ? 30U : 0U);
}
}