mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-06-23 22:34:29 -04:00
BLE RX: Making auto channel timer independent of packet events. (#1608)
This commit is contained in:
parent
175e5e2e8c
commit
a6ed6e3099
4 changed files with 49 additions and 27 deletions
|
@ -657,16 +657,6 @@ bool BLERxView::saveFile(const std::filesystem::path& path) {
|
|||
}
|
||||
|
||||
void BLERxView::on_data(BlePacketData* packet) {
|
||||
if (auto_channel) {
|
||||
int min = 37;
|
||||
int max = 39;
|
||||
|
||||
int randomChannel = min + std::rand() % (max - min + 1);
|
||||
|
||||
field_frequency.set_value(get_freq_by_channel_number(randomChannel));
|
||||
baseband::set_btlerx(randomChannel);
|
||||
}
|
||||
|
||||
std::string str_console = "";
|
||||
|
||||
if (!logging) {
|
||||
|
@ -726,6 +716,23 @@ void BLERxView::on_filter_change(std::string value) {
|
|||
filter = value;
|
||||
}
|
||||
|
||||
// called each 1/60th of second, so 6 = 100ms
|
||||
void BLERxView::on_timer() {
|
||||
if (++timer_count == timer_period) {
|
||||
timer_count = 0;
|
||||
|
||||
if (auto_channel) {
|
||||
int min = 37;
|
||||
int max = 39;
|
||||
|
||||
int randomChannel = min + std::rand() % (max - min + 1);
|
||||
|
||||
field_frequency.set_value(get_freq_by_channel_number(randomChannel));
|
||||
baseband::set_btlerx(randomChannel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BLERxView::handle_entries_sort(uint8_t index) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue