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

Add beacon task in new project structure. #40

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

devYaoYH
Copy link
Contributor

@devYaoYH devYaoYH commented Feb 25, 2025

Added beacon task to run every 30s on running_state.

Currently only sends:

  1. Current state (which would just be running)
  2. Time spent in state

Other minor fixes in this PR:

  • Defined dummy pin (29) for SAMWISE_WATCHDOG_FEED_PIN in PICO build mode
  • Moved packet.h up from command task to src/slate to remove dependency between tasks
  • Swap back to using github native runners instead of configured self-hosted solution

@devYaoYH devYaoYH linked an issue Feb 25, 2025 that may be closed by this pull request
@devYaoYH devYaoYH requested a review from shetaye February 25, 2025 05:34
@shetaye
Copy link
Contributor

shetaye commented Feb 26, 2025

Looks good. I think the following radio fields would be helpful:

uint32_t rx_bytes;
uint32_t rx_packets;
uint32_t rx_backpressure_drops;
uint32_t rx_bad_packet_drops;
uint32_t tx_bytes;
uint32_t tx_packets;

However I am concerned they will take too many bytes. Should be fine for now, can always lower precision in the future.

Also, we can clean up structures like this one

    tmp_data[pkt_len++] = slate->time_in_current_state_ms & 0x11111111;
    tmp_data[pkt_len++] = (slate->time_in_current_state_ms >> 8) & 0x11111111;
    tmp_data[pkt_len++] = (slate->time_in_current_state_ms >> 16) & 0x11111111;
    tmp_data[pkt_len++] = (slate->time_in_current_state_ms >> 24) & 0x11111111;
    tmp_data[pkt_len++] = (slate->time_in_current_state_ms >> 32) & 0x11111111;
    tmp_data[pkt_len++] = (slate->time_in_current_state_ms >> 40) & 0x11111111;
    tmp_data[pkt_len++] = (slate->time_in_current_state_ms >> 48) & 0x11111111;
    tmp_data[pkt_len++] = (slate->time_in_current_state_ms >> 56) & 0x11111111;

Using a memcpy and being careful about endianess. Since we are running on the same architecture for everything, let's just assume the wire endianess is the RP2350 endianness, so a memcpy should work fine.

(By the way, is there a reason you used 0x11111111? I would have assumed 0b11111111)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants