Skip to content

Commit

Permalink
Dev (#402)
Browse files Browse the repository at this point in the history
- Additional startup checks( ie brew switch ON = system enters fail
state).
- Refactored descale mode(needs more testing re time vs water tank
levels)
- Refactored and improved temperature control based on pump flow
volumes(still needs additional work but already way more promising than
how it was before).
- Nextion fixes(discovered some doubling page numbers which might
introduce inconsistencies)
- HOPEFULLY better boiler fill detection.
- Simplified the PIO tasks list( deleted opto).
- Lots of other fixes.
  • Loading branch information
Zer0-bit authored Feb 1, 2023
2 parents 7657f4f + 4bc1f89 commit fe60d9a
Show file tree
Hide file tree
Showing 32 changed files with 581 additions and 418 deletions.
39 changes: 37 additions & 2 deletions .github/workflows/compile-sketch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '14'
node-version: "14"

- name: Install eclint
run: |
Expand All @@ -47,7 +47,7 @@ jobs:
- name: Build the main project
run: |
~/.platformio/penv/bin/platformio run -e opto-dfu
~/.platformio/penv/bin/platformio run -e gaggia-lego-stlink
- name: Build scales
run: |
Expand All @@ -56,3 +56,38 @@ jobs:
- name: Run tests
run: |
~/.platformio/penv/bin/platformio test -e test
static-analysis:
runs-on: ubuntu-latest
timeout-minutes: 15

steps:
- name: Checkout master
uses: actions/checkout@v2

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

- name: Install Platformio
run: |
python3 -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)"
- name: Run static analysis on main project
if: success() || failure()
run: |
~/.platformio/penv/bin/platformio check -e gaggia-lego-stlink --fail-on-defect medium --fail-on-defect high
- name: Run static analysis on scales
if: success() || failure()
run: |
~/.platformio/penv/bin/platformio check -e scales-calibration-dfu --fail-on-defect medium --fail-on-defect high
- name: Run static analysis on uart-stm
if: success() || failure()
run: |
~/.platformio/penv/bin/platformio check -e uart-stm --fail-on-defect medium --fail-on-defect high
- name: Run static analysis on uart-esp
if: success() || failure()
run: |
~/.platformio/penv/bin/platformio check -e uart-esp --fail-on-defect medium --fail-on-defect high
Binary file modified lcd-hmi/nextion-lcd.HMI
Binary file not shown.
12 changes: 6 additions & 6 deletions lib/Common/profiling_phases.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
//----------------------------------------------------------------------//

ShotSnapshot buildShotSnapshot(uint32_t timeInShot, SensorState& state, CurrentPhase& phase) {
float targetFlow = (phase.getType() == PHASE_TYPE_FLOW) ? phase.getTarget() : phase.getRestriction();
float targetPressure = (phase.getType() == PHASE_TYPE_PRESSURE) ? phase.getTarget() : phase.getRestriction();
float targetFlow = (phase.getType() == PHASE_TYPE::PHASE_TYPE_FLOW) ? phase.getTarget() : phase.getRestriction();
float targetPressure = (phase.getType() == PHASE_TYPE::PHASE_TYPE_PRESSURE) ? phase.getTarget() : phase.getRestriction();

return ShotSnapshot{
.timeInShot=timeInShot,
Expand Down Expand Up @@ -43,20 +43,20 @@ bool Phase::isStopConditionReached(SensorState& currentState, uint32_t timeInSho
//----------------------------------------------------------------------//
bool PhaseStopConditions::isReached(SensorState& state, long timeInShot, ShotSnapshot stateAtPhaseStart) const {
float flow = state.weight > 0.4f ? state.weightFlow : state.smoothedPumpFlow;
float stopDelta = flow / 2.f;
float stopDelta = flow * (state.shotWeight / 100.f);

return (time >= 0L && timeInShot - stateAtPhaseStart.timeInShot >= (uint32_t) time) ||
(weight > 0.f && state.shotWeight > weight - stopDelta) ||
(pressureAbove > 0.f && state.pressure > pressureAbove) ||
(pressureBelow > 0.f && state.pressure < pressureBelow) ||
(pressureAbove > 0.f && state.smoothedPressure > pressureAbove) ||
(pressureBelow > 0.f && state.smoothedPressure < pressureBelow) ||
(waterPumpedInPhase > 0.f && state.waterPumped - stateAtPhaseStart.waterPumped > waterPumpedInPhase - stopDelta) ||
(flowAbove > 0.f && state.smoothedPumpFlow > flowAbove) ||
(flowBelow > 0.f && state.smoothedPumpFlow < flowBelow);
}

bool GlobalStopConditions::isReached(SensorState& state, long timeInShot) {
float flow = state.weight > 0.4f ? state.weightFlow : state.smoothedPumpFlow;
float stopDelta = flow / 2.f;
float stopDelta = flow * (state.shotWeight / 100.f);

return (weight > 0.f && state.shotWeight > weight - stopDelta) ||
(waterPumped > 0.f && state.waterPumped > waterPumped) ||
Expand Down
8 changes: 4 additions & 4 deletions lib/Common/profiling_phases.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "sensors_state.h"
#include <vector>

enum PHASE_TYPE {
enum class PHASE_TYPE {
PHASE_TYPE_FLOW,
PHASE_TYPE_PRESSURE
};
Expand Down Expand Up @@ -42,9 +42,9 @@ struct Transition {
TransitionCurve curve;
long time;

Transition(): start(-1), end(-1), curve(INSTANT), time(0) {}
Transition(float start, float end, TransitionCurve curve = LINEAR, long time = 0): start(start), end(end), curve(curve), time(time) {}
Transition(float value): start(value), end(value), curve(INSTANT), time(0) {}
Transition(): start(-1), end(-1), curve(TransitionCurve::INSTANT), time(0) {}
Transition(float start, float end, TransitionCurve curve = TransitionCurve::LINEAR, long time = 0): start(start), end(end), curve(curve), time(time) {}
Transition(float value): start(value), end(value), curve(TransitionCurve::INSTANT), time(0) {}
};

struct Phase {
Expand Down
5 changes: 3 additions & 2 deletions lib/Common/sensors_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
struct SensorState {
float temperature;
float pressure;
float smoothedPressure;
bool isPressureFalling;
bool isPressureFallingFast;
bool isPressureRising;
Expand All @@ -13,11 +12,13 @@ struct SensorState {
bool isPumpFlowFallingFast;
bool isSteamForgottenON;
float pumpFlow;
float smoothedPumpFlow;
float waterPumped;
float weightFlow;
float weight;
float shotWeight;
float smoothedPressure;
float smoothedPumpFlow;
float smoothedWeightFlow;
};

struct SensorStateSnapshot {
Expand Down
2 changes: 1 addition & 1 deletion lib/Common/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "Arduino.h"

enum TransitionCurve {
enum class TransitionCurve {
EASE_IN_OUT,
EASE_IN,
EASE_OUT,
Expand Down
Binary file modified nextion-basic-lcd.tft
Binary file not shown.
Binary file modified nextion-discovery-lcd.tft
Binary file not shown.
38 changes: 31 additions & 7 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,43 +11,55 @@
[platformio]
; default_envs = pcb-forced-predictive-scales-stlink

[env:opto-stlink]
[env]
check_tool = clangtidy, cppcheck
check_skip_packages = yes
check_flags =
clangtidy: --checks=-*,cert-*,clang-analyzer-* --fix
cppcheck: --enable=all --std=c++11 --suppress=*:*/.pio/* --suppress=*:*/lib/* --suppress=missingIncludeSystem --suppress=unmatchedSuppression --suppress=missingInclude --suppress=unusedFunction
platform_packages = tool-cppcheck@1.260.0

[env:gaggia-lego-stlink]
extends = blackpill-core
lib_deps =
${blackpill-core.lib_deps}
adafruit/MAX6675 library@1.1.0
build_flags =
${blackpill-core.build_flags}
-DLEGO_VALVE_RELAY

[env:opto-dfu]
[env:gaggia-lego-dfu]
extends = blackpill-core
lib_deps =
${blackpill-core.lib_deps}
adafruit/MAX6675 library@1.1.0
build_flags =
${blackpill-core.build_flags}
-DLEGO_VALVE_RELAY
upload_protocol = dfu

[env:relay-stlink]
[env:non-gaggia-lego-stlink]
extends = blackpill-core
lib_deps =
${blackpill-core.lib_deps}
adafruit/MAX6675 library@1.1.0
build_flags =
${blackpill-core.build_flags}
-DLEGO_VALVE_RELAY
-DINDEPENDENT_DIMMER

[env:relay-dfu]
[env:non-gaggia-lego-dfu]
extends = blackpill-core
lib_deps =
${blackpill-core.lib_deps}
adafruit/MAX6675 library@1.1.0
build_flags =
${blackpill-core.build_flags}
-DLEGO_VALVE_RELAY
-DINDEPENDENT_DIMMER
upload_protocol = dfu

[env:pcb-stlink]
[env:all-pcb-stlink]
extends = blackpill-core
lib_deps =
${blackpill-core.lib_deps}
Expand All @@ -56,7 +68,7 @@ build_flags =
${blackpill-core.build_flags}
-DSINGLE_BOARD

[env:pcb-forced-predictive-scales-stlink]
[env:all-pcb-forced-predictive-stlink]
extends = blackpill-core
lib_deps =
${blackpill-core.lib_deps}
Expand All @@ -65,7 +77,7 @@ build_type = debug
build_flags =
${blackpill-core.build_flags}
-DSINGLE_BOARD
-DFORCE_PREDICTIVE_SCALES
-DFORCE_PREDICTIVE_SCALES=1

[env:scales-calibration-stlink]
extends = blackpill-core
Expand All @@ -76,6 +88,8 @@ build_flags =
-DPIN_SERIAL2_TX=PA2
; Uncomment if using Vas' DUAL HX711 Board
; -DSINGLE_HX711_BOARD
check_patterns =
scales-calibration/*.ino

[env:scales-calibration-dfu]
extends = env:scales-calibration-stlink
Expand Down Expand Up @@ -126,6 +140,8 @@ build_flags =
-O0
build_unflags =
-Os
check_patterns =
src

[env:test]
platform = native
Expand Down Expand Up @@ -157,6 +173,8 @@ build_flags =
-DTX1=17 ; for ESP32DEV
; -DRX1=18
; -DTX1=17
check_patterns =
webserver/src

lib_deps =
https://github.com/me-no-dev/AsyncTCP.git
Expand Down Expand Up @@ -194,6 +212,9 @@ build_flags =
build_unflags =
-std=gnu++11

check_patterns =
uart-esp

[env:uart-stm]
framework = arduino
platform = ststm32@15.4.1
Expand Down Expand Up @@ -224,3 +245,6 @@ build_flags =
-O0
build_unflags =
-Os

check_patterns =
uart-stm
Loading

0 comments on commit fe60d9a

Please sign in to comment.