From 77fd9f6a2d05896e397ac71946a4a6def30c24d5 Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" Date: Sun, 4 Apr 2021 22:48:41 +1000 Subject: [PATCH] Move configuration into inc --- source/Core/Drivers/OLED.cpp | 2 +- source/Core/Drivers/TipThermoModel.cpp | 2 +- source/{ => Core/Inc}/configuration.h | 92 ++++++++++++++------------ source/Core/Inc/power.hpp | 2 +- source/Core/Src/Settings.cpp | 2 +- source/Core/Src/gui.cpp | 2 +- source/Core/Threads/GUIThread.cpp | 2 +- 7 files changed, 54 insertions(+), 50 deletions(-) rename source/{ => Core/Inc}/configuration.h (53%) diff --git a/source/Core/Drivers/OLED.cpp b/source/Core/Drivers/OLED.cpp index 7adf77a7..8aa8ae8a 100644 --- a/source/Core/Drivers/OLED.cpp +++ b/source/Core/Drivers/OLED.cpp @@ -5,9 +5,9 @@ * Author: Ben V. Brown */ -#include "../../configuration.h" #include "Translation.h" #include "cmsis_os.h" +#include "configuration.h" #include #include #include diff --git a/source/Core/Drivers/TipThermoModel.cpp b/source/Core/Drivers/TipThermoModel.cpp index 29bf1e7a..edf97fbc 100644 --- a/source/Core/Drivers/TipThermoModel.cpp +++ b/source/Core/Drivers/TipThermoModel.cpp @@ -6,9 +6,9 @@ */ #include "TipThermoModel.h" -#include "../../configuration.h" #include "BSP.h" #include "Settings.h" +#include "configuration.h" #include "main.hpp" #include "power.hpp" /* diff --git a/source/configuration.h b/source/Core/Inc/configuration.h similarity index 53% rename from source/configuration.h rename to source/Core/Inc/configuration.h index 43d76ce1..6de93bcb 100644 --- a/source/configuration.h +++ b/source/Core/Inc/configuration.h @@ -68,18 +68,18 @@ #define TEMP_CHANGE_LONG_STEP_MAX 90 // Temp change long step MAX value /* Power pulse for keeping power banks awake*/ -#define POWER_PULSE_INCREMENT 1 -#define POWER_PULSE_MAX 100 // x10 max watts -#define POWER_PULSE_WAIT_MAX 9 // 9*2.5s = 22.5 seconds -#define POWER_PULSE_DURATION_MAX 9 // 9*250ms = 2.25 seconds +#define POWER_PULSE_INCREMENT 1 +#define POWER_PULSE_MAX 100 // x10 max watts +#define POWER_PULSE_WAIT_MAX 9 // 9*2.5s = 22.5 seconds +#define POWER_PULSE_DURATION_MAX 9 // 9*250ms = 2.25 seconds #ifdef MODEL_TS100 #define POWER_PULSE_DEFAULT 0 #else #define POWER_PULSE_DEFAULT 5 #endif -#define POWER_PULSE_WAIT_DEFAULT 4; // Default rate of the power pulse: 4*2500 = 10000 ms = 10 s -#define POWER_PULSE_DURATION_DEFAULT 1; // Default duration of the power pulse: 1*250 = 250 ms +#define POWER_PULSE_WAIT_DEFAULT 4; // Default rate of the power pulse: 4*2500 = 10000 ms = 10 s +#define POWER_PULSE_DURATION_DEFAULT 1; // Default duration of the power pulse: 1*250 = 250 ms /** * OLED Orientation Sensitivity on Automatic mode! @@ -94,12 +94,12 @@ #define DETAILED_SOLDERING 0 // 0: Disable 1: Enable - Default 0 #define DETAILED_IDLE 0 // 0: Disable 1: Enable - Default 0 -#define CUT_OUT_SETTING 0 // default to no cut-off voltage -#define RECOM_VOL_CELL 33 // Minimum voltage per cell (Recommended 3.3V (33)) -#define TEMPERATURE_INF 0 // default to 0 -#define DESCRIPTION_SCROLL_SPEED 0 // 0: Slow 1: Fast - default to slow -#define ANIMATION_LOOP 1 // 0: off 1: on -#define ANIMATION_SPEED settingOffSpeed_t::MEDIUM +#define CUT_OUT_SETTING 0 // default to no cut-off voltage +#define RECOM_VOL_CELL 33 // Minimum voltage per cell (Recommended 3.3V (33)) +#define TEMPERATURE_INF 0 // default to 0 +#define DESCRIPTION_SCROLL_SPEED 0 // 0: Slow 1: Fast - default to slow +#define ANIMATION_LOOP 1 // 0: off 1: on +#define ANIMATION_SPEED settingOffSpeed_t::MEDIUM #define OP_AMP_Rf_TS100 750 * 1000 // 750 Kilo-ohms -> From schematic, R1 #define OP_AMP_Rin_TS100 2370 // 2.37 Kilo-ohms -> From schematic, R2 @@ -116,47 +116,51 @@ // vdiv = (32768*4)/(vin_max*10) #ifdef MODEL_TS100 -#define VOLTAGE_DIV 467 // 467 - Default divider from schematic -#define CALIBRATION_OFFSET 900 // 900 - Default adc offset in uV -#define PID_POWER_LIMIT 70 // Sets the max pwm power limit -#define POWER_LIMIT 0 // 0 watts default limit -#define MAX_POWER_LIMIT 65 // -#define POWER_LIMIT_STEPS 5 // -#define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_TS100 -#define TEMP_uV_LOOKUP_HAKKO +#define VOLTAGE_DIV 467 // 467 - Default divider from schematic +#define CALIBRATION_OFFSET 900 // 900 - Default adc offset in uV +#define PID_POWER_LIMIT 70 // Sets the max pwm power limit +#define POWER_LIMIT 0 // 0 watts default limit +#define MAX_POWER_LIMIT 65 // +#define POWER_LIMIT_STEPS 5 // +#define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_TS100 // +#define TEMP_uV_LOOKUP_HAKKO // +#define USB_PD_VMAX 20 // Maximum voltage for PD to negotiate #endif #ifdef MODEL_Pinecil -#define VOLTAGE_DIV 467 // 467 - Default divider from schematic -#define CALIBRATION_OFFSET 900 // 900 - Default adc offset in uV -#define PID_POWER_LIMIT 70 // Sets the max pwm power limit -#define POWER_LIMIT 0 // 0 watts default limit -#define MAX_POWER_LIMIT 65 // -#define POWER_LIMIT_STEPS 5 // -#define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_TS100 -#define TEMP_uV_LOOKUP_HAKKO +#define VOLTAGE_DIV 467 // 467 - Default divider from schematic +#define CALIBRATION_OFFSET 900 // 900 - Default adc offset in uV +#define PID_POWER_LIMIT 70 // Sets the max pwm power limit +#define POWER_LIMIT 0 // 0 watts default limit +#define MAX_POWER_LIMIT 65 // +#define POWER_LIMIT_STEPS 5 // +#define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_TS100 // Uses TS100 resistors +#define TEMP_uV_LOOKUP_HAKKO // Use Hakko lookup table +#define USB_PD_VMAX 20 // Maximum voltage for PD to negotiate #endif #ifdef MODEL_TS80 -#define VOLTAGE_DIV 780 // Default divider from schematic -#define PID_POWER_LIMIT 24 // Sets the max pwm power limit -#define CALIBRATION_OFFSET 900 // the adc offset in uV -#define POWER_LIMIT 24 // 24 watts default power limit -#define MAX_POWER_LIMIT 30 // -#define POWER_LIMIT_STEPS 2 -#define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_TS80 -#define TEMP_uV_LOOKUP_TS80 +#define VOLTAGE_DIV 780 // Default divider from schematic +#define PID_POWER_LIMIT 24 // Sets the max pwm power limit +#define CALIBRATION_OFFSET 900 // the adc offset in uV +#define POWER_LIMIT 24 // 24 watts default power limit +#define MAX_POWER_LIMIT 30 // +#define POWER_LIMIT_STEPS 2 // +#define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_TS80 // +#define TEMP_uV_LOOKUP_TS80 // +#define USB_PD_VMAX 12 // Maximum voltage for PD to negotiate #endif #ifdef MODEL_TS80P -#define VOLTAGE_DIV 650 // Default for TS80P with slightly different resistors -#define PID_POWER_LIMIT 35 // Sets the max pwm power limit -#define CALIBRATION_OFFSET 1500 // the adc offset in uV -#define POWER_LIMIT 30 // 30 watts default power limit -#define MAX_POWER_LIMIT 35 // -#define POWER_LIMIT_STEPS 2 -#define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_TS80 -#define TEMP_uV_LOOKUP_TS80 +#define VOLTAGE_DIV 650 // Default for TS80P with slightly different resistors +#define PID_POWER_LIMIT 35 // Sets the max pwm power limit +#define CALIBRATION_OFFSET 1500 // the adc offset in uV +#define POWER_LIMIT 30 // 30 watts default power limit +#define MAX_POWER_LIMIT 35 // +#define POWER_LIMIT_STEPS 2 // +#define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_TS80 // +#define TEMP_uV_LOOKUP_TS80 // +#define USB_PD_VMAX 12 // Maximum voltage for PD to negotiate #endif #ifdef MODEL_TS100 diff --git a/source/Core/Inc/power.hpp b/source/Core/Inc/power.hpp index ba25ef82..786fb979 100644 --- a/source/Core/Inc/power.hpp +++ b/source/Core/Inc/power.hpp @@ -5,8 +5,8 @@ * Authors: Ben V. Brown, David Hilton (David's Idea) */ -#include "../../configuration.h" #include "BSP.h" +#include "configuration.h" #include "expMovingAverage.h" #include "stdint.h" #include diff --git a/source/Core/Src/Settings.cpp b/source/Core/Src/Settings.cpp index 70c112f8..358323f3 100644 --- a/source/Core/Src/Settings.cpp +++ b/source/Core/Src/Settings.cpp @@ -9,9 +9,9 @@ */ #include "Settings.h" -#include "../../configuration.h" #include "BSP.h" #include "Setup.h" +#include "configuration.h" #include "string.h" volatile systemSettingsType systemSettings; diff --git a/source/Core/Src/gui.cpp b/source/Core/Src/gui.cpp index 733e1899..779efc79 100644 --- a/source/Core/Src/gui.cpp +++ b/source/Core/Src/gui.cpp @@ -6,11 +6,11 @@ */ #include "gui.hpp" -#include "../../configuration.h" #include "Buttons.hpp" #include "TipThermoModel.h" #include "Translation.h" #include "cmsis_os.h" +#include "configuration.h" #include "main.hpp" void gui_Menu(const menuitem *menu); diff --git a/source/Core/Threads/GUIThread.cpp b/source/Core/Threads/GUIThread.cpp index 7f049aff..df2649a5 100644 --- a/source/Core/Threads/GUIThread.cpp +++ b/source/Core/Threads/GUIThread.cpp @@ -7,7 +7,6 @@ extern "C" { #include "FreeRTOSConfig.h" } -#include "../../configuration.h" #include "Buttons.hpp" #include "I2CBB.hpp" #include "LIS2DH12.hpp" @@ -15,6 +14,7 @@ extern "C" { #include "TipThermoModel.h" #include "Translation.h" #include "cmsis_os.h" +#include "configuration.h" #include "main.hpp" #include "stdlib.h" #include "string.h"