Skip to content

Commit

Permalink
Merge pull request #224 from thorrak/m5
Browse files Browse the repository at this point in the history
Refactor LCD code and add "Custom User Target"
  • Loading branch information
thorrak committed Jan 9, 2023
2 parents 0152d60 + 0658b25 commit e8240ef
Show file tree
Hide file tree
Showing 13 changed files with 350 additions and 82 deletions.
85 changes: 85 additions & 0 deletions .github/workflows/build.yml
@@ -0,0 +1,85 @@
name: Build

on:
push:
branches:
- master
# tags:
# - "v*"
# pull_request:
# types: [ open, synchronize, edited, reopened, closed ]

jobs:
build:
name: Build bins for ${{ matrix.pio_env }}
strategy:
# Ensure that a wheel builder finishes even if another fails
fail-fast: false
matrix:
pio_env: ['lcd_ssd1306', 'd32_pro_tft', 'tft_espi', 'm5stickc_plus']

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3.3.0
- run: git fetch --prune --unshallow

- name: Cache pip
uses: actions/cache@v3.2.2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v3.2.2
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}

- name: Set up Python
uses: actions/setup-python@v4.4.0

- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
- name: Build all environments
run: |
pio run -e ${{ matrix.pio_env }}
pio run -e ${{ matrix.pio_env }} --target buildfs
# sh ./copy_bins.sh

- name: Copy files
run: |
cp .pio/build/${{ matrix.pio_env }}/firmware.bin bin/${{ matrix.pio_env }}_firmware.bin
cp .pio/build/${{ matrix.pio_env }}/partitions.bin bin/${{ matrix.pio_env }}_partitions.bin
cp .pio/build/${{ matrix.pio_env }}/spiffs.bin bin/${{ matrix.pio_env }}_spiffs.bin
# - name: "Create Prerelease"
# uses: "marvinpinto/action-automatic-releases@latest"
# with:
# repo_token: "${{ secrets.GITHUB_TOKEN }}"
# prerelease: true
# files: |
# LICENSE
# bin/*.bin

- name: Create Draft Release
uses: softprops/action-gh-release@v1
# if: startsWith(github.ref, 'refs/tags/')
with:
body: "Draft release"
# note you'll typically need to create a personal access token
# with permissions to create releases in the other repo
token: ${{ secrets.GITHUB_TOKEN }}
draft: true
prerelease: true
files: |
LICENSE
bin/*.bin
env:
GITHUB_REPOSITORY: thorrak/tiltbridge
31 changes: 31 additions & 0 deletions data/settings.htm
Expand Up @@ -112,6 +112,7 @@
<a class="dropdown-item" data-toggle="tab" href="#brewstatus">Brewstatus</a>
<a class="dropdown-item" data-toggle="tab" href="#taplistio">Taplist.io</a>
<a class="dropdown-item" data-toggle="tab" href="#mqtt">MQTT</a>
<a class="dropdown-item" data-toggle="tab" href="#usertarget">Generic JSON Target</a>
</div>
</li>

Expand Down Expand Up @@ -536,6 +537,36 @@ <h5 class="card-title">Brewfather Settings</h5>

</div> <!-- BrewFather Tab -->

<div class="tab-pane fade" id="usertarget"> <!-- User Target Tab -->

<div class="card-header bg-light border-primary">
<h5 class="card-title">User Target Settings</h5>
</div>

<div class="card-body">
<p class="card-text">
These settings control how TiltBridge talks to a user-defined target. Specify a url
here and TiltBridge will send a
</p>
<form action="/settings/usertarget/" method="POST">
<div class="form-group row">
<label for="userTargetURL" class="col-sm-3 col-form-label" data-toggle="tooltip"
title="URL to send data to">User Target URL</label>
<div class="col-sm-8">
<input type="text" class="form-control" name="userTargetURL" id="userTargetURL"
placeholder="http://www.target.com/" :value="settings.userTargetURL"
minlength="12" maxlength="128">
</div>
</div>
<div class="row col-sm-12 justify-content-center">
<button type="submit" class="btn btn-primary button-update"
onclick="if(!this.form.checkValidity(this)){return (false);}">Update</button>
</div>
</form>
</div>

</div> <!-- User Target Tab -->

<div class="tab-pane fade" id="grainfather"> <!-- Grainfather Tab -->

<div class="card-header bg-light border-primary">
Expand Down
19 changes: 19 additions & 0 deletions data/settings.js
Expand Up @@ -182,6 +182,9 @@ function populateConfig(callback = null) { // Get configuration settings, popula
// Brewfather Tab
$('input[name="brewfatherKey"]').val(config.brewfatherKey);

// Brewfather Tab
$('input[name="userTargetURL"]').val(config.userTargetURL);

// Grainfather Tab
$('input[name="grainfatherURL_red"]').val(config.Red.grainfatherURL);
$('input[name="grainfatherURL_green"]').val(config.Green.grainfatherURL);
Expand Down Expand Up @@ -306,6 +309,9 @@ function processPost(obj) { // Disable buttons and call POST handler for form
case "#brewfather":
processBrewfatherPost(url, obj);
break;
case "#usertarget":
processUserTargetPost(url, obj);
break;
case "#grainfather":
processGrainfatherPost(url, obj);
break;
Expand Down Expand Up @@ -475,6 +481,19 @@ function processBrewfatherPost(url, obj) { // Handle Brewfather posts
postData(url, data);
}

function processUserTargetPost(url, obj) { // Handle User Target posts
// Get form data
var $form = $(obj.form),
userTargetKeyVal = $form.find("input[name='userTargetURL']").val();

// Process post
data = {
userTargetURL: userTargetKeyVal
};
postData(url, data);
}


function processGrainfatherPost(url, obj) { // Handle Grainfather posts
// Get form data
var $form = $(obj.form),
Expand Down
10 changes: 10 additions & 0 deletions docs/source/changelog.rst
Expand Up @@ -3,6 +3,16 @@ Changelog



v1.2.0 - Jan 9, 2023 - Fix OLED & Refactor LCD Code
---------------------------------------------------

- Fix OLED firmware
- Refactor LCD code to combine "D32 TFT" and "ESPI TFT" code
- Replace existing M5 libraries with (existing) ESPI TFT library
- Add new "User Target" data destination
- Add support for OLED display at pins 17 & 18


v1.1.3 - Aug 18, 2022 - Fix WiFi Manager
----------------------------------------

Expand Down
39 changes: 31 additions & 8 deletions platformio.ini
Expand Up @@ -66,7 +66,7 @@ lib_deps =
https://github.com/thorrak/Arduino-Log.git ; // Need this until ArduinoLog merges https://github.com/thijse/Arduino-Log/pull/23
https://github.com/lbussy/esptelnet.git
https://github.com/me-no-dev/ESPAsyncWebServer.git
https://github.com/tzapu/WiFiManager.git#e0c5fb7daf4c44f2753fdc7325b9d47ad154ed30 ;#feature_asyncwebserver
https://github.com/thorrak/WiFiManager.git#feature_asyncwebserver
h2zero/NimBLE-Arduino @ 1.3.4 ; https://github.com/h2zero/NimBLE-Arduino.git
256dpi/MQTT @ 2.4.8
lbussy/LCBUrl @ ^1.1.7
Expand Down Expand Up @@ -196,26 +196,49 @@ lib_deps =
bodmer/TFT_eSPI @ 2.4.72 ; https://github.com/Bodmer/TFT_eSPI.git
build_type = ${common.build_type}

[env:m5stickc] ; M5Stack M5Stick-C
board = m5stick-c
board_build.f_cpu = 240000000L

[env:m5stickc_plus]
board = esp32dev
platform = ${common.platform}
; platform_packages = ${common.platform_packages}
framework = ${common.framework}
; The M5StickC Plus has 4MB of flash. Use the custom 4MB partition to allow enough space
; for both OTA and SPIFFS.
board_build.partitions = ${common.board_build.partitions}
upload_speed = 1500000
monitor_speed = ${common.monitor_speed}
monitor_filters = ${common.monitor_filters}
; This can/will be set in tools/get_port.py
; upload_port = {common.upload_port}
; monitor_port = ${common.monitor_port}
monitor_dtr = ${common.monitor_dtr}
monitor_rts = ${common.monitor_rts}
build_flags =
${common.build_flags}
; -DM5STICKC_PLUS
-DLCD_TFT_M5STICKC=1
-DLCD_TFT_ESPI=1
-DDISABLE_OTA_UPDATES
; -DBUTTON_NO_PULLUP=1
-DBUTTON_INVERT
-DLCD_TFT_ESPI=1
-DAXP192=1
; -DDISABLE_OTA_UPDATES=1
-DUSER_SETUP_LOADED=1
-DST7789_DRIVER=1
-DTFT_WIDTH=135
-DTFT_HEIGHT=240
-DCGRAM_OFFSET=1
-DTFT_MISO=-1
-DTFT_MOSI=15
-DTFT_SCLK=13
-DTFT_CS=5
-DTFT_DC=23
-DTFT_RST=18
-DLOAD_GFXFF=1
-DWIFI_RESET_BUTTON_GPIO=37
-DDISABLE_OTA_UPDATES
; -DBOARD_RESET_BUTTON_GPIO=39
lib_deps =
${common.lib_deps}
m5stack/M5StickC @ 0.2.0
bodmer/TFT_eSPI @ 2.4.79 ; https://github.com/Bodmer/TFT_eSPI.git
tanakamasayuki/I2C AXP192 Power management@^1.0.4
build_type = ${common.build_type}
check_skip_packages = yes

0 comments on commit e8240ef

Please sign in to comment.