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

[#35] Wi-Fi Features #36

Merged
merged 26 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
904c982
Begin work on WiFi. Set up auto assets retrieval for WiFi development…
CodyTolene Jan 28, 2024
f301d58
Wrap pull auto pull of assets scripts. Stabilize a few things.
CodyTolene Jan 29, 2024
3c5b18b
Add git hooks.
CodyTolene Jan 29, 2024
6715ffb
Update git hooks.
CodyTolene Jan 29, 2024
cd0ab94
Update gitignore.
CodyTolene Jan 29, 2024
e7c553d
Auto fetch additional WiFi Git assets via arduino cli.
CodyTolene Jan 29, 2024
c45cd08
Wrap up firmware assets batch.
CodyTolene Jan 29, 2024
164429d
Fix typos.
CodyTolene Jan 29, 2024
5ffe9ca
Add missing reset of arduino cli library set in compile firmware fall…
CodyTolene Jan 29, 2024
261bf38
Update comments. Prep for first firmware test.
CodyTolene Jan 29, 2024
def2e2b
WiFi Testing...
CodyTolene Jan 29, 2024
7e58beb
Add notes
CodyTolene Jan 29, 2024
18c8127
Update server handler and add new response for get
CodyTolene Jan 29, 2024
13fb328
Use new UART in RC and convert app to c++
CodyTolene Jan 29, 2024
e517e0e
Update workflows.
CodyTolene Jan 30, 2024
f538c4e
From C++ to C.
CodyTolene Jan 30, 2024
9bdb62f
Update PR linting.
CodyTolene Jan 30, 2024
85df73f
Update PR linting.
CodyTolene Jan 30, 2024
92e6d7a
New dev branch workflow.
CodyTolene Jan 30, 2024
b348254
Fix up dev workflow and various cleanup.
CodyTolene Jan 30, 2024
2be5479
Updates
CodyTolene Feb 18, 2024
b5f342b
Cleanup
CodyTolene Feb 18, 2024
0ce6f01
Merge pull request #42 from CodyTolene/ct/wifi-rev2
CodyTolene Mar 3, 2024
c1b8f09
Add more people to the special thanks section.
CodyTolene Mar 3, 2024
af22af6
Update README links.
CodyTolene Mar 3, 2024
ef89c29
Add fan video. Thank you!
CodyTolene Mar 8, 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
18 changes: 18 additions & 0 deletions .github/hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

# Run ufbt lint in the "fap" folder
fap_folder="fap"

# Change to the root directory of the repository
cd "$(git rev-parse --show-toplevel)"

# Run ufbt lint in the "fap" folder
if ! (cd "$fap_folder" && ufbt lint); then
echo "Error: ufbt lint failed in the 'fap' folder. Please fix the issues before committing."
exit 1
else
echo "ufbt lint passed in the 'fap' folder."
fi

# If everything is okay, exit with a zero status
exit 0
Binary file added .github/images/video_rechtsanwalt_okan_dogan.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions .github/workflows/build-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: "Dev - Build & Upload FAP"
on:
push:
branches:
- dev
jobs:
ufbt-build-action:
runs-on: ubuntu-latest
name: "Build: Dev"
steps:
- name: "Checkout"
uses: actions/checkout@v3
with:
submodules: recursive

# Flipper Zero ufbt action
# https://github.com/flipperdevices/flipperzero-ufbt-action
- name: "Build"
uses: flipperdevices/flipperzero-ufbt-action@v0.1
id: build-app
with:
app-dir: ./fap
sdk-channel: dev

- name: "Create FAP Download (dev)"
uses: actions/upload-artifact@v3
with:
name: ${{ github.event.repository.name }}-dev-${{ steps.build-app.outputs.suffix }}.zip
path: ${{ steps.build-app.outputs.fap-artifacts }}
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
name: "Build + upload."
name: "Release - Build & Upload FAP"
on:
push:
branches:
# Run on push to main.
- main

schedule:
# Run every day at 00:00 UTC (midnight)
# Run every day at 00:00 UTC (midnight) to build the latest release
# for new and upcoming firmware.
- cron: "0 0 * * *"

jobs:
ufbt-build-action:
runs-on: ubuntu-latest
strategy:
matrix:
include:
# - name: dev
# sdk-channel: dev
- name: "dev"
sdk-channel: dev

- name: release
sdk-channel: release
- name: "rc"
sdk-channel: rc

# - name: rc
# sdk-channel: rc
- name: "release"
sdk-channel: release

name: "ufbt: Build for ${{ matrix.name }}"
name: "Build: ${{ matrix.name }}"
steps:
- name: Checkout
- name: "Checkout"
uses: actions/checkout@v3
with:
submodules: recursive

- name: Build with ufbt
uses: flipperdevices/flipperzero-ufbt-action@v0.1.3
# Flipper Zero ufbt action
# https://github.com/flipperdevices/flipperzero-ufbt-action
- name: "Build"
uses: flipperdevices/flipperzero-ufbt-action@v0.1
id: build-app
with:
app-dir: ./fap
sdk-channel: ${{ matrix.sdk-channel }}

- name: Upload app artifacts
- name: "Create FAP Downloads (dev/release/rc)"
uses: actions/upload-artifact@v3
with:
name: ${{ github.event.repository.name }}-${{ matrix.name }}-${{ steps.build-app.outputs.suffix }}.zip
Expand Down
25 changes: 0 additions & 25 deletions .github/workflows/lint-pull-request.yml

This file was deleted.

30 changes: 30 additions & 0 deletions .github/workflows/pull-request-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: "Dev PR - Lint & Build Test"
on:
pull_request:
branches:
- dev
jobs:
ufbt-test-build-action:
runs-on: ubuntu-latest
name: "PR Build: dev"
steps:
- name: "Checkout"
uses: actions/checkout@v3
with:
submodules: recursive

# Flipper Zero ufbt action
# https://github.com/flipperdevices/flipperzero-ufbt-action
- name: "Build"
uses: flipperdevices/flipperzero-ufbt-action@v0.1
id: build-app
with:
app-dir: ./fap
sdk-channel: dev

- name: "Lint"
uses: flipperdevices/flipperzero-ufbt-action@v0.1
with:
app-dir: ./fap
skip-setup: true
task: lint
43 changes: 43 additions & 0 deletions .github/workflows/pull-request-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: "Release PR - Lint & Build Test"
on:
pull_request:
branches:
- main
jobs:
ufbt-test-build-action:
runs-on: ubuntu-latest
# The following builds must pass before release is accepted:
strategy:
matrix:
include:
- name: "dev"
sdk-channel: dev

- name: "rc"
sdk-channel: rc

- name: "release"
sdk-channel: release

name: "PR Build: ${{ matrix.name }}"
steps:
- name: "Checkout"
uses: actions/checkout@v3
with:
submodules: recursive

# Flipper Zero ufbt action
# https://github.com/flipperdevices/flipperzero-ufbt-action
- name: "Build"
uses: flipperdevices/flipperzero-ufbt-action@v0.1
id: build-app
with:
app-dir: ./fap
sdk-channel: ${{ matrix.sdk-channel }}

- name: "Lint"
uses: flipperdevices/flipperzero-ufbt-action@v0.1
with:
app-dir: ./fap
skip-setup: true
task: lint
26 changes: 21 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
## Table of Contents <a name="index"></a>

- [Introduction](#intro)
- [YouTube](#youtube)
- [Videos](#videos)
- [Hardware Requirements](#hardware-requirements)
- [Hardware Installation](#hardware-installation)
- [Firmware Installation](#firmware-installation)
Expand Down Expand Up @@ -46,9 +46,11 @@ There will be many more features added in the future! If you have any ideas or s

<p align="right">[ <a href="#index">Back to top</a> ]</p>

## YouTube <a name="youtube"></a>
## Videos <a name="videos"></a>

This section is dedicated to all the fans that have made videos of this project! Thank you! If you have a video you'd like to share, please let me know by opening an issue [here][issues-link].
This section is dedicated to all the fans that have made videos of this project! Thank you!

If you have a video you'd like to share, please let me know by opening an issue [here][issues-link].

<details>

Expand All @@ -58,8 +60,16 @@ This section is dedicated to all the fans that have made videos of this project!

**Flipper Zero ESP32 CAM Camera Module** - by TAKEAPART

[https://www.youtube.com/watch?v=cEl5UnWH_Ok](https://www.youtube.com/watch?v=cEl5UnWH_Ok)

[![Flipper Zero ESP32 CAM Camera Module - TAKEAPART](https://img.youtube.com/vi/cEl5UnWH_Ok/0.jpg)](https://www.youtube.com/watch?v=cEl5UnWH_Ok)

**Tech With Kids - Flipper Zero ESP32 Kamera** - by @rechtsanwalt.okan.dogan

[https://www.instagram.com/reel/C4DrufKoKrb/](https://www.instagram.com/reel/C4DrufKoKrb/)

[![Flipper Zero ESP32 CAM Camera Module - @rechtsanwalt.okan.dogan](.github/images/video_rechtsanwalt_okan_dogan.png)](https://www.instagram.com/reel/C4DrufKoKrb/)

</details>

<p align="right">[ <a href="#index">Back to top</a> ]</p>
Expand Down Expand Up @@ -228,6 +238,8 @@ A huge thanks to the following people and projects for making this possible:

- This project is based on & forked from the [Flipper Zero Camera Application][flipperzero-camera] by [Z4urce][github-profile-z4urce]. Thanks Z4urce for the inspiration and the great work!
- I based this projects application structure on the [Flipper Zero Boilerplate Application][flipper-zero-fap-boilerplate] by [leedave][github-profile-leedave]. Thanks leedave for the great boilerplate application that helped me learn how to structure a Flipper Zero application properly!
- [WillyJL][github-profile-willyjl] for your guidance and wisdom.
- [TalkingSasquach][github-profile-talkingsasquach] for all of your helpful [YouTube videos][youtube-talkingsasquach] and [Discord community][discord-squachtopia].
- The project images were drawn using the a application called "[lopaka][lopaka]" by [sbrin][github-profile-sbrin]. Thanks sbrin for your help in creating the images for this project!
- The Flipper Zero community for all your support and feedback!

Expand All @@ -243,14 +255,14 @@ To contribute to this project, please follow the steps below:
4. Request PR [here][pull-request-link], introduce work via your branch.
5. Wait for review and merge.

When developing the firmware, be sure to download the dependencies by running the `firmware-flash.bat` batch script at the root of this directory. This will download the ESP32-CAM firmware dependencies to the directories defined in the `arduino-cli.yaml` file post-run. Add these dependencies and their directories to your "Include path" in your IDE of choice. I prefer Visual Studio Code, there's a guide on how to get started with that workflow here:
When developing the firmware, be sure to download the dependencies by running the `firmware-assets.bat` batch script at the root of this directory. This will download the ESP32-CAM firmware dependencies (Arduino Build & Git Assets) to your Windows TEMP folder. You can run the same script over again later to remove the temporary files when you're done using them. Once installed, add these dependencies and their directories to your "Include path" in your IDE of choice. I prefer Visual Studio Code; there's a guide on how to get started with that workflow here:

https://github.com/CodyTolene/Flipper-Zero-Development-Toolkit

Example include path:

```markdown
C:/Users/<username>/AppData/Local/Temp/arduino-cli/**
C:/Users/<username>/AppData/Local/Temp/arduino-cli/**/**
```

Thank you for any and all contributions to this project, I'm looking forward to seeing what you come up with! If you have any questions, please let me know by opening an issue [here][issues-link].
Expand Down Expand Up @@ -283,13 +295,17 @@ Cody Tolene

[arduino-ide]: https://www.arduino.cc/en/software
[btc-address-link]: https://explorer.btc.com/btc/address/bc1qfx3lvspkj0q077u3gnrnxqkqwyvcku2nml86wmudy7yf2u8edmqq0a5vnt
[discord-squachtopia]: https://discord.gg/squachtopia
[flipper-zero-apps]: https://docs.flipper.net/apps
[flipper-zero-fap-boilerplate]: https://github.com/leedave/flipper-zero-fap-boilerplate
[flipperzero-camera]: https://github.com/Z4urce/flipperzero-camera
[github-actions-link]: https://github.com/CodyTolene/Flipper-Zero-Camera-Suite/actions?query=workflow%3A%22Build+%2B+upload.%22
[github-profile-leedave]: https://github.com/leedave
[github-profile-sbrin]: https://github.com/sbrin
[github-profile-talkingsasquach]: https://github.com/skizzophrenic
[github-profile-willyjl]: https://github.com/Willy-JL
[github-profile-z4urce]: https://github.com/Z4urce
[issues-link]: https://github.com/CodyTolene/Flipper-Zero-Camera-Suite/issues
[lopaka]: https://github.com/sbrin/lopaka
[pull-request-link]: https://github.com/CodyTolene/Flipper-Zero-Camera-Suite/pulls
[youtube-talkingsasquach]: https://www.youtube.com/@TalkingSasquach
1 change: 0 additions & 1 deletion fap/camera_suite.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "camera_suite.h"
#include <stdlib.h>

bool camera_suite_custom_event_callback(void* context, uint32_t event) {
furi_assert(context);
Expand Down
33 changes: 31 additions & 2 deletions fap/camera_suite.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include <furi.h>
#include <furi_hal.h>
#include <furi_hal_serial.h>
#include <furi_hal_serial_control.h>
#include <gui/gui.h>
#include <gui/modules/button_menu.h>
#include <gui/modules/submenu.h>
Expand All @@ -12,14 +14,31 @@
#include <notification/notification_messages.h>
#include <stdlib.h>

#include "helpers/camera_suite_storage.h"
#include "scenes/camera_suite_scene.h"
#include "views/camera_suite_view_camera.h"
#include "views/camera_suite_view_guide.h"
#include "views/camera_suite_view_start.h"
#include "views/camera_suite_view_camera.h"
#include "views/camera_suite_view_wifi_camera.h"
#include "helpers/camera_suite_storage.h"

#define TAG "Camera Suite"
#include <furi.h>
#define FLIPPER_SCREEN_HEIGHT 64
#define FLIPPER_SCREEN_WIDTH 128

#define WORKER_EVENTS_MASK (WorkerEventStop | WorkerEventRx)

#ifdef xtreme_settings
/**
* Enable the following line for "Xtreme Firmware" & "Xtreme Apps" (Flipper-XFW).
*
* @see https://github.com/Flipper-XFW/Xtreme-Firmware
* @see https://github.com/Flipper-XFW/Xtreme-Apps
*/
#define UART_CH (xtreme_settings.uart_esp_channel)
#else
#define UART_CH (FuriHalSerialIdUsart)
#endif

typedef struct {
Gui* gui;
Expand All @@ -40,6 +59,9 @@ typedef struct {
uint32_t speaker;
uint32_t led;
ButtonMenu* button_menu;
FuriHalSerialHandle* serial_handle;
FuriStreamBuffer* rx_stream;
FuriThread* worker_thread;
} CameraSuite;

typedef enum {
Expand Down Expand Up @@ -89,3 +111,10 @@ typedef enum {
CameraSuiteLedOff,
CameraSuiteLedOn,
} CameraSuiteLedState;

typedef enum {
// Reserved for StreamBuffer internal event
WorkerEventReserved = (1 << 0),
WorkerEventStop = (1 << 1),
WorkerEventRx = (1 << 2),
} WorkerEventFlags;
2 changes: 1 addition & 1 deletion fap/helpers/camera_suite_haptic.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "camera_suite_haptic.h"
#include "../camera_suite.h"
#include "camera_suite_haptic.h"

void camera_suite_play_happy_bump(void* context) {
CameraSuite* app = context;
Expand Down
4 changes: 2 additions & 2 deletions fap/helpers/camera_suite_haptic.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include <notification/notification_messages.h>

void camera_suite_play_happy_bump(void* context);

void camera_suite_play_bad_bump(void* context);

void camera_suite_play_long_bump(void* context);
2 changes: 1 addition & 1 deletion fap/helpers/camera_suite_led.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "camera_suite_led.h"
#include "../camera_suite.h"
#include "camera_suite_led.h"

void camera_suite_led_set_rgb(void* context, int red, int green, int blue) {
CameraSuite* app = context;
Expand Down
2 changes: 1 addition & 1 deletion fap/helpers/camera_suite_speaker.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "camera_suite_speaker.h"
#include "../camera_suite.h"
#include "camera_suite_speaker.h"

#define NOTE_INPUT 587.33f

Expand Down
Loading