Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions examples/companion_radio/ui-keyboard/UITask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,9 @@ void UITask::renderContactList() {
int num_contacts = the_mesh.getNumContacts();

// Filter contacts by search term
int filtered_indices[64];
int filtered_indices[MAX_CONTACTS];
int filtered_count = 0;

if (_search_filter_length > 0) {
for (int i = 0; i < num_contacts; i++) {
ContactInfo contact;
Expand All @@ -351,18 +351,18 @@ void UITask::renderContactList() {
lower_filter[j] = tolower(_search_filter[j]);
lower_filter[j+1] = '\0';
}
if (strstr(lower_name, lower_filter) != nullptr) {
if (strstr(lower_name, lower_filter) != nullptr && filtered_count < MAX_CONTACTS) {
filtered_indices[filtered_count++] = i;
}
}
}
num_contacts = filtered_count;
} else {
// No filter - show all
for (int i = 0; i < num_contacts; i++) {
for (int i = 0; i < num_contacts && i < MAX_CONTACTS; i++) {
filtered_indices[i] = i;
}
filtered_count = num_contacts;
filtered_count = num_contacts < MAX_CONTACTS ? num_contacts : MAX_CONTACTS;
}

if (num_contacts == 0) {
Expand Down
1 change: 1 addition & 0 deletions variants/m5stack_cardputer/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ build_flags =
-D PIN_BOARD_SDA=2
-D PIN_BOARD_SCL=1
-D PIN_VBAT_READ=10 ; Battery voltage ADC
-D CONFIG_ARDUINO_LOOP_STACK_SIZE=16384
build_src_filter = ${esp32_base.build_src_filter}
+<../variants/m5stack_cardputer>
-<../variants/m5stack_cardputer/test_main.cpp>
Expand Down
20 changes: 3 additions & 17 deletions variants/m5stack_cardputer/target.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#include <Arduino.h>
#include "target.h"
#ifdef HAS_GPS
#include "../../examples/companion_radio/NodePrefs.h"
#endif

M5CardputerBoard board;

Expand Down Expand Up @@ -147,23 +150,6 @@ bool CardputerSensorManager::setSettingValue(const char* name, const char* value

// Sync with NodePrefs
if (_node_prefs) {
struct NodePrefs {
uint8_t airtime_factor;
char node_name[32];
float freq; uint8_t sf; uint8_t cr;
uint8_t multi_acks;
uint8_t manual_add_contacts;
float bw;
uint8_t tx_power_dbm;
uint8_t telemetry_mode_base;
uint8_t telemetry_mode_loc;
uint8_t telemetry_mode_env;
uint8_t rx_delay_base;
uint32_t ble_pin;
uint8_t advert_loc_policy;
uint8_t buzzer_quiet;
uint8_t gps_enabled;
};
NodePrefs* prefs = (NodePrefs*)_node_prefs;
prefs->gps_enabled = should_enable ? 1 : 0;
Serial.printf("[GPS] Updated NodePrefs: gps_enabled=%d\n", prefs->gps_enabled);
Expand Down