mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-08-13 06:17:42 +00:00
Ble tx improvements (#1546)
This commit is contained in:
@@ -187,14 +187,14 @@ void BLETxView::start() {
|
||||
// Send first or single packet.
|
||||
progressbar.set_max(packet_count);
|
||||
button_play.set_bitmap(&bitmap_stop);
|
||||
baseband::set_btletx(channel_number, macAddress, advertisementData);
|
||||
baseband::set_btletx(channel_number, macAddress, advertisementData, pduType);
|
||||
transmitter_model.enable();
|
||||
|
||||
is_running = true;
|
||||
}
|
||||
} else {
|
||||
// Send next packet.
|
||||
baseband::set_btletx(channel_number, macAddress, advertisementData);
|
||||
baseband::set_btletx(channel_number, macAddress, advertisementData, pduType);
|
||||
}
|
||||
|
||||
if ((packet_counter % 10) == 0) {
|
||||
@@ -246,6 +246,7 @@ BLETxView::BLETxView(NavigationView& nav)
|
||||
&label_speed,
|
||||
&options_speed,
|
||||
&options_channel,
|
||||
&options_adv_type,
|
||||
&label_packets_sent,
|
||||
&text_packets_sent,
|
||||
&label_mac_address,
|
||||
@@ -268,6 +269,10 @@ BLETxView::BLETxView(NavigationView& nav)
|
||||
timer_period = i;
|
||||
};
|
||||
|
||||
options_adv_type.on_change = [this](size_t, int32_t i) {
|
||||
pduType = (PKT_TYPE)i;
|
||||
};
|
||||
|
||||
options_speed.set_selected_index(0);
|
||||
|
||||
button_open.on_select = [this, &nav](Button&) {
|
||||
|
@@ -104,11 +104,43 @@ class BLETxView : public View {
|
||||
uint32_t packet_count{0};
|
||||
uint32_t packet_counter{0};
|
||||
|
||||
enum PKT_TYPE {
|
||||
INVALID_TYPE,
|
||||
RAW,
|
||||
DISCOVERY,
|
||||
IBEACON,
|
||||
ADV_IND,
|
||||
ADV_DIRECT_IND,
|
||||
ADV_NONCONN_IND,
|
||||
ADV_SCAN_IND,
|
||||
SCAN_REQ,
|
||||
SCAN_RSP,
|
||||
CONNECT_REQ,
|
||||
LL_DATA,
|
||||
LL_CONNECTION_UPDATE_REQ,
|
||||
LL_CHANNEL_MAP_REQ,
|
||||
LL_TERMINATE_IND,
|
||||
LL_ENC_REQ,
|
||||
LL_ENC_RSP,
|
||||
LL_START_ENC_REQ,
|
||||
LL_START_ENC_RSP,
|
||||
LL_UNKNOWN_RSP,
|
||||
LL_FEATURE_REQ,
|
||||
LL_FEATURE_RSP,
|
||||
LL_PAUSE_ENC_REQ,
|
||||
LL_PAUSE_ENC_RSP,
|
||||
LL_VERSION_IND,
|
||||
LL_REJECT_IND,
|
||||
NUM_PKT_TYPE
|
||||
};
|
||||
|
||||
static constexpr uint8_t mac_address_size_str{12};
|
||||
static constexpr uint8_t max_packet_size_str{62};
|
||||
static constexpr uint8_t max_packet_count_str{10};
|
||||
static constexpr uint32_t max_packet_count{UINT32_MAX};
|
||||
|
||||
PKT_TYPE pduType = {RAW};
|
||||
|
||||
static constexpr auto header_height = 8 * 16;
|
||||
|
||||
Button button_open{
|
||||
@@ -161,6 +193,17 @@ class BLETxView : public View {
|
||||
{"Ch.38", 38},
|
||||
{"Ch.39", 39}}};
|
||||
|
||||
OptionsField options_adv_type{
|
||||
{17 * 8, 6 * 8},
|
||||
14,
|
||||
{{"DISCOVERY ", DISCOVERY},
|
||||
{"ADV_IND", ADV_IND},
|
||||
{"ADV_DIRECT", ADV_DIRECT_IND},
|
||||
{"ADV_NONCONN", ADV_NONCONN_IND},
|
||||
{"SCAN_REQ", SCAN_REQ},
|
||||
{"SCAN_RSP", SCAN_RSP},
|
||||
{"CONNECT_REQ", CONNECT_REQ}}};
|
||||
|
||||
Labels label_packets_sent{
|
||||
{{0 * 8, 10 * 8}, "Packets Left:", Color::light_grey()}};
|
||||
|
||||
|
@@ -155,11 +155,12 @@ void set_btle(uint8_t channel_number) {
|
||||
send_message(&message);
|
||||
}
|
||||
|
||||
void set_btletx(uint8_t channel_number, char* macAddress, char* advertisementData) {
|
||||
void set_btletx(uint8_t channel_number, char* macAddress, char* advertisementData, uint8_t pduType) {
|
||||
const BTLETxConfigureMessage message{
|
||||
channel_number,
|
||||
macAddress,
|
||||
advertisementData};
|
||||
advertisementData,
|
||||
pduType};
|
||||
send_message(&message);
|
||||
}
|
||||
|
||||
|
@@ -73,7 +73,7 @@ void set_fsk(const size_t deviation);
|
||||
void set_aprs(const uint32_t baudrate);
|
||||
|
||||
void set_btle(uint8_t channel_number);
|
||||
void set_btletx(uint8_t channel_number, char* macAddress, char* advertisementData);
|
||||
void set_btletx(uint8_t channel_number, char* macAddress, char* advertisementData, uint8_t pduType);
|
||||
|
||||
void set_nrf(const uint32_t baudrate, const uint32_t word_length, const uint32_t trigger_value, const bool trigger_word);
|
||||
|
||||
|
Reference in New Issue
Block a user