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

feat: Add changes for badge compatibilities #13

Merged
merged 36 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
7394167
feat: add infected typography & encrypted text
Otrebor671 Sep 19, 2024
00711b9
refactor: y_n modal port
Otrebor671 Sep 20, 2024
df004c6
refactor: radio selction & user selection screens port
Otrebor671 Sep 20, 2024
05f6f3d
refactor: file manager list files port
Otrebor671 Sep 20, 2024
0af35f7
refactor: broadcast screen port
Otrebor671 Sep 20, 2024
62696bf
refactor: thread sniffer screens port
Otrebor671 Sep 20, 2024
61eb86e
refactor: modal display banner port
Otrebor671 Sep 20, 2024
4b95f53
refactor: sd card info screens port
Otrebor671 Sep 20, 2024
257c376
refactor: some screens of wifi settings port
Otrebor671 Sep 20, 2024
8f5de52
refactor: screen saver time config screen port
Otrebor671 Sep 20, 2024
d381f4e
refactor: zigbee sniffer screens port
Otrebor671 Sep 20, 2024
4ff0e89
refactor: no files screen port
Otrebor671 Sep 20, 2024
4ae7a2f
refactor: keyboard modal screen port
Otrebor671 Sep 20, 2024
fbf3cc9
feat: Adapt Display settings
JahazielLem Sep 21, 2024
2da6128
feat: add zigbee switch for 128x32
DeimosHall Sep 23, 2024
a8799ab
feat: optional sd card menus in menuconfig
Otrebor671 Sep 23, 2024
3a5ed2f
feat: add wifi loading bitmap for 128x32
DeimosHall Sep 23, 2024
138134b
chore: merge refactor into dev
DeimosHall Sep 23, 2024
28240de
feat: Fix WiFi screens
JahazielLem Sep 23, 2024
b5f053b
feat: directive to enable/disable the leds component
DeimosHall Sep 23, 2024
774991f
feat: directive to enable/disable the buzzer component
DeimosHall Sep 23, 2024
404d595
Merge branch 'screens_adapt' into merge_dev
JahazielLem Sep 23, 2024
496a20e
Merge branch 'merge_dev' into screens_adapt
JahazielLem Sep 23, 2024
fb6ffe0
Merge branch 'screens_adapt' into dev
JahazielLem Sep 23, 2024
3fe69c8
fix: show analyzer packets on 32px screen
Otrebor671 Sep 23, 2024
e68deea
feat: Add dragoncin
JahazielLem Sep 24, 2024
800bd6d
feat: Delete extern
JahazielLem Sep 24, 2024
b06d19a
fix: ec face logo bitmap
DeimosHall Sep 24, 2024
de21944
fix: pwnlabs logo bitmap
DeimosHall Sep 24, 2024
fcf8adf
chore: merge remote branch 'dev' into dev
DeimosHall Sep 24, 2024
195c855
feat: add menu to format sd card
DeimosHall Sep 26, 2024
a942c01
refactor: mount sd card system
DeimosHall Sep 27, 2024
04d2901
refactor: use esp_vfs_fat_sdcard_unmount instead of esp_vfs_fat_sdmmc…
DeimosHall Oct 4, 2024
fdded88
feat: move file manager to apps
DeimosHall Oct 4, 2024
cce6abd
fix: sd card info panics when there's no sd card
DeimosHall Oct 4, 2024
6796513
fix: free memory on sd card info menu
DeimosHall Oct 4, 2024
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
9 changes: 9 additions & 0 deletions firmware/components/buzzer/Kconfig.projbuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
menu "Buzzer Configuration"

config BUZZER_COMPONENT_ENABLED
bool "Enable buzzer component"
default true
help
Enable the buzzer component.

endmenu
37 changes: 37 additions & 0 deletions firmware/components/buzzer/buzzer.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,32 @@ typedef struct {
static buzzer_t buzzer;

void buzzer_enable() {
#ifndef CONFIG_BUZZER_COMPONENT_ENABLED
return;
#endif

buzzer.enabled = true;
}

void buzzer_disable() {
buzzer.enabled = false;
}

void buzzer_begin(uint8_t pin) {
#ifndef CONFIG_BUZZER_COMPONENT_ENABLED
return;
#endif

buzzer.pin = pin;
buzzer.freq = BUZZER_DEFAULT_FREQUENCY_HZ;
buzzer.duty = BUZZER_DEFAULT_DUTTY;
}

void buzzer_configure() {
#ifndef CONFIG_BUZZER_COMPONENT_ENABLED
return;
#endif

// Prepare and then apply the LEDC PWM timer configuration
ledc_timer_config_t ledc_timer = {.speed_mode = LEDC_MODE,
.duty_resolution = LEDC_DUTY_RES,
Expand All @@ -57,14 +70,26 @@ void buzzer_configure() {
}

void buzzer_set_freq(uint32_t freq) {
#ifndef CONFIG_BUZZER_COMPONENT_ENABLED
return;
#endif

buzzer.freq = freq;
}

void buzzer_set_duty(uint32_t duty) {
#ifndef CONFIG_BUZZER_COMPONENT_ENABLED
return;
#endif

buzzer.duty = duty;
}

void buzzer_play() {
#ifndef CONFIG_BUZZER_COMPONENT_ENABLED
return;
#endif

if (!buzzer.enabled) {
return;
}
Expand All @@ -75,6 +100,10 @@ void buzzer_play() {
}

void buzzer_play_for_task(void* duration) {
#ifndef CONFIG_BUZZER_COMPONENT_ENABLED
return;
#endif

uint32_t dur = *(uint32_t*) duration;
buzzer_play();
vTaskDelay(*(uint32_t*) duration / portTICK_PERIOD_MS);
Expand All @@ -83,6 +112,10 @@ void buzzer_play_for_task(void* duration) {
}

void buzzer_play_for(uint32_t duration) {
#ifndef CONFIG_BUZZER_COMPONENT_ENABLED
return;
#endif

if (!buzzer.enabled) {
return;
}
Expand All @@ -93,6 +126,10 @@ void buzzer_play_for(uint32_t duration) {
}

void buzzer_stop() {
#ifndef CONFIG_BUZZER_COMPONENT_ENABLED
return;
#endif

ESP_ERROR_CHECK(ledc_set_duty(LEDC_MODE, LEDC_CHANNEL, 0));
ESP_ERROR_CHECK(ledc_update_duty(LEDC_MODE, LEDC_CHANNEL));

Expand Down
26 changes: 23 additions & 3 deletions firmware/components/cmd_wifi/cmd_wifi.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,27 @@ static void cmd_wifi_delete_crendentials(int argc, char** argv) {
preferences_remove(wifi_ssid);
ESP_LOGI(__func__, "Deleted AP %s", wifi_ssid);

// Restore the AP indexes
int counter = 0;
for (int i = 0; i < count - 1; i++) {
char wifi_ap[100];
char wifi_ssid[100];
sprintf(wifi_ap, "wifi%d", i);
esp_err_t err = preferences_get_string(wifi_ap, wifi_ssid, 100);
if (err != ESP_OK) {
continue;
}
char wifi_pass[100];
err = preferences_get_string(wifi_ssid, wifi_pass, 100);
if (err != ESP_OK) {
continue;
}
char wifi_ap_new[100];
sprintf(wifi_ap_new, "wifi%d", counter);
preferences_put_string(wifi_ap_new, wifi_ssid);
counter++;
}

preferences_put_int("count_ap", count - 1);
}

Expand Down Expand Up @@ -164,8 +185,7 @@ static int cmd_wifi_show_aps(int argc, char** argv) {
sprintf(wifi_ap, "wifi%d", i);
esp_err_t err = preferences_get_string(wifi_ap, wifi_ssid, 100);
if (err != ESP_OK) {
ESP_LOGW(__func__, "Error getting AP");
return 1;
continue;
}
printf("[%i][%s] SSID: %s\n", i, wifi_ap, wifi_ssid);
}
Expand Down Expand Up @@ -199,8 +219,8 @@ static void event_handler(void* arg,
xEventGroupClearBits(wifi_event_group, CONNECTED_BIT);
} else if (event_base == IP_EVENT && event_id == IP_EVENT_STA_GOT_IP) {
printf("Connected to AP");
xEventGroupSetBits(wifi_event_group, CONNECTED_BIT);
preferences_put_bool("wifi_connected", true);
xEventGroupSetBits(wifi_event_group, CONNECTED_BIT);
}
}

Expand Down
9 changes: 9 additions & 0 deletions firmware/components/leds/Kconfig.projbuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
menu "LEDs Configuration"

config LEDS_COMPONENT_ENABLED
bool "Enable LEDs component"
default true
help
Enable the LEDs component.

endmenu
48 changes: 48 additions & 0 deletions firmware/components/leds/leds.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
static led_t *left_led, *right_led;

void leds_begin() {
#ifndef CONFIG_LEDS_COMPONENT_ENABLED
return;
#endif

left_led = (led_t*) malloc(sizeof(led_t));
right_led = (led_t*) malloc(sizeof(led_t));
*left_led = led_controller_led_new(LEFT_LED_IO, LEFT_LED_CHANNEL);
Expand All @@ -23,6 +27,10 @@ void leds_begin() {
}

void leds_deinit() {
#ifndef CONFIG_LEDS_COMPONENT_ENABLED
return;
#endif

if (!left_led || !right_led) {
return;
}
Expand All @@ -35,32 +43,60 @@ void leds_deinit() {
}

void leds_on() {
#ifndef CONFIG_LEDS_COMPONENT_ENABLED
return;
#endif

led_controller_led_on(left_led);
led_controller_led_on(right_led);
}

void leds_off() {
#ifndef CONFIG_LEDS_COMPONENT_ENABLED
return;
#endif

led_controller_led_off(left_led);
led_controller_led_off(right_led);
}

void leds_set_brightness(uint8_t led, uint8_t brightness) {
#ifndef CONFIG_LEDS_COMPONENT_ENABLED
return;
#endif

led_controller_set_duty(led == LED_LEFT ? left_led : right_led, brightness);
}

void led_left_on() {
#ifndef CONFIG_LEDS_COMPONENT_ENABLED
return;
#endif

led_controller_led_on(left_led);
}

void led_left_off() {
#ifndef CONFIG_LEDS_COMPONENT_ENABLED
return;
#endif

led_controller_led_off(left_led);
}

void led_right_on() {
#ifndef CONFIG_LEDS_COMPONENT_ENABLED
return;
#endif

led_controller_led_on(right_led);
}

void led_right_off() {
#ifndef CONFIG_LEDS_COMPONENT_ENABLED
return;
#endif

led_controller_led_off(right_led);
}

Expand All @@ -70,14 +106,26 @@ void led_start_blink(uint8_t led,
uint32_t time_on,
uint32_t time_off,
uint32_t time_out) {
#ifndef CONFIG_LEDS_COMPONENT_ENABLED
return;
#endif

led_controller_start_blink_effect(led == LED_LEFT ? left_led : right_led,
duty, pulse_count, time_on, time_off,
time_out);
}
void led_start_breath(uint8_t led, uint16_t period_ms) {
#ifndef CONFIG_LEDS_COMPONENT_ENABLED
return;
#endif

led_controller_start_breath_effect(led == LED_LEFT ? left_led : right_led,
period_ms);
}
void led_stop(uint8_t led) {
#ifndef CONFIG_LEDS_COMPONENT_ENABLED
return;
#endif

led_controller_stop_any_effect(led == LED_LEFT ? left_led : right_led);
}
8 changes: 8 additions & 0 deletions firmware/components/minino_config/Kconfig.projbuild
Original file line number Diff line number Diff line change
Expand Up @@ -716,4 +716,12 @@ config FILE_MANAGER_WEB
Enable or disable the Web File Manager Feature.
endif # FILE_MANAGER_ENABLE

########################### SD_CARD #############################

config SD_CARD
bool "Enable SD Card Menus"
default true
help
Enable or disable SD Card Menus.

endmenu
35 changes: 24 additions & 11 deletions firmware/components/sd_card/include/sd_card.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
#include <stdint.h>
#include "esp_err.h"

#define ESP_ERR_ALREADY_MOUNTED ESP_ERR_NOT_ALLOWED
#define ESP_ERR_NOT_MOUNTED ESP_ERR_NOT_FOUND
#define ESP_ERR_FILE_EXISTS ESP_ERR_NOT_ALLOWED
#define ESP_ERR_FILE_OPEN_FAILED ESP_FAIL
#define ESP_ERR_FILE_WRITE_FAILED ESP_FAIL
Expand All @@ -29,10 +27,9 @@ void sd_card_begin();
*
* @return esp_err_t
*
* @note return ESP_ERR_NOT_FOUND if the SD card is not found.
* @note return ESP_ERR_NO_MEM if failed to initialize the spi bus.
* @note return ESP_ERR_NOT_SUPPORTED if the SD card is not formatted with FAT.
* @note return ESP_ERR_INVALID_ARG if the arguments are invalid.
* @note return ESP_ERR_NOT_FOUND if the SD card is not found.
* @note return ESP_FAIL if the operation failed.
* @note return ESP_OK if the operation was successful or the card is already
* mounted.
Expand All @@ -44,20 +41,29 @@ esp_err_t sd_card_mount();
*
* @return esp_err_t
*
* @note return ESP_ERR_NOT_MOUNTED if the SD card is not mounted.
* @note return ESP_ERR_NOT_FOUND if the SD card is not mounted.
* @note return ESP_FAIL if the operation failed.
* @note return ESP_OK if the operation was successful.
*/
esp_err_t sd_card_unmount();

/**
* Format the SD card if mount failed.
* Mount the SD card.
*
* @return esp_err_t
*
* @note return ESP_ERR_NOT_MOUNTED if the SD card is not mounted.
* @note return ESP_ERR_NO_MEM if failed to initialize the spi bus.
* @note return ESP_ERR_NOT_SUPPORTED if the SD card is not formatted with FAT.
* @note return ESP_ERR_INVALID_ARG if the arguments are invalid.
* @note return ESP_FAIL if the operation failed.
* @note return ESP_OK if the operation was successful.
* @note return ESP_OK if the operation was successful or the card is already
* mounted.
*/
esp_err_t sd_card_check_format();

/**
* Format the SD card.
*
* @return esp_err_t
*/
esp_err_t sd_card_format();

Expand All @@ -68,14 +74,21 @@ esp_err_t sd_card_format();
*/
bool sd_card_is_mounted();

/**
* Check if the SD card is not mounted.
*
* return bool
*/
bool sd_card_is_not_mounted();

/**
* @brief Create a directory in the SD card.
*
* @param dir_name The name of the directory to create.
*
* @return esp_err_t
*
* @note return ESP_ERR_NOT_MOUNTED if the SD card is not mounted.
* @note return ESP_ERR_NOT_FOUND if the SD card is not mounted.
* @note return ESP_OK if the operation was successful or the directory already
* exists.
* @note return ESP_FAIL if the operation failed.
Expand All @@ -89,7 +102,7 @@ esp_err_t sd_card_create_dir(const char* dir_name);
*
* @return esp_err_t
*
* @note return ESP_ERR_NOT_MOUNTED if the SD card is not mounted.
* @note return ESP_ERR_NOT_FOUND if the SD card is not mounted.
* @note return ESP_ERR_FILE_EXISTS if the file already exists.
* @note return ESP_FAIL if the operation failed.
* @note return ESP_OK if the operation was successful.
Expand Down
Loading
Loading