Skip to content

Commit

Permalink
Merge branch 'main' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
n0xa committed Jan 26, 2024
2 parents aedc249 + 27d8576 commit 217bde7
Show file tree
Hide file tree
Showing 4 changed files with 3,598 additions and 10 deletions.
202 changes: 202 additions & 0 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
---
name: Compile NEMO Firmware

on:
push:
branches:
- main
tags:
- "v*"
pull_request:
branches:
- main
workflow_dispatch:
inputs:
board:
description: 'Board to Compile'
type: choice
required: true
default: 'M5Cardputer'
options: ['M5Cardputer', 'M5StickCPlus2', 'M5StickCPlus', 'M5StickC']

jobs:
compile_sketch:
name: Build ${{ matrix.board.name }} (${{ matrix.locale }})
runs-on: ubuntu-latest
strategy:
# max-parallel: 4
fail-fast: false
matrix:
locale:
- en-us
- pt-br
board:
- {
name: "M5Cardputer",
fqbn: "m5stack:esp32:m5stack_cardputer",
extra_flags: "-DCARDPUTER",
libraries: "M5Cardputer IRRemoteESP8266",
partitions: {
bootloader_addr: "0x0000",
},
}
- {
name: "M5StickCPlus2",
fqbn: "m5stack:esp32:m5stack_stickc_plus2",
extra_flags: "-DSTICK_C_PLUS2",
libraries: "M5StickCPlus2 IRRemoteESP8266",
partitions: {
bootloader_addr: "0x1000",
},
}
- {
name: "M5StickCPlus",
fqbn: "m5stack:esp32:m5stack_stickc_plus",
extra_flags: "-DSTICK_C_PLUS",
libraries: "M5StickCPlus IRRemoteESP8266",
partitions: {
bootloader_addr: "0x1000",
},
}
- {
name: "M5StickC",
fqbn: "m5stack:esp32:m5stack_stickc",
extra_flags: "-DSTICK_C",
# TODO: M5StickC's latest version has some dependency issues with M5Hat-JoyC library
libraries: "[email protected] IRRemoteESP8266",
partitions: {
bootloader_addr: "0x1000",
},
}

steps:
- uses: actions/checkout@v4

- id: nemo_version
name: Get NEMO Version
run: |
set -x
if [[ "${{ github.ref_type }}" == "tag" ]]; then
version=${{ github.ref_name }}
else
version="${GITHUB_SHA::7}"
fi
echo "version=${version}" > $GITHUB_OUTPUT
- name: Setup Arduino CLI
uses: arduino/setup-arduino-cli@v1

- name: Install platform
run: |
set -x
# arduino-cli core install esp32:esp32
arduino-cli core install m5stack:esp32 --additional-urls "file:///${PWD}/package_m5stack_index.json"
arduino-cli core search m5stack
arduino-cli board listall
arduino-cli lib install ${{ matrix.board.libraries }} --log-level warn --verbose
- name: Install esptool
run: |
pip install -U esptool
- name: Compile ${{ matrix.board.name }} Sketch
run: |
set -x
version=${{ steps.nemo_version.outputs.version }}
locale=${{ matrix.locale }}
language=$(echo "LANGUAGE_${locale//-/_}" | tr '[:lower:]' '[:upper:]')
extra_flags="${{ matrix.board.extra_flags }} -DNEMO_VERSION=\"${version}\" -D${language}"
arduino-cli compile --fqbn ${{ matrix.board.fqbn }} -e \
--build-property build.partitions=huge_app \
--build-property upload.maximum_size=3145728 \
--build-property compiler.cpp.extra_flags="${extra_flags}" \
./m5stick-nemo.ino
- name: Create ${{ matrix.board.name }} Firmware Binary
run: |
set -x
version=${{ steps.nemo_version.outputs.version }}
locale=${{ matrix.locale }}
if [[ "${locale}" == "en-us" ]]; then
output_file="M5Nemo-${version}-${{ matrix.board.name }}.bin"
else
output_file="M5Nemo-${version}-${{ matrix.board.name }}.${locale}.bin"
fi
fqbn=${{ matrix.board.fqbn }}
directory="${fqbn//:/.}"
esptool.py --chip esp32s3 merge_bin --output ${output_file} \
${{ matrix.board.partitions.bootloader_addr }} build/${directory}/m5stick-nemo.ino.bootloader.bin \
0x8000 build/${directory}/m5stick-nemo.ino.partitions.bin \
0x10000 build/${directory}/m5stick-nemo.ino.bin
- name: List all files
if: always()
continue-on-error: true
run: |
set -x
pwd
ls -all
tree
# TODO: Validate the firmware

- name: Upload ${{ matrix.board.name }} Firmware Binary
uses: actions/upload-artifact@v4
with:
name: M5Nemo-${{ matrix.board.name }}.${{ matrix.locale }}
path: M5Nemo-*.bin
if-no-files-found: error

create_release:
runs-on: ubuntu-latest
environment: github_release
needs: [compile_sketch]
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'

steps:
- id: nemo_version
name: Get NEMO Version
run: |
set -x
if [[ "${{ github.ref_type }}" == "tag" ]]; then
version=${{ github.ref_name }}
else
version="${GITHUB_SHA::7}"
fi
echo "version=${version}" > $GITHUB_OUTPUT
- uses: actions/download-artifact@v4
with:
merge-multiple: true

- name: List all files
if: always()
run: |
set -x
pwd
ls -all
tree
- name: Create Release ${{ steps.nemo_version.outputs.version }}
uses: softprops/action-gh-release@v1
with:
name: NEMO Release ${{ steps.nemo_version.outputs.version }}
tag_name: ${{ steps.nemo_version.outputs.version }}
files: |
M5Nemo-*.bin
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,50 @@ If you want to customize NEMO or contribute to the project, you should be famili
* If for some reason the screen jumps from very dim at level 0 to almost fully bright at level 1 and further brightness levels don't affect anything, set the pct_brightness variable to false.
* Compile and upload the project

## Building from Source (with Arduino CLI)

- Install Arduino CLI
- Add M5Stack Index to Arduino Core
- Add M5Stack Libraries

```bash

# Install m5stack boards
arduino-cli core install m5stack:esp32 --additional-urls https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/arduino/package_m5stack_index.json --log-level warn --verbose

# Install required library
arduino-cli lib install M5Cardputer --log-level warn --verbose
arduino-cli lib install IRRemoteESP8266 --log-level warn --verbose

# Compile sketch
arduino-cli compile --fqbn m5stack:esp32:m5stack_cardputer -e --build-property build.partitions=huge_app --build-property upload.maximum_size=3145728 ./m5stick-nemo.ino

```

- This will create multiple binaries based on partition sketch, you can merge a single binary using `esptool``
- Install esptool - `pip install -U esptool`

```bash

esptool.py --chip esp32s3 merge_bin --output final.bin 0x0000 m5stick-nemo.ino.bootloader.bin 0x8000 m5stick-nemo.ino.partitions.bin 0x10000 m5stick-nemo.ino.bin
```

- You can now flash the merged binary firmware using `esptool`

```bash

esptool.exe write_flash -z 0 final.bin
```


## Troubleshooting
* Several features output debugging information to the serial monitor. Use the Serial Monitor feature in Arduino IDE or M5Burner to gather this information. It may have useful hints. When filing a bug report, it often helps to include serial monitor output.
* Reset the EEPROM. On models with EEPROM settings support, use "Clear Settings" from the settings menu, or hold the "Next" button (Side key on StickC models, Tab or Down Arrow on Cardputer) while powering on.
* TV-B-Gone's IR LED can be observed through a smart phone camera, emitting a pale purple beam of light. If it seems to be on constantly, or if it never flashes at all during TV-B-Gone operations, something is wrong. Report a bug. There's a known issue with TVBG not working after using Bluetooth spam or random wifi spam.
* Try viewing wifi lists from several different devices if you suspect wifi spam isn't working. Sometimes, Linux network manager can see networks that smart phones cannot. Please include the results of this testing if reporting wifi spam problems.
* Apple has patched a lot of Bluetooth stuff since summer 2023. If testing AppleJuice, try some of the AppleTV device types, as they tend to be more reliable due to apple not filtering out weaker bluetooth signals for that platform.


## Reporting Bugs
Please report bugs via GitHub Issues. These are easier to track than comments on social media posts, M5Burner entries, etc. If something isn't working, please include:
* Firmware version
Expand Down
31 changes: 21 additions & 10 deletions m5stick-nemo.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,30 @@
// github.com/n0xa | IG: @4x0nn

// -=-=-=-=-=-=- Uncomment the platform you're building for -=-=-=-=-=-=-
//#define STICK_C_PLUS
#define STICK_C_PLUS2
//#define STICK_C
//#define CARDPUTER
// #define STICK_C_PLUS
// #define STICK_C_PLUS2
// #define STICK_C
// #define CARDPUTER
// -=-=- Uncommenting more than one at a time will result in errors -=-=-

String buildver="2.4.0";
// -=-=- NEMO Language for Menu and Portal -=- Thanks, @marivaaldo and @Mmatuda! -=-=-
// #define LANGUAGE_EN_US
// #define LANGUAGE_PT_BR

#define BGCOLOR BLACK
#define FGCOLOR GREEN

// -=-=- NEMO Language for Menu and Portal -=- Thanks, @marivaaldo and @Mmatuda! -=-=-
#define LANGUAGE_EN_US
//#define LANGUAGE_PT_BR
#ifndef NEMO_VERSION
#define NEMO_VERSION "dev"
#endif

#if !defined(CARDPUTER) && !defined(STICK_C_PLUS2) && !defined(STICK_C_PLUS) && !defined(STICK_C)
#define CARDPUTER
#endif

#if !defined(LANGUAGE_EN_US) && !defined(LANGUAGE_PT_BR)
#define LANGUAGE_EN_US
#endif

#if defined(STICK_C_PLUS)
#include <M5StickCPlus.h>
Expand Down Expand Up @@ -1356,7 +1367,7 @@ void credits_setup(){
DISP.setCursor(0, 10);
DISP.print(" M5-NEMO\n");
DISP.setTextSize(SMALL_TEXT);
DISP.printf(" %s\n",buildver);
DISP.printf(" %s\n",NEMO_VERSION);
DISP.println(" For M5Stack");
DISP.printf(" %s\n\n", platformName);
DISP.println("Contributors:");
Expand Down Expand Up @@ -1689,7 +1700,7 @@ void bootScreen(){
DISP.println("M5-NEMO");
DISP.setCursor(10, 30);
DISP.setTextSize(SMALL_TEXT);
DISP.printf("%s-%s\n",buildver,platformName);
DISP.printf("%s-%s\n",NEMO_VERSION,platformName);
#if defined(CARDPUTER)
DISP.println(TXT_INST_NXT);
DISP.println(TXT_INST_PRV);
Expand Down
Loading

0 comments on commit 217bde7

Please sign in to comment.