Skip to content

Commit

Permalink
v0.2.7.16
Browse files Browse the repository at this point in the history
  • Loading branch information
Retr0Kr0dy authored Jan 8, 2025
2 parents 3148d46 + 421b1ef commit 58ca87e
Show file tree
Hide file tree
Showing 12 changed files with 93 additions and 23 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ on:

jobs:
build-and-release:
strategy:
fail-fast: false
matrix:
idf_target:
- esp32
- esp32s3

runs-on: ubuntu-latest

steps:
Expand All @@ -20,7 +27,7 @@ jobs:
with:
command: /app/${{ github.repository }}/patch-esp-idf.sh && /app/${{ github.repository }}/Firmware/BeamStalker/build.sh
esp_idf_version: v4.4
target: esp32s3 # Currently we only build for M5Cardputer (so esp32s3)
target: ${{ matrix.idf_target }}
path: 'Firmware/BeamStalker'

- name: Set name and tag_name
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/build-firmware.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,14 @@ on:

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
idf_target:
- esp32
- esp32s3

runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -20,5 +26,5 @@ jobs:
with:
command: /app/${{ github.repository }}/patch-esp-idf.sh && /app/${{ github.repository }}/Firmware/BeamStalker/build.sh
esp_idf_version: v4.4
target: esp32s3 # Currently we only build for M5Cardputer (so esp32s3)
target: ${{ matrix.idf_target }}
path: 'Firmware/BeamStalker'
4 changes: 2 additions & 2 deletions Firmware/BeamStalker/boards/sdkconfig.M5Cardputer
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ CONFIG_IDF_TARGET="esp32s3"
CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y
CONFIG_ESPTOOLPY_FLASHSIZE="8MB"
CONFIG_PARTITION_TABLE_CUSTOM=y
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-8MB.csv"
CONFIG_PARTITION_TABLE_FILENAME="partitions-8MB.csv"
CONFIG_BT_ENABLED=y
CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y

Expand Down
9 changes: 9 additions & 0 deletions Firmware/BeamStalker/boards/sdkconfig.esp32-vanilla
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CONFIG_IDF_TARGET="esp32"
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
CONFIG_ESPTOOLPY_FLASHSIZE="4MB"
CONFIG_PARTITION_TABLE_CUSTOM=y
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-4MB.csv"
CONFIG_PARTITION_TABLE_FILENAME="partitions-4MB.csv"
CONFIG_BT_ENABLED=y
CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y

14 changes: 13 additions & 1 deletion Firmware/BeamStalker/build.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
#!/bin/bash

set -e
set -x
set -e

for board in $(ls ./boards);
do
config_file=$board
board_name=${board##*.}
version=$(grep VERSION main/firmware/helper.h | awk -F'"' '{print $2}')
mcu=$(grep "CONFIG_IDF_TARGET" boards/$board | awk -F'"' '{print $2}')

if [ -z "$IDF_TARGET" ]; then
echo "IDF_TARGET is not set. Compiling anyway..."
elif [ "$IDF_TARGET" != "$mcu" ]; then
echo "IDF_TARGET ($IDF_TARGET) does not match MCU ($mcu). Next candidate"
continue
fi

idf.py set-target $mcu

cp ./boards/$config_file sdkconfig
cp ./boards/$config_file sdkconfig.defaults

idf.py build
mv ./build/BeamStalker.bin ./bin/BeamStalker-$version-$board_name.bin
idf.py fullclean
Expand Down
9 changes: 1 addition & 8 deletions Firmware/BeamStalker/main/BeamStalker-cardputer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,11 @@ extern "C" {
#include <string.h>
#include <stdlib.h>
}
#include "esp_wifi.h"
#include "esp_event.h"
#include "esp_task_wdt.h"
#include "nvs_flash.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/timers.h"
#include "time.h"

#include "firmware/helper.h"
#include "firmware/bitmaps.h"
#include "firmware/menu.h"
#include "firmware/interface.h"

#include "firmware/apps/options.h"
#include "firmware/apps/Wifi/wifi_main.h"
Expand Down
2 changes: 1 addition & 1 deletion Firmware/BeamStalker/main/firmware/helper.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef HELPER_H
#define HELPER_H

#define VERSION "v0.2.7.15"
#define VERSION "v0.2.7.16"
#define ROW_SIZE 7
#define COLUMN_SIZE 7
#define SCREEN_WIDTH 128
Expand Down
20 changes: 15 additions & 5 deletions Firmware/BeamStalker/main/firmware/interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,12 @@ int handleDefaultButton() { // Need to be enhanced a lot
bool upPressed() {
#ifdef CONFIG_M5_BOARD
return M5Cardputer.Keyboard.isKeyPressed(';');
#else
return false;
#endif
}
bool downPressed() {
bool default_btn, custom_btn, serial_btn = false;
bool default_btn = false, custom_btn = false, serial_btn = false;

default_btn = DEFAULT_BTN_DOUBLE_PRESS;

Expand All @@ -78,10 +80,12 @@ bool downPressed() {
bool leftPressed() {
#ifdef CONFIG_M5_BOARD
return M5Cardputer.Keyboard.isKeyPressed(',');
#else
return false;
#endif
}
bool rightPressed() {
bool default_btn, custom_btn, serial_btn = false;
bool default_btn = false, custom_btn = false, serial_btn = false;

default_btn = DEFAULT_BTN_FAST_LONG_PRESS;

Expand All @@ -92,7 +96,7 @@ bool rightPressed() {
return (bool)(default_btn||custom_btn||serial_btn);
}
bool selectPressed() {
bool default_btn, custom_btn, serial_btn = false;
bool default_btn = false, custom_btn = false, serial_btn = false;

default_btn = DEFAULT_BTN_FAST_PRESS;

Expand All @@ -103,7 +107,7 @@ bool selectPressed() {
return (bool)(default_btn||custom_btn||serial_btn);
}
bool returnPressed() {
bool default_btn, custom_btn, serial_btn = false;
bool default_btn = false, custom_btn = false, serial_btn = false;

default_btn = DEFAULT_BTN_LONG_PRESS;

Expand All @@ -115,7 +119,7 @@ bool returnPressed() {
}

bool anyPressed() {
bool default_btn, custom_btn, serial_btn = false;
bool default_btn = false, custom_btn = false, serial_btn = false;

default_btn = DEFAULT_BTN_PRESSED;

Expand Down Expand Up @@ -156,18 +160,24 @@ void initBoard() {
int getBatteryLevel() {
#ifdef CONFIG_M5_BOARD
return M5Cardputer.Power.getBatteryLevel();
#else
return -1;
#endif
}

int16_t getBatteryVoltage() {
#ifdef CONFIG_M5_BOARD
return M5Cardputer.Power.getBatteryVoltage();
#else
return -1;
#endif
}

int isCharging() {
#ifdef CONFIG_M5_BOARD
return M5Cardputer.Power.isCharging();
#else
return -1;
#endif
}

Expand Down
26 changes: 26 additions & 0 deletions Firmware/BeamStalker/main/firmware/interface.h
Original file line number Diff line number Diff line change
@@ -1,15 +1,38 @@
#ifndef INTERFACE_H
#define INTERFACE_H


#include "esp_event.h"
#include "esp_task_wdt.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/timers.h"
#include "time.h"
#include "driver/gpio.h"

#include <string>

#ifndef CONFIG_M5_BOARD
#include "string.h"
#endif

#include "menu.h"

#ifdef CONFIG_M5_BOARD
#include <M5Cardputer.h>
#endif

// Temp fix for missing M5Cardputer.h
#ifndef CONFIG_M5_BOARD
#undef TFT_WHITE
#undef TFT_BLACK
#undef TFT_RED
static constexpr int TFT_WHITE = 0xFFFF;
static constexpr int TFT_BLACK = 0x0000;
static constexpr int TFT_RED = 0x0101;
static constexpr int TFT_CYAN = 0x0101;
#endif

#define DEFAULT_BTN GPIO_NUM_0

bool upPressed();
Expand All @@ -35,6 +58,9 @@ M5GFX display;
M5Canvas canvas(&display);
#define DISPLAY_WIDTH M5.Display.width()
#define DISPLAY_HEIGHT M5.Display.height()
#else
#define DISPLAY_WIDTH 13
#define DISPLAY_HEIGHT 37
#endif

#endif
8 changes: 5 additions & 3 deletions Firmware/BeamStalker/main/firmware/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,23 @@ char *createHeaderLine(const char *menu_name) {
return final;
}

void serialMenu(struct menu Menu) {
void serialMenu(struct menu Menu, int selector) {
printf ("-=%s=-\n",Menu.name);

for (int i = 0; i < Menu.length; i++) {
if (selector == i) {printf (">");}
if (selector == i) {printf (" ");}
printf ("%d - %s\n", i, Menu.elements[i].name);
if (Menu.elements[i].type == 1) {
for (int j = 0; j < Menu.elements[i].length; j++) {
printf (" - %d%d: %s\n",i,j, Menu.elements[i].options[j]);
printf (" -< %d%d: %s\n",i,j, Menu.elements[i].options[j]);
}
}
}
}

void drawMenu(struct menu Menu, int selector) {
serialMenu(Menu);
serialMenu(Menu, selector);
char fullMenuName[50];
sprintf(fullMenuName, "%s",createHeaderLine(Menu.name));

Expand Down
5 changes: 5 additions & 0 deletions Firmware/BeamStalker/partitions-4MB.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Name, Type, SubType, Offset, Size, Flags
# Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap
nvs, data, nvs, 0x9000, 0x6000,
phy_init, data, phy, , 0x1000,
factory, app, factory, 0x10000, 3M,
File renamed without changes.

0 comments on commit 58ca87e

Please sign in to comment.