mirror of
https://github.com/infiniteCable2/panda.git
synced 2026-02-18 09:13:52 +08:00
Lower fan setting on boot (#2119)
* Lower fan setting on boot * fix build
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -60,9 +60,6 @@ void tick_handler(void) {
|
||||
}
|
||||
}
|
||||
|
||||
// tick drivers at 8Hz
|
||||
usb_tick();
|
||||
|
||||
// decimated to 1Hz
|
||||
if ((loop_counter % 8) == 0U) {
|
||||
#ifdef DEBUG
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user