Skip to content

Commit

Permalink
Added util directory
Browse files Browse the repository at this point in the history
  • Loading branch information
orlopau committed Dec 2, 2023
1 parent b3c790a commit 71a9efa
Show file tree
Hide file tree
Showing 36 changed files with 34 additions and 82 deletions.
2 changes: 1 addition & 1 deletion code/include/mocks.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "battery.h"
#include "loadcell.h"
#include "millis.h"
#include "util/millis.h"
#include "user_interface.h"
#include <math.h>
#include <string.h>
Expand Down
8 changes: 7 additions & 1 deletion code/notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,10 @@ soldering k12
https://www.aliexpress.com/item/4000456148198.html?spm=a2g0o.cart.0.0.4b184ae4xzGph2&mp=1

tips:
D32, D24, D16, D12, KF, ILS
D32, D24, D16, D12, KF, ILS



## Structure

Use MVC to decouple the view layer.
2 changes: 1 addition & 1 deletion code/src/button.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "millis.h"
#include "util/millis.h"
#include "button.h"

Button::Button(unsigned long debounceDelay, unsigned long doubleClickWaitTime, unsigned long longClickDelay)
Expand Down
52 changes: 0 additions & 52 deletions code/src/embedded/dev/main_display.cpp

This file was deleted.

2 changes: 1 addition & 1 deletion code/src/embedded/u8g_display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <qrcode.h>

#include "u8g_display.h"
#include "formatters.h"
#include "util/formatters.h"
#include "data/bitmaps.h"
#include "constants.h"
#include "data/localization.h"
Expand Down
2 changes: 1 addition & 1 deletion code/src/loadcell.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <cmath>

#include "loadcell.h"
#include "millis.h"
#include "util/millis.h"

DefaultWeightSensor::~DefaultWeightSensor()
{
Expand Down
4 changes: 1 addition & 3 deletions code/src/loadcell.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include "stdint.h"
#include "ring_buffer.h"
#include "util/ring_buffer.h"

class LoadCell
{
Expand Down Expand Up @@ -62,8 +62,6 @@ class DefaultWeightSensor : public WeightSensor
long getRawWeight();

private:
void updateAveraging(long lastWeight, long newWeight);

LoadCell &loadCell;
float weight = 0;
float scale = 1;
Expand Down
2 changes: 1 addition & 1 deletion code/src/mode_manager.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "mode_manager.h"
#include "millis.h"
#include "util/millis.h"

ModeManager::ModeManager(Mode *modes[], const int modeCount, Display &display, UserInput &input, Battery &battery)
: modes(modes), modeCount(modeCount), currentMode(0), inModeChange(false), display(display), input(input), battery(battery),
Expand Down
2 changes: 1 addition & 1 deletion code/src/modes/mode_calibrate.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "mode_calibrate.h"
#include "logger.h"
#include "util/logger.h"
#include "data/localization.h"

#define TAG "MODE-CAL"
Expand Down
2 changes: 1 addition & 1 deletion code/src/modes/mode_calibrate.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "loadcell.h"
#include "user_interface.h"
#include "stopwatch.h"
#include "util/stopwatch.h"
#include "mode.h"

#define DEFAULT_CALIBRATION_WEIGHT 100
Expand Down
2 changes: 1 addition & 1 deletion code/src/modes/mode_espresso.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "loadcell.h"
#include "mode.h"
#include "stopwatch.h"
#include "util/stopwatch.h"
#include "user_interface.h"
#include "regression.h"

Expand Down
2 changes: 1 addition & 1 deletion code/src/modes/mode_recipe.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <cstring>

#include "mode_recipe.h"
#include "millis.h"
#include "util/millis.h"
#include "data/localization.h"

#include "modes/steps/step_switcher.h"
Expand Down
2 changes: 1 addition & 1 deletion code/src/modes/mode_scale.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "mode.h"
#include "loadcell.h"
#include "user_interface.h"
#include "stopwatch.h"
#include "util/stopwatch.h"

class ModeScale : public Mode
{
Expand Down
2 changes: 1 addition & 1 deletion code/src/modes/steps/step_brewing.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "step_brewing.h"
#include "millis.h"
#include "util/millis.h"

RecipeBrewing::RecipeBrewing(RecipeStepState &state, Display &display, UserInput &input, WeightSensor &weightSensor)
: state(state), display(display), input(input), weightSensor(weightSensor)
Expand Down
2 changes: 1 addition & 1 deletion code/src/regression.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <math.h>
#include <climits>

#include "ring_buffer.h"
#include "util/ring_buffer.h"

namespace Regression
{
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion code/test/native/test_button/main.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <unity.h>

#include "button.h"
#include "millis.h"
#include "util/millis.h"

#define DEBOUNCE_DELAY 50
#define DOUBLE_CLICK_WAIT_TIME 200
Expand Down
2 changes: 1 addition & 1 deletion code/test/native/test_default_weight_sensor/main.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <unity.h>

#include "millis.h"
#include "util/millis.h"
#include "button.h"
#include "loadcell.h"

Expand Down
2 changes: 1 addition & 1 deletion code/test/native/test_fifo_queue/main.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "ring_buffer.h"
#include "util/ring_buffer.h"
#include <unity.h>

/*
Expand Down
2 changes: 1 addition & 1 deletion code/test/native/test_mode_espresso/main.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "mocks.h"
#include "modes/mode_espresso.h"
#include "stopwatch.h"
#include "util/stopwatch.h"
#include <unity.h>

#include <chrono>
Expand Down
2 changes: 1 addition & 1 deletion code/test/native/test_mode_manager/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "unity.h"
#include "mode_manager.h"
#include "millis.h"
#include "util/millis.h"
#include "mocks.h"

class MockMode : public Mode
Expand Down
4 changes: 2 additions & 2 deletions code/test/native/test_mode_recipes/main.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <unity.h>
#include "mocks.h"
#include "stopwatch.h"
#include "util/stopwatch.h"
#include "modes/mode_recipe.h"
#include "millis.h"
#include "util/millis.h"

static Stopwatch *stopwatch;
static MockWeightSensor *weightSensor;
Expand Down
2 changes: 1 addition & 1 deletion code/test/native/test_mode_scale/main.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <unity.h>
#include "modes/mode_scale.h"
#include "mocks.h"
#include "stopwatch.h"
#include "util/stopwatch.h"

#include <chrono>
#include <thread>
Expand Down
2 changes: 1 addition & 1 deletion code/test/native/test_step_brewing/main.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "millis.h"
#include "util/millis.h"
#include "mocks.h"
#include "modes/steps/step_brewing.h"
#include <unity.h>
Expand Down
2 changes: 1 addition & 1 deletion code/test/native/test_step_config_ratio/main.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "millis.h"
#include "util/millis.h"
#include "mocks.h"
#include "modes/steps/step_config_ratio.h"
#include <unity.h>
Expand Down
2 changes: 1 addition & 1 deletion code/test/native/test_step_config_weight/main.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "millis.h"
#include "util/millis.h"
#include "mocks.h"
#include "modes/steps/step_config_weight.h"
#include <unity.h>
Expand Down
2 changes: 1 addition & 1 deletion code/test/native/test_step_prepare/main.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "millis.h"
#include "util/millis.h"
#include "mocks.h"
#include "modes/steps/step_prepare.h"
#include <unity.h>
Expand Down
2 changes: 1 addition & 1 deletion code/test/native/test_step_switcher/main.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "millis.h"
#include "util/millis.h"
#include "mocks.h"
#include "modes/steps/step_switcher.h"
#include <unity.h>
Expand Down
2 changes: 1 addition & 1 deletion code/test/native/test_stopwatch/stopwatch.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "unity.h"
#include "stopwatch.h"
#include "util/stopwatch.h"

#include <chrono>
#include <thread>
Expand Down

0 comments on commit 71a9efa

Please sign in to comment.