Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lower fan setting on boot #2119

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions board/drivers/usb.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include "usb_declarations.h"

bool usb_enumerated = false;

static uint8_t response[USBPACKET_MAX_SIZE];

// current packet
Expand Down Expand Up @@ -127,7 +125,6 @@ static char to_hex_char(uint8_t a) {
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;
}

Expand Down
2 changes: 0 additions & 2 deletions board/drivers/usb_declarations.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
8 changes: 3 additions & 5 deletions board/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,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);
}
}

Expand Down
Loading