Skip to content

Commit

Permalink
even more spammy
Browse files Browse the repository at this point in the history
  • Loading branch information
adeebshihadeh committed Jun 5, 2024
1 parent 77ecf51 commit faa1802
Showing 1 changed file with 25 additions and 16 deletions.
41 changes: 25 additions & 16 deletions board/jungle/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,6 @@ uint16_t button_press_cnt = 0U;
void tick_handler(void) {
if (TICK_TIMER->SR != 0) {
if (generated_can_traffic) {
// queue up messages
for (uint16_t i = 0U; i < 100U; i++) {
CANPacket_t to_send;
to_send.returned = 0U;
to_send.rejected = 0U;
to_send.extended = 0U;
to_send.addr = 0x200U + i;
to_send.bus = i % 3U;
to_send.data_len_code = 8U;
(void)memcpy(to_send.data, "\xff\xff\xff\xff\xff\xff\xff\xff", dlc_to_len[to_send.data_len_code]);
can_set_checksum(&to_send);

can_send(&to_send, to_send.bus, true);
}

for (int i = 0; i < 3; i++) {
if (can_health[i].transmit_error_cnt >= 128) {
(void)llcan_init(CANIF_FROM_CAN_NUM(i));
Expand Down Expand Up @@ -216,8 +201,32 @@ int main(void) {
#endif

// LED should keep on blinking all the time
uint64_t cnt = 0;
uint32_t cnt = 0;
for (cnt=0;;cnt++) {
if (generated_can_traffic) {
// fill up all the queues
can_ring *qs[] = {&can_tx1_q, &can_tx2_q, &can_tx3_q};
for (int j = 0; j < 3; j++) {
for (uint16_t n = 0U; n < can_slots_empty(qs[j]); n++) {
uint16_t i = cnt % 100U;
CANPacket_t to_send;
to_send.returned = 0U;
to_send.rejected = 0U;
to_send.extended = 0U;
to_send.addr = 0x200U + i;
to_send.bus = i % 3U;
to_send.data_len_code = i % 8U;
(void)memcpy(to_send.data, "\xff\xff\xff\xff\xff\xff\xff\xff", dlc_to_len[to_send.data_len_code]);
can_set_checksum(&to_send);

can_send(&to_send, to_send.bus, true);
}
}

delay(1000);
continue;
}

// useful for debugging, fade breaks = panda is overloaded
for (uint32_t fade = 0U; fade < MAX_LED_FADE; fade += 1U) {
current_board->set_led(LED_RED, true);
Expand Down

0 comments on commit faa1802

Please sign in to comment.