Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/mp-se/kegmon
Browse files Browse the repository at this point in the history
  • Loading branch information
mp-se committed Oct 4, 2023
2 parents 06e461c + 1323695 commit 98aa1ac
Show file tree
Hide file tree
Showing 15 changed files with 341 additions and 142 deletions.
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export GITHUB_REPOSITORY=mp-se/kegmon@master
export GITHUB_TOKEN="$(gh auth token)"
export SECRETS_GITHUB_TOKEN="$(gh auth token)"
6 changes: 4 additions & 2 deletions .github/workflows/doc-build.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
name: Sphinx Build

on:
pull_request:
push:
branches:
- master

jobs:
build:
doc-build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: ammaraskar/sphinx-action@master
with:
Expand Down Expand Up @@ -41,6 +42,7 @@ jobs:
git commit -m "Update documentation" -a || true
# The above command will fail if no changes were present, so we ignore
# the return code.
- name: Push changes
uses: ad-m/github-push-action@master
with:
Expand Down
54 changes: 23 additions & 31 deletions .github/workflows/pio-build.yaml
Original file line number Diff line number Diff line change
@@ -1,51 +1,43 @@
name: PlatformIO CI

on:
pull_request:
push:
branches:
- dev

jobs:
build:
pio-build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Cache pip
uses: actions/cache@v2
- name: Setup PlatformIO
uses: n-vr/setup-platformio-action@v1.0.1

#- name: Run PlatformIO
# run: pio run -e kegmon-release -e kegmon32s2-release

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

- name: Set up Python
uses: actions/setup-python@v2

- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
git config --global advice.detachedHead false
- name: Run PlatformIO
run: pio run -e kegmon-release -e kegmon32s2-release

- uses: EndBug/add-and-commit@v7 # You can change this to use a specific version. https://github.com/marketplace/actions/add-commit
environments: "kegmon-release,kegmon32s2-release"
#targets: "kegmon-release,kegmon32s2-release"
#project-dir: "./some_dir"
#project-conf: "./some_dir/custom.ini"
jobs: 6
silent: false
verbose: true
disable-auto-clean: false


- uses: EndBug/add-and-commit@v9 # You can change this to use a specific version. https://github.com/marketplace/actions/add-commit
if: ${{ github.event_name != 'pull_request' }}
with:
add: 'bin'
author_name: GitHub Action
author_email: mp-se@noreply.github.com

branch: dev

default_author: github_actor
message: 'GitHub Action Build'
pathspec_error_handling: ignore
7 changes: 4 additions & 3 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- name: clang format support
run: |
sudo apt update
sudo apt install clang-format cppcheck
- uses: pre-commit/action@v2.0.3
- uses: pre-commit/action@v3.0.0
Binary file modified bin/firmware.bin
Binary file not shown.
Binary file modified bin/firmware32s2.bin
Binary file not shown.
Binary file added bin/littlefs.bin
Binary file not shown.
137 changes: 68 additions & 69 deletions html/backup.htm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!doctype html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
Expand All @@ -16,7 +16,7 @@

<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-HwwvtgBNo3bZJJLYd8oVXjrBZt8cqVSpeBNS5n7C8IVInixGAoxmnlMuBnhbgrkm" crossorigin="anonymous"></script>
<script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>

<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<div class="container">
<a class="navbar-brand" href="/index.htm">Beer Keg Monitor</a>
Expand Down Expand Up @@ -53,99 +53,98 @@
<div class="spinner-border text-light" id="spinner" role="status"></div>
</div>
</nav>


<!-- START MAIN INDEX -->
<!-- START MAIN INDEX -->

<div class="container row-margin-10">
<div class="container row-margin-10">

<div class="alert alert-success alert-dismissible hide fade d-none" role="alert">
<div id="alert"></div>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
<div class="alert alert-success alert-dismissible hide fade d-none" role="alert">
<div id="alert"></div>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>

<script type="text/javascript">
function showError( msg ) {
$('.alert').removeClass('alert-success').addClass('alert-danger').removeClass('hide').addClass('show').removeClass('d-none');
$('#alert').text( msg );
}
<script>
function showError( msg ) {
$('.alert').removeClass('alert-success').addClass('alert-danger').removeClass('hide').addClass('show').removeClass('d-none');
$('#alert').text( msg );
}

function showSuccess( msg ) {
$('.alert').addClass('alert-success').removeClass('alert-danger').removeClass('hide').addClass('show').removeClass('d-none');
$('#alert').text( msg );
}
function showSuccess( msg ) {
$('.alert').addClass('alert-success').removeClass('alert-danger').removeClass('hide').addClass('show').removeClass('d-none');
$('#alert').text( msg );
}

$("#alert-btn").click(function(e){
$('.alert').addClass('hide').removeClass('show').addClass('d-none');
});
</script>
$("#alert-btn").click(function(e){
$('.alert').addClass('hide').removeClass('show').addClass('d-none');
});
</script>

<div class="accordion" id="accordion">
<div class="accordion" id="accordion">

<div class="accordion-item">
<h2 class="accordion-header" id="headingBackup">
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapseBackup" aria-expanded="true" aria-controls="collapseBackup">
<b>Create backup</b>
</button>
</h2>
<div id="collapseBackup" class="accordion-collapse collapse show" aria-labelledby="headingBackup" data-bs-parent="#accordion">
<div class="accordion-body">
<div class="accordion-item">
<h2 class="accordion-header" id="headingBackup">
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapseBackup" aria-expanded="true" aria-controls="collapseBackup">
<b>Create backup</b>
</button>
</h2>
<div id="collapseBackup" class="accordion-collapse collapse show" aria-labelledby="headingBackup" data-bs-parent="#accordion">
<div class="accordion-body">

<div class="row mb-3">
<div class="col-md-12 themed-grid-col bg-light">Backup configuration to file</div>
</div>
<div class="row mb-3">
<div class="col-md-12 themed-grid-col bg-light">Backup configuration to file</div>
</div>

<button class="btn btn-primary btn-sm" type="button" data-bs-toggle="tooltip" name="backup-btn" id="backup-btn" title="Create backup of configuration">
Create backup
</button>

<button class="btn btn-primary btn-sm" type="button" data-bs-toggle="tooltip" name="backup-btn" id="backup-btn" title="Create backup of configuration">
Create backup
</button>

</div>
</div>
</div>
</div>

<div class="accordion-item">
<h2 class="accordion-header" id="headingRestore">
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapseRestore" aria-expanded="true" aria-controls="collapseRestore">
<b>Restore backup</b>
</button>
</h2>
<div id="collapseRestore" class="accordion-collapse collapse show" aria-labelledby="headingRestore" data-bs-parent="#accordion">
<div class="accordion-body">

<div class="row mb-3">
<div class="col-md-12 themed-grid-col bg-light">Restore configuration from file</div>
</div>
<div class="accordion-item">
<h2 class="accordion-header" id="headingRestore">
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapseRestore" aria-expanded="true" aria-controls="collapseRestore">
<b>Restore backup</b>
</button>
</h2>
<div id="collapseRestore" class="accordion-collapse collapse show" aria-labelledby="headingRestore" data-bs-parent="#accordion">
<div class="accordion-body">

<form id="uploadForm" enctype="multipart/form-data">
<div class="row mb-3">
<div class="col-md-8 custom-file">
<input type="file" accept=".txt" class="custom-file-input" name="name" id="name" data-bs-toggle="tooltip" title="Select a configuration backup to upload">
</div>
<div class="col-md-12 themed-grid-col bg-light">Restore configuration from file</div>
</div>
<div class="row mb-3">
<div class="col-md-4">
<button type="submit" class="btn btn-primary" id="restore-btn" value="upload" data-bs-toggle="tooltip" title="Restore configuration from a file">Restore configuration</button>

<form id="uploadForm" enctype="multipart/form-data">
<div class="row mb-3">
<div class="col-md-8 custom-file">
<input type="file" accept=".txt" class="custom-file-input" name="name" id="name" data-bs-toggle="tooltip" title="Select a configuration backup to upload">
</div>
</div>
<div class="row mb-3">
<div class="col-md-4">
<button type="submit" class="btn btn-primary" id="restore-btn" value="upload" data-bs-toggle="tooltip" title="Restore configuration from a file">Restore configuration</button>
</div>
</div>
</form>

<div class="progress">
<div class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>
</div>
</form>

<div class="progress">
<div class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>
</div>

</div>
</div>

</div>
</div>

<script type="text/javascript">
<script>
var swVer = ""
var backup = {};
var progress = 0;
</script>

<script type="text/javascript">
<script>
window.onload = getStatus;

function download(content, mimeType, filename) {
Expand Down Expand Up @@ -266,8 +265,8 @@ <h2 class="accordion-header" id="headingRestore">
console.log( "Selected file: " + fileElement.files[0].name );

let reader = new FileReader();
reader.addEventListener('load', function(e) {
let text = e.target.result;
reader.addEventListener('load', function(e) {
let text = e.target.result;

try {
json = JSON.parse( text );
Expand All @@ -280,7 +279,7 @@ <h2 class="accordion-header" id="headingRestore">
}
} catch (error) {
console.error(error);
showError("Unable to parse configuration file for GravityMon.")
showError("Unable to parse configuration file.")
}
});
reader.readAsText(fileElement.files[0]);
Expand Down Expand Up @@ -317,5 +316,5 @@ <h2 class="accordion-header" id="headingRestore">
<!-- START FOOTER -->

<div class="container themed-container bg-primary text-light row-margin-10">(C) Copyright 2021-23 Magnus Persson</div>
</body>
</body>
</html>
Loading

0 comments on commit 98aa1ac

Please sign in to comment.