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
44 changes: 44 additions & 0 deletions .github/workflows/build_firmware.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Build and Release Firmware

on:
push:
branches: [ main ]
tags:
- 'v*'
pull_request:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install PlatformIO
run: pip install platformio

- name: Run Static Code Analysis
run: pio check --fail-on-defect=high

- name: Build Firmware
run: pio run

- name: Rename firmware binary
if: startsWith(github.ref, 'refs/tags/')
run: |
cp .pio/build/esp32-s3-devkitc-1/firmware.bin ESP32-DIV-${{ github.ref_name }}.bin

- name: Create Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
files: ESP32-DIV-${{ github.ref_name }}.bin
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
86 changes: 86 additions & 0 deletions create the plan in a new markdown file.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# **ESP32-DIV Contribution Plan: PlatformIO Migration & CI/CD Pipeline**

Https://github.com/cifertech/ESP32-DIV

**Objective:** Transition the ESP32-DIV project from a manual Arduino IDE workflow to a robust, automated PlatformIO environment. This will standardize dependencies, improve code quality via static analysis, and automate firmware release generation.

## **Phase 1: Environment Standardization (PlatformIO)**

### **Task Description**

Transition the project build system from Arduino IDE (.ino structure) to PlatformIO. This involves creating a platformio.ini configuration file that explicitly defines hardware targets, framework versions, and external library dependencies.

### **Technical Implementation Detail**

1. **Initialize Project**: Create a platformio.ini file in the root directory.
2. **Define Environment**: Configure the \[env:esp32dev\] block (or appropriate board variant).
3. **Framework**: Set framework \= arduino and platform \= espressif32.
4. **Dependencies**: Identify all libraries currently installed manually in Arduino IDE (e.g., TFT\_eSPI, Adafruit\_NeoPixel, CC1101 libraries). Add them to lib\_deps using their library registry names or GitHub URLs.
5. **Structure Refactor**:
* Ensure the main .ino file is compatible or rename/refactor main logic to src/main.cpp.
* Move header files to include/ and source files to src/ if not already structured effectively.

### **Verification/Testing**

* **Unit Test**: Run the command pio run locally in the terminal.
* **Success Criteria**: The project compiles without fatal errors, and the generated firmware.bin matches the functional behavior of the Arduino IDE build when flashed to the device.

## **Phase 2: Static Code Analysis Integration**

### **Task Description**

Integrate static analysis tools to automatically detect memory leaks, buffer overflows, and uninitialized variables, which are critical in embedded C++ security tools.

### **Technical Implementation Detail**

1. **Configuration**: Add check\_tool \= cppcheck and check\_skip\_packages \= yes to platformio.ini.
2. **Flags**: Configure check\_flags to enable strict checking:
check\_flags \=
cppcheck: \--enable=all \--inconclusive \--std=c++11 \--suppress=\*:\*.pio/\*

3. **Suppression**: Create a suppression list if external libraries generate excessive false positives, ensuring the focus remains on the project's source code.

### **Verification/Testing**

* **Integration Test**: Execute pio check within the project root.
* **Success Criteria**: The tool generates an analysis report. The goal is to reach zero "Critical" or "High" severity errors in the src/ directory.

## **Phase 3: GitHub Actions Workflow (CI)**

### **Task Description**

Implement a GitHub Actions workflow to automate the build and verification process on every push to main and every Pull Request.

### **Technical Implementation Detail**

1. **Workflow File**: Create .github/workflows/build\_firmware.yml.
2. **Triggers**: Set on: \[push, pull\_request\].
3. **Job Steps**:
* **Checkout**: Use actions/checkout@v4.
* **Setup Python**: Use actions/setup-python@v4.
* **Install Core**: Run pip install platformio.
* **Build**: Run pio run.
* **Lint**: Run pio check \--fail-on-defect=high.

### **Verification/Testing**

* **System Test**: Push a commit to a new feature branch and open a Pull Request.
* **Success Criteria**: The GitHub Action runner triggers automatically, successfully installs dependencies, builds the firmware, passes the linting stage, and reports a green "Success" status on the PR.

## **Phase 4: Automated Release Packaging (CD)**

### **Task Description**

Automate the generation of release assets when a new Git tag is pushed. This ensures users always have access to the latest compiled binaries without needing to set up a compile environment themselves.

### **Technical Implementation Detail**

1. **Workflow Extension**: Update .github/workflows/build\_firmware.yml to trigger on tags: tags: \['v\*'\].
2. **Artifact Renaming**: Add a step after the build to rename .pio/build/esp32dev/firmware.bin to ESP32-DIV-${{ github.ref\_name }}.bin.
3. **Release Action**: Use softprops/action-gh-release@v1 (or similar) to create a GitHub Release.
4. **Upload**: Configure the action to upload the renamed binary file as an asset.

### **Verification/Testing**

* **Integration Test**: Push a test tag (e.g., git tag v1.0.0-test && git push origin v1.0.0-test).
* **Success Criteria**: A new Release appears on the GitHub repository page containing the correctly named .bin file and the release notes derived from the commit history or tag description.
File renamed without changes.
File renamed without changes.
File renamed without changes.
50 changes: 25 additions & 25 deletions ESP32-DIV/Touchscreen.h → include/Touchscreen.h
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
#ifndef TOUCHSCREEN_H
#define TOUCHSCREEN_H
#include <SPI.h>
#include <XPT2046_Touchscreen.h>
#include "SettingsStore.h"
#include "shared.h"
extern SPIClass touchscreenSPI;
extern XPT2046_Touchscreen ts;
#define TOUCH_X_MIN 300
#define TOUCH_X_MAX 3800
#define TOUCH_Y_MIN 300
#define TOUCH_Y_MAX 3800
#define DISPLAY_WIDTH 240
#define DISPLAY_HEIGHT 320
extern bool feature_active;
void setupTouchscreen();
#endif
bool readTouchXY(int& x, int& y);
#ifndef TOUCHSCREEN_H
#define TOUCHSCREEN_H

#include <SPI.h>
#include <XPT2046_Touchscreen.h>
#include "SettingsStore.h"
#include "shared.h"

extern SPIClass touchscreenSPI;
extern XPT2046_Touchscreen ts;

#define TOUCH_X_MIN 300
#define TOUCH_X_MAX 3800
#define TOUCH_Y_MIN 300
#define TOUCH_Y_MAX 3800
#define DISPLAY_WIDTH 240
#define DISPLAY_HEIGHT 320

extern bool feature_active;

void setupTouchscreen();

#endif

bool readTouchXY(int& x, int& y);
122 changes: 61 additions & 61 deletions ESP32-DIV/bleconfig.h → include/bleconfig.h
Original file line number Diff line number Diff line change
@@ -1,61 +1,61 @@
#ifndef BLECONFIG_H
#define BLECONFIG_H
#include <Arduino.h>
#include <PCF8574.h>
#include <RF24.h>
#include <SPI.h>
#include <TFT_eSPI.h>
#include <Wire.h>
#include <XPT2046_Touchscreen.h>
#include <nRF24L01.h>
#include "BleCompat.h"
#include "esp_bt.h"
#include "esp_bt_main.h"
#include "esp_gap_bt_api.h"
#include "esp_wifi.h"
#include "shared.h"
#include "utils.h"
extern TFT_eSPI tft;
extern PCF8574 pcf;
namespace BleJammer {
void blejamSetup();
void blejamLoop();
}
namespace BleSpoofer {
void spooferSetup();
void spooferLoop();
}
namespace SourApple {
void sourappleSetup();
void sourappleLoop();
}
namespace BleScan {
void bleScanSetup();
void bleScanLoop();
void startBackgroundScanner();
int getLastCount();
}
namespace Scanner {
void scannerSetup();
void scannerLoop();
}
namespace ProtoKill {
void prokillLoop();
void prokillSetup();
}
namespace BleSniffer {
void blesnifferLoop();
void blesnifferSetup();
}
#endif
#ifndef BLECONFIG_H
#define BLECONFIG_H

#include <Arduino.h>
#include <PCF8574.h>
#include <RF24.h>
#include <SPI.h>
#include <TFT_eSPI.h>
#include <Wire.h>
#include <XPT2046_Touchscreen.h>
#include <nRF24L01.h>
#include "BleCompat.h"
#include "esp_bt.h"
#include "esp_bt_main.h"
#include "esp_gap_bt_api.h"
#include "esp_wifi.h"
#include "shared.h"
#include "utils.h"

extern TFT_eSPI tft;
extern PCF8574 pcf;

namespace BleJammer {
void blejamSetup();
void blejamLoop();
}

namespace BleSpoofer {
void spooferSetup();
void spooferLoop();
}

namespace SourApple {
void sourappleSetup();
void sourappleLoop();
}

namespace BleScan {
void bleScanSetup();
void bleScanLoop();

void startBackgroundScanner();
int getLastCount();
}

namespace Scanner {
void scannerSetup();
void scannerLoop();
}

namespace ProtoKill {
void prokillLoop();
void prokillSetup();
}

namespace BleSniffer {
void blesnifferLoop();
void blesnifferSetup();
}

#endif
File renamed without changes.
File renamed without changes.
Loading