-
Notifications
You must be signed in to change notification settings - Fork 1
Periodically Transmit Callsigns on Licensed Frequencies #372
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e67c78b
callsign broadcast tenant class
AarC10 0c0c76a
Move starting timer to registerfn
AarC10 01f876b
Lora check if in licensed frequency range and register callsign broad…
AarC10 18233b4
docs
AarC10 e8bc073
lora broadcast port field and use string
AarC10 ff6a354
trunc and fix initializer list
AarC10 ad5d971
Lets just yeet callsigns
AarC10 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
include/f_core/radio/application/c_callsign_broadcast_tenant.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| #pragma once | ||
|
|
||
| #include <string> | ||
|
|
||
| #include "f_core/os/c_callback_tenant.h" | ||
| #include "f_core/radio/c_lora_link.h" | ||
| #include "f_core/utils/c_soft_timer.h" | ||
|
|
||
| class CCallsignBroadcastTenant : public CCallbackTenant { | ||
| public: | ||
| /** | ||
| * | ||
| * @param callsign Callsign to broadcast | ||
| * @param transmitFrequency How often to broadcast the callsign | ||
| * @param txPort Message port to send the callsign frame to for transmission over LoRa | ||
| * @param loraBroadcastPort LoRa port to broadcast the callsign on | ||
| */ | ||
| CCallsignBroadcastTenant(const char* callsign, k_timeout_t transmitFrequency, CMessagePort<LaunchLoraFrame>& txPort, const uint8_t loraBroadcastPort); | ||
|
|
||
| /** | ||
| * See parent docs | ||
| */ | ||
|
AarC10 marked this conversation as resolved.
|
||
| void Register() override; | ||
|
|
||
|
|
||
| /** | ||
| * See parent docs | ||
| */ | ||
| void Callback() override; | ||
|
|
||
| private: | ||
| CMessagePort<LaunchLoraFrame>& txPort; | ||
| CSoftTimer broadcastTimer; | ||
| const k_timeout_t transmitFrequency; | ||
| const std::string callsign; | ||
| const uint8_t loraBroadcastPort; | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
lib/f_core/radio/application/c_callsign_broadcast_tenant.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| #include "f_core/radio/application/c_callsign_broadcast_tenant.h" | ||
|
|
||
| #include <zephyr/logging/log.h> | ||
|
|
||
| LOG_MODULE_REGISTER(CCallsignBroadcastTenant); | ||
|
|
||
| static void broadcastTimerCallbackFunction(k_timer *timer) { | ||
| auto *tenant = static_cast<CCallsignBroadcastTenant*>(k_timer_user_data_get(timer)); | ||
| if (tenant) { | ||
| tenant->Callback(); | ||
| } | ||
| } | ||
|
|
||
| CCallsignBroadcastTenant::CCallsignBroadcastTenant(const char* callsign, k_timeout_t transmitFrequency, CMessagePort<LaunchLoraFrame>& txPort, const uint8_t loraBroadcastPort) | ||
| : CCallbackTenant("CCallsignBroadcastTenant"), txPort(txPort), | ||
| broadcastTimer(broadcastTimerCallbackFunction), transmitFrequency(transmitFrequency), callsign(callsign), loraBroadcastPort(loraBroadcastPort) { | ||
| } | ||
|
|
||
| void CCallsignBroadcastTenant::Register() { | ||
| broadcastTimer.SetUserData(this); | ||
| broadcastTimer.StartTimer(transmitFrequency); | ||
| } | ||
|
|
||
| void CCallsignBroadcastTenant::Callback() { | ||
| LaunchLoraFrame frame = {}; | ||
| frame.Port = loraBroadcastPort; | ||
| frame.Size = static_cast<uint8_t>(callsign.size()); | ||
| if (frame.Size > sizeof(frame.Payload)) { | ||
| LOG_ERR("Callsign size %zu exceeds maximum payload size %zu", callsign.size(), sizeof(frame.Payload)); | ||
| return; | ||
| } | ||
|
|
||
| memcpy(frame.Payload, callsign.data(), frame.Size); | ||
| txPort.Send(frame, K_NO_WAIT); | ||
| }; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.