Skip to content

Commit

Permalink
Merge branch 'master' into jeremypoulter/core_partition
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremypoulter authored May 9, 2023
2 parents 2fb1253 + 98e2273 commit 6877db0
Show file tree
Hide file tree
Showing 43 changed files with 373 additions and 6,823 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
run: echo "github.ref_name = '${{ github.ref_name }}'"

build:
name: Build ${{ matrix.env }} with ${{ matrix.gui.name }}
runs-on: ubuntu-latest

strategy:
Expand Down Expand Up @@ -133,6 +134,7 @@ jobs:
path: .pio/build/${{ matrix.env }}/firmware.bin

release:
name: Upload release assets
runs-on: ubuntu-latest
needs: build
if: github.ref_name == 'master' || startsWith(github.ref_name, 'v')
Expand Down
27 changes: 25 additions & 2 deletions .github/workflows/divert_sim.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@

name: Build OpenEVSE divert simulator

# Allow dependabot to update checks
permissions:
checks: write
actions: write
contents: write
issues: read
pull-requests: write

on:
push:
Expand All @@ -13,6 +18,7 @@ on:

jobs:
build:
name: Build and test divert_sim
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -73,11 +79,21 @@ jobs:
with:
name: divert_sim
path: OpenEVSE_WiFi/divert_sim/divert_sim


- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip' # caching pip dependencies

- name: Install dependencies
run: pip install -r OpenEVSE_WiFi/divert_sim/requirements.txt

- name: run tests
run: |
cd OpenEVSE_WiFi/divert_sim
bash runall.sh
mkdir -p output
pytest -v --color=yes --code-highlight yes --junit-xml=output/test_results.xml
- name : Upload test results
uses: actions/upload-artifact@v3
Expand All @@ -86,3 +102,10 @@ jobs:
path: |
OpenEVSE_WiFi/divert_sim/output
OpenEVSE_WiFi/divert_sim/view.html
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action/composite@v2
if: always()
with:
junit_files: OpenEVSE_WiFi/divert_sim/output/*.xml
check_name: Test Results
1 change: 1 addition & 0 deletions api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ paths:
rapi_connected: 1
amp: 0
pilot: 32
max_current: 32
temp1: 282
temp2: -2560
temp3: -2560
Expand Down
5 changes: 4 additions & 1 deletion divert_sim/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ ARDUINO_OBJ := \
Stream.o \
Wire.o \
WMath.o \
WString.o
WString.o \
Injection.o

EPOXY_FS_OBJ := \
EpoxyFS.o \
Expand Down Expand Up @@ -116,6 +117,8 @@ VPATH := \
. \
../src \
$(EPOXY_CORE_PATH) \
$(EPOXY_CORE_PATH)/epoxy_test/Injection \
$(EPOXY_CORE_PATH)/epoxy_test/Script \
$(ARDUINO_LIB_DIR)/OpenEVSE_Lib/src \
$(ARDUINO_LIB_DIR)/MicroTasks/src \
$(ARDUINO_LIB_DIR)/ConfigJson/src \
Expand Down
12 changes: 12 additions & 0 deletions divert_sim/divert_sim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#include <MicroTasks.h>
#include <EpoxyFS.h>

#include <epoxy_test/ArduinoTest.h>

using namespace aria::csv;

EventLog eventLog;
Expand All @@ -35,6 +37,7 @@ int solar_col = 1;
int voltage_col = 1;

time_t simulated_time = 0;
time_t last_time = 0;

bool kw = false;

Expand Down Expand Up @@ -192,6 +195,15 @@ int main(int argc, char** argv)
col++;
}

if(last_time != 0)
{
int delta = simulated_time - last_time;
if(delta > 0) {
EpoxyTest::add_millis(delta * 1000);
}
}
last_time = simulated_time;

divert.update_state();
MicroTask.update();

Expand Down
1 change: 1 addition & 0 deletions divert_sim/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pytest
37 changes: 0 additions & 37 deletions divert_sim/runall.sh

This file was deleted.

Loading

0 comments on commit 6877db0

Please sign in to comment.