diff --git a/source/Core/BSP/BSP.h b/source/Core/BSP/BSP.h index fce1fe2e..0caf21bb 100644 --- a/source/Core/BSP/BSP.h +++ b/source/Core/BSP/BSP.h @@ -2,7 +2,7 @@ #include "BSP_Power.h" #include "BSP_QC.h" #include "Defines.h" -#include "Model_Config.h" +#include "configuration.h" #include #include /* diff --git a/source/Core/BSP/MHP30/BSP.cpp b/source/Core/BSP/MHP30/BSP.cpp index ffff19ee..1561ec06 100644 --- a/source/Core/BSP/MHP30/BSP.cpp +++ b/source/Core/BSP/MHP30/BSP.cpp @@ -2,7 +2,6 @@ #include "BSP.h" #include "I2C_Wrapper.hpp" -#include "Model_Config.h" #include "Pins.h" #include "Setup.h" #include "TipThermoModel.h" @@ -13,6 +12,7 @@ #include "main.hpp" #include + WS2812 ws2812; volatile uint16_t PWMSafetyTimer = 0; volatile uint8_t pendingPWM = 0; diff --git a/source/Core/BSP/MHP30/Model_Config.h b/source/Core/BSP/MHP30/Model_Config.h deleted file mode 100644 index ecc0460c..00000000 --- a/source/Core/BSP/MHP30/Model_Config.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Model_Config.h - * - * Created on: 25 Jul 2020 - * Author: Ralim - */ - -#ifndef BSP_MINIWARE_MODEL_CONFIG_H_ -#define BSP_MINIWARE_MODEL_CONFIG_H_ -/* - * Lookup for mapping features <-> Models - */ - -#ifndef MODEL_MHP30 -#error "No model defined!" -#endif - -#ifdef MODEL_MHP30 -#define ACCEL_MSA -#define POW_PD -#define TEMP_NTC -#define I2C_SOFT -#define BATTFILTERDEPTH 8 -#define OLED_I2CBB -#define ACCEL_EXITS_ON_MOVEMENT -#endif -#ifdef ACCEL_EXITS_ON_MOVEMENT -#define NO_SLEEP_MODE -#endif -#endif /* BSP_MINIWARE_MODEL_CONFIG_H_ */ diff --git a/source/Core/BSP/MHP30/Pins.h b/source/Core/BSP/MHP30/Pins.h index d649c14b..610322ed 100644 --- a/source/Core/BSP/MHP30/Pins.h +++ b/source/Core/BSP/MHP30/Pins.h @@ -7,7 +7,7 @@ #ifndef BSP_MINIWARE_PINS_H_ #define BSP_MINIWARE_PINS_H_ -#include "Model_Config.h" +#include "configuration.h" // MHP30 pin map #define KEY_B_Pin GPIO_PIN_0 diff --git a/source/Core/BSP/MHP30/Power.cpp b/source/Core/BSP/MHP30/Power.cpp index 72a64017..80455d2b 100644 --- a/source/Core/BSP/MHP30/Power.cpp +++ b/source/Core/BSP/MHP30/Power.cpp @@ -1,9 +1,9 @@ #include "BSP.h" #include "BSP_Power.h" -#include "Model_Config.h" #include "Pins.h" #include "QC3.h" #include "Settings.h" +#include "configuration.h" #include "fusb_user.h" #include "fusbpd.h" #include "int_n.h" diff --git a/source/Core/BSP/MHP30/QC_GPIO.cpp b/source/Core/BSP/MHP30/QC_GPIO.cpp index b48ba1f3..8adc603b 100644 --- a/source/Core/BSP/MHP30/QC_GPIO.cpp +++ b/source/Core/BSP/MHP30/QC_GPIO.cpp @@ -5,11 +5,12 @@ * Author: Ralim */ #include "BSP.h" -#include "Model_Config.h" #include "Pins.h" #include "QC3.h" #include "Settings.h" +#include "configuration.h" #include "stm32f1xx_hal.h" + #ifdef POW_QC void QC_DPlusZero_Six() { HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, GPIO_PIN_RESET); // pull down D+ diff --git a/source/Core/BSP/MHP30/Software_I2C.h b/source/Core/BSP/MHP30/Software_I2C.h index 99f3a2e9..411362f5 100644 --- a/source/Core/BSP/MHP30/Software_I2C.h +++ b/source/Core/BSP/MHP30/Software_I2C.h @@ -8,7 +8,7 @@ #ifndef BSP_MINIWARE_SOFTWARE_I2C_H_ #define BSP_MINIWARE_SOFTWARE_I2C_H_ #include "BSP.h" -#include "Model_Config.h" +#include "configuration.h" #include "stm32f1xx_hal.h" #ifdef I2C_SOFT diff --git a/source/Core/BSP/MHP30/configuration.h b/source/Core/BSP/MHP30/configuration.h new file mode 100644 index 00000000..b6f4104c --- /dev/null +++ b/source/Core/BSP/MHP30/configuration.h @@ -0,0 +1,157 @@ +#ifndef CONFIGURATION_H_ +#define CONFIGURATION_H_ +#include "Settings.h" +#include "configuration.h" +#include +/** + * Configuration.h + * Define here your default pre settings for TS80 or TS100 + * + */ + +//=========================================================================== +//============================= Default Settings ============================ +//=========================================================================== +/** + * Default soldering temp is 320.0 C + * Temperature the iron sleeps at - default 150.0 C + */ + +#define SLEEP_TEMP 150 // Default sleep temperature +#define BOOST_TEMP 420 // Default boost temp. +#define BOOST_MODE_ENABLED 1 // 0: Disable 1: Enable + +/** + * Blink the temperature on the cooling screen when its > 50C + */ +#define COOLING_TEMP_BLINK 0 // 0: Disable 1: Enable + +/** + * How many seconds/minutes we wait until going to sleep/shutdown. + * Values -> SLEEP_TIME * 10; i.e. 5*10 = 50 Seconds! + */ +#define SLEEP_TIME 5 // x10 Seconds +#define SHUTDOWN_TIME 10 // Minutes + +/** + * Auto start off for safety. + * Pissible values are: + * 0 - none + * 1 - Soldering Temperature + * 2 - Sleep Temperature + * 3 - Sleep Off Temperature + */ +#define AUTO_START_MODE 0 // Default to none + +/** + * Locking Mode + * When in soldering mode a long press on both keys toggle the lock of the buttons + * Possible values are: + * 0 - Desactivated + * 1 - Lock except boost + * 2 - Full lock + */ +#define LOCKING_MODE 0 // Default to desactivated for safety + +/** + * OLED Orientation + * + */ +#define ORIENTATION_MODE 0 // 0: Right 1:Left 2:Automatic - Default right +#define REVERSE_BUTTON_TEMP_CHANGE 0 // 0:Default 1:Reverse - Reverse the plus and minus button assigment for temperature change + +/** + * Temp change settings + */ +#define TEMP_CHANGE_SHORT_STEP 1 // Default temp change short step +1 +#define TEMP_CHANGE_LONG_STEP 10 // Default temp change long step +10 +#define TEMP_CHANGE_SHORT_STEP_MAX 50 // Temp change short step MAX value +#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 + +#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 + +/** + * OLED Orientation Sensitivity on Automatic mode! + * Motion Sensitivity <0=Off 1=Least Sensitive 9=Most Sensitive> + */ +#define SENSITIVITY 7 // Default 7 + +/** + * Detailed soldering screen + * Detailed idle screen (off for first time users) + */ +#define DETAILED_SOLDERING 0 // 0: Disable 1: Enable - Default 0 +#define DETAILED_IDLE 0 // 0: Disable 1: Enable - Default 0 + +#define THERMAL_RUNAWAY_TIME_SEC 20 +#define THERMAL_RUNAWAY_TEMP_C 20 + +#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_MHP30 268500 // 268.5 Kilo-ohms -> Measured +#define OP_AMP_Rin_MHP30 1600 // 1.6 Kilo-ohms -> Measured + +#define OP_AMP_GAIN_STAGE_MHP30 (1 + (OP_AMP_Rf_MHP30 / OP_AMP_Rin_MHP30)) +// Deriving the Voltage div: +// Vin_max = (3.3*(r1+r2))/(r2) +// vdiv = (32768*4)/(vin_max*10) + +#ifndef MODEL_MHP30 +#error "No model defined!" +#endif + +#ifdef MODEL_MHP30 +#define SOLDERING_TEMP 200 // Default soldering temp is 200.0 °C +#define VOLTAGE_DIV 360 // Default for MHP30 +#define PID_POWER_LIMIT 65 // Sets the max pwm power limit +#define CALIBRATION_OFFSET 0 // the adc offset in uV - MHP compensates automagically +#define POWER_LIMIT 65 // 65 watts default power limit +#define MAX_POWER_LIMIT 65 // +#define POWER_LIMIT_STEPS 1 // +#define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_MHP30 // +#define USB_PD_VMAX 20 // Maximum voltage for PD to negotiate +#define MODEL_HAS_DCDC // Has inductor to current filter +#define PID_TIM_HZ (16) // +#define THERMAL_MASS_OVERSHOOTS // We have overshoot so reverse direction of compensation +#define MAX_TEMP_C 300 // Max soldering temp selectable °C +#define MAX_TEMP_F 570 // Max soldering temp selectable °F +#define MIN_TEMP_C 10 // Min soldering temp selectable °C +#define MIN_TEMP_F 60 // Min soldering temp selectable °F +#define MIN_BOOST_TEMP_C 150 // The min settable temp for boost mode °C +#define MIN_BOOST_TEMP_F 300 // The min settable temp for boost mode °F +#define NO_DISPLAY_ROTATE // Disable OLED rotation by accel +#define SLEW_LIMIT 50 // Limit to 3.0 Watts per 64ms pid loop update rate slew rate +#define ACCEL_MSA +#define POW_PD +#define TEMP_NTC +#define I2C_SOFT +#define BATTFILTERDEPTH 8 +#define OLED_I2CBB +#define ACCEL_EXITS_ON_MOVEMENT + +#define HARDWARE_MAX_WATTAGE_X10 650 +#define TIP_THERMAL_MASS 65 // TODO, needs refinement +#define tipResistance 60 // x10 ohms, ~6 typical +#endif + +#ifdef ACCEL_EXITS_ON_MOVEMENT +#define NO_SLEEP_MODE +#endif +#endif diff --git a/source/Core/BSP/MHP30/fusb_user.cpp b/source/Core/BSP/MHP30/fusb_user.cpp index bddf5a72..e3dfa13c 100644 --- a/source/Core/BSP/MHP30/fusb_user.cpp +++ b/source/Core/BSP/MHP30/fusb_user.cpp @@ -1,4 +1,4 @@ -#include "Model_Config.h" +#include "configuration.h" #ifdef POW_PD #include "BSP.h" #include "I2C_Wrapper.hpp" diff --git a/source/Core/BSP/MHP30/preRTOS.cpp b/source/Core/BSP/MHP30/preRTOS.cpp index 44ac337f..7efd4da8 100644 --- a/source/Core/BSP/MHP30/preRTOS.cpp +++ b/source/Core/BSP/MHP30/preRTOS.cpp @@ -7,11 +7,12 @@ #include "BSP.h" #include "I2CBB.hpp" -#include "Model_Config.h" #include "Pins.h" #include "Setup.h" +#include "configuration.h" #include "fusbpd.h" #include + void preRToSInit() { /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ diff --git a/source/Core/BSP/Miniware/BSP.cpp b/source/Core/BSP/Miniware/BSP.cpp index 378c1b9d..327cf05f 100644 --- a/source/Core/BSP/Miniware/BSP.cpp +++ b/source/Core/BSP/Miniware/BSP.cpp @@ -2,7 +2,6 @@ #include "BSP.h" #include "I2C_Wrapper.hpp" -#include "Model_Config.h" #include "Pins.h" #include "Setup.h" #include "TipThermoModel.h" @@ -10,6 +9,7 @@ #include "history.hpp" #include "main.hpp" #include + volatile uint16_t PWMSafetyTimer = 0; volatile uint8_t pendingPWM = 0; diff --git a/source/Core/BSP/Miniware/Model_Config.h b/source/Core/BSP/Miniware/Model_Config.h deleted file mode 100644 index 27ea0899..00000000 --- a/source/Core/BSP/Miniware/Model_Config.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Model_Config.h - * - * Created on: 25 Jul 2020 - * Author: Ralim - */ - -#ifndef BSP_MINIWARE_MODEL_CONFIG_H_ -#define BSP_MINIWARE_MODEL_CONFIG_H_ -/* - * Lookup for mapping features <-> Models - */ - -#if defined(MODEL_TS100) + defined(MODEL_TS80) + defined(MODEL_TS80P) > 1 -#error "Multiple models defined!" -#elif defined(MODEL_TS100) + defined(MODEL_TS80) + defined(MODEL_TS80P) == 0 -#error "No model defined!" -#endif - -#ifdef MODEL_TS100 -#define POW_DC -#define ACCEL_MMA -#define ACCEL_LIS -#define TEMP_TMP36 -#define BATTFILTERDEPTH 32 -#endif - -#ifdef MODEL_TS80 -#define ACCEL_LIS -#define POW_QC -#define TEMP_TMP36 -#define LIS_ORI_FLIP -#define OLED_FLIP -#define BATTFILTERDEPTH 8 -#endif - -#ifdef MODEL_TS80P -#define ACCEL_LIS -#define ACCEL_MSA -#define POW_PD -#define POW_QC -#define TEMP_NTC -#define I2C_SOFT -#define LIS_ORI_FLIP -#define OLED_FLIP -#define BATTFILTERDEPTH 8 -#endif - -#endif /* BSP_MINIWARE_MODEL_CONFIG_H_ */ diff --git a/source/Core/BSP/Miniware/Pins.h b/source/Core/BSP/Miniware/Pins.h index 4e4c9085..e8851d26 100644 --- a/source/Core/BSP/Miniware/Pins.h +++ b/source/Core/BSP/Miniware/Pins.h @@ -7,7 +7,7 @@ #ifndef BSP_MINIWARE_PINS_H_ #define BSP_MINIWARE_PINS_H_ -#include "Model_Config.h" +#include "configuration.h" #ifdef MODEL_TS100 diff --git a/source/Core/BSP/Miniware/Power.cpp b/source/Core/BSP/Miniware/Power.cpp index 2fcbdcb1..5aa42b42 100644 --- a/source/Core/BSP/Miniware/Power.cpp +++ b/source/Core/BSP/Miniware/Power.cpp @@ -1,9 +1,9 @@ #include "BSP.h" #include "BSP_Power.h" -#include "Model_Config.h" #include "Pins.h" #include "QC3.h" #include "Settings.h" +#include "configuration.h" #include "fusb_user.h" #include "fusbpd.h" #include "int_n.h" diff --git a/source/Core/BSP/Miniware/QC_GPIO.cpp b/source/Core/BSP/Miniware/QC_GPIO.cpp index 288e61ac..84edd842 100644 --- a/source/Core/BSP/Miniware/QC_GPIO.cpp +++ b/source/Core/BSP/Miniware/QC_GPIO.cpp @@ -5,11 +5,12 @@ * Author: Ralim */ #include "BSP.h" -#include "Model_Config.h" #include "Pins.h" #include "QC3.h" #include "Settings.h" +#include "configuration.h" #include "stm32f1xx_hal.h" + #ifdef POW_QC void QC_DPlusZero_Six() { HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, GPIO_PIN_RESET); // pull down D+ diff --git a/source/Core/BSP/Miniware/Software_I2C.h b/source/Core/BSP/Miniware/Software_I2C.h index 214faa5a..ceca0131 100644 --- a/source/Core/BSP/Miniware/Software_I2C.h +++ b/source/Core/BSP/Miniware/Software_I2C.h @@ -8,7 +8,7 @@ #ifndef BSP_MINIWARE_SOFTWARE_I2C_H_ #define BSP_MINIWARE_SOFTWARE_I2C_H_ #include "BSP.h" -#include "Model_Config.h" +#include "configuration.h" #include "stm32f1xx_hal.h" #ifdef I2C_SOFT diff --git a/source/Core/Inc/configuration.h b/source/Core/BSP/Miniware/configuration.h similarity index 63% rename from source/Core/Inc/configuration.h rename to source/Core/BSP/Miniware/configuration.h index d4864556..6f5ab5a4 100644 --- a/source/Core/Inc/configuration.h +++ b/source/Core/BSP/Miniware/configuration.h @@ -1,10 +1,10 @@ -#pragma once -#include "Model_Config.h" +#ifndef CONFIGURATION_H_ +#define CONFIGURATION_H_ #include "Settings.h" #include /** * Configuration.h - * Define here your default pre settings for TS80 or TS100 + * Define here your default pre settings for TS80(P) or TS100 * */ @@ -57,7 +57,7 @@ * */ #define ORIENTATION_MODE 0 // 0: Right 1:Left 2:Automatic - Default right -#define REVERSE_BUTTON_TEMP_CHANGE 0 // 0:Default 1:Reverse - Reverse the plus and minus button assigment for temperatur change +#define REVERSE_BUTTON_TEMP_CHANGE 0 // 0:Default 1:Reverse - Reverse the plus and minus button assigment for temperature change /** * Temp change settings @@ -114,14 +114,16 @@ #define OP_AMP_GAIN_STAGE_TS80 (1 + (OP_AMP_Rf_TS80 / OP_AMP_Rin_TS80)) -#define OP_AMP_Rf_MHP30 268500 // 268.5 Kilo-ohms -> Measured -#define OP_AMP_Rin_MHP30 1600 // 1.6 Kilo-ohms -> Measured - -#define OP_AMP_GAIN_STAGE_MHP30 (1 + (OP_AMP_Rf_MHP30 / OP_AMP_Rin_MHP30)) // Deriving the Voltage div: // Vin_max = (3.3*(r1+r2))/(r2) // vdiv = (32768*4)/(vin_max*10) +#if defined(MODEL_TS100) + defined(MODEL_TS80) + defined(MODEL_TS80P) > 1 +#error "Multiple models defined!" +#elif defined(MODEL_TS100) + defined(MODEL_TS80) + defined(MODEL_TS80P) == 0 +#error "No model defined!" +#endif + #ifdef MODEL_TS100 #define SOLDERING_TEMP 320 // Default soldering temp is 320.0 °C #define VOLTAGE_DIV 467 // 467 - Default divider from schematic @@ -140,26 +142,10 @@ #define MIN_TEMP_F 60 // Min soldering temp selectable °F #define MIN_BOOST_TEMP_C 250 // The min settable temp for boost mode °C #define MIN_BOOST_TEMP_F 480 // The min settable temp for boost mode °F -#endif - -#ifdef MODEL_Pinecil -#define SOLDERING_TEMP 320 // Default soldering temp is 320.0 °C -#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 -#define PID_TIM_HZ (8) // Tick rate of the PID loop -#define MAX_TEMP_C 450 // Max soldering temp selectable °C -#define MAX_TEMP_F 850 // Max soldering temp selectable °F -#define MIN_TEMP_C 10 // Min soldering temp selectable °C -#define MIN_TEMP_F 60 // Min soldering temp selectable °F -#define MIN_BOOST_TEMP_C 250 // The min settable temp for boost mode °C -#define MIN_BOOST_TEMP_F 480 // The min settable temp for boost mode °F +#define POW_DC +#define ACCEL_MMA +#define ACCEL_LIS +#define TEMP_TMP36 #endif #ifdef MODEL_TS80 @@ -180,6 +166,11 @@ #define MIN_TEMP_F 60 // Min soldering temp selectable °F #define MIN_BOOST_TEMP_C 250 // The min settable temp for boost mode °C #define MIN_BOOST_TEMP_F 480 // The min settable temp for boost mode °F +#define ACCEL_LIS +#define POW_QC +#define TEMP_TMP36 +#define LIS_ORI_FLIP +#define OLED_FLIP #endif #ifdef MODEL_TS80P @@ -200,64 +191,31 @@ #define MIN_TEMP_F 60 // Min soldering temp selectable °F #define MIN_BOOST_TEMP_C 250 // The min settable temp for boost mode °C #define MIN_BOOST_TEMP_F 480 // The min settable temp for boost mode °F - -#endif - -#ifdef MODEL_MHP30 -#define SOLDERING_TEMP 200 // Default soldering temp is 200.0 °C -#define VOLTAGE_DIV 360 // Default for MHP30 -#define PID_POWER_LIMIT 65 // Sets the max pwm power limit -#define CALIBRATION_OFFSET 0 // the adc offset in uV - MHP compensates automagically -#define POWER_LIMIT 65 // 65 watts default power limit -#define MAX_POWER_LIMIT 65 // -#define POWER_LIMIT_STEPS 1 // -#define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_MHP30 // -#define USB_PD_VMAX 20 // Maximum voltage for PD to negotiate -#define MODEL_HAS_DCDC // Has inductor to current filter -#define PID_TIM_HZ (16) // -#define THERMAL_MASS_OVERSHOOTS // We have overshoot so reverse direction of compensation -#define MAX_TEMP_C 300 // Max soldering temp selectable °C -#define MAX_TEMP_F 570 // Max soldering temp selectable °F -#define MIN_TEMP_C 10 // Min soldering temp selectable °C -#define MIN_TEMP_F 60 // Min soldering temp selectable °F -#define MIN_BOOST_TEMP_C 150 // The min settable temp for boost mode °C -#define MIN_BOOST_TEMP_F 300 // The min settable temp for boost mode °F -#define NO_DISPLAY_ROTATE // Disable OLED rotation by accel -#define SLEW_LIMIT 50 // Limit to 3.0 Watts per 64ms pid loop update rate slew rate +#define ACCEL_LIS +#define ACCEL_MSA +#define POW_PD +#define POW_QC +#define TEMP_NTC +#define I2C_SOFT +#define LIS_ORI_FLIP +#define OLED_FLIP #endif #ifdef MODEL_TS100 -const int32_t HARDWARE_MAX_WATTAGE_X10 = 750; -const int32_t TIP_THERMAL_MASS = 65; // X10 watts to raise 1 deg C in 1 second -const uint8_t tipResistance = 75; // x10 ohms, 7.5 typical for ts100 tips -#endif - -#ifdef MODEL_Pinecil -const int32_t HARDWARE_MAX_WATTAGE_X10 = 750; -const int32_t TIP_THERMAL_MASS = 65; // X10 watts to raise 1 deg C in 1 second -const uint8_t tipResistance = 75; // x10 ohms, 7.5 typical for ts100 tips +#define HARDWARE_MAX_WATTAGE_X10 750 +#define TIP_THERMAL_MASS 65 // X10 watts to raise 1 deg C in 1 second +#define tipResistance 75 // x10 ohms, 7.5 typical for ts100 tips #endif #ifdef MODEL_TS80 -const int32_t HARDWARE_MAX_WATTAGE_X10 = 180; -const uint32_t TIP_THERMAL_MASS = 40; -const uint8_t tipResistance = 45; // x10 ohms, 4.5 typical for ts80 tips +#define HARDWARE_MAX_WATTAGE_X10 180 +#define TIP_THERMAL_MASS 40 +#define tipResistance 45 // x10 ohms, 4.5 typical for ts80 tips #endif #ifdef MODEL_TS80P -const int32_t HARDWARE_MAX_WATTAGE_X10 = 300; -const uint32_t TIP_THERMAL_MASS = 40; -const uint8_t tipResistance = 45; // x10 ohms, 4.5 typical for ts80 tips +#define HARDWARE_MAX_WATTAGE_X10 300 +#define TIP_THERMAL_MASS 40 +#define tipResistance 45 // x10 ohms, 4.5 typical for ts80 tips #endif - -#ifdef MODEL_MHP30 -const int32_t HARDWARE_MAX_WATTAGE_X10 = 650; -const uint32_t TIP_THERMAL_MASS = 65; // TODO, needs refinement -const uint8_t tipResistance = 60; // x10 ohms, ~6 typical #endif - -#ifdef POW_QC_20V -#define QC_SETTINGS_MAX 3 -#else -#define QC_SETTINGS_MAX 2 -#endif \ No newline at end of file diff --git a/source/Core/BSP/Miniware/fusb_user.cpp b/source/Core/BSP/Miniware/fusb_user.cpp index c37bb5ff..13454db7 100644 --- a/source/Core/BSP/Miniware/fusb_user.cpp +++ b/source/Core/BSP/Miniware/fusb_user.cpp @@ -1,4 +1,4 @@ -#include "Model_Config.h" +#include "configuration.h" #ifdef POW_PD #include "BSP.h" #include "I2CBB.hpp" diff --git a/source/Core/BSP/Miniware/preRTOS.cpp b/source/Core/BSP/Miniware/preRTOS.cpp index 5d9852b4..931df14e 100644 --- a/source/Core/BSP/Miniware/preRTOS.cpp +++ b/source/Core/BSP/Miniware/preRTOS.cpp @@ -7,11 +7,12 @@ #include "BSP.h" #include "I2CBB.hpp" -#include "Model_Config.h" #include "Pins.h" #include "Setup.h" +#include "configuration.h" #include "fusbpd.h" #include + void preRToSInit() { /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ diff --git a/source/Core/BSP/Pine64/Model_Config.h b/source/Core/BSP/Pine64/Model_Config.h deleted file mode 100644 index 1a63894e..00000000 --- a/source/Core/BSP/Pine64/Model_Config.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Model_Config.h - * - * Created on: 25 Jul 2020 - * Author: Ralim - */ - -#ifndef BSP_PINE64_MODEL_CONFIG_H_ -#define BSP_PINE64_MODEL_CONFIG_H_ -/* - * Lookup for mapping features <-> Models - */ - -#if defined(MODEL_Pinecil) == 0 -#error "No model defined!" -#endif - -#ifdef MODEL_Pinecil -#define POW_PD -#define POW_QC -#define POW_DC -#define POW_QC_20V -#define ENABLE_QC2 -#define TEMP_TMP36 -#define ACCEL_BMA -#define ACCEL_SC7 -#define HALL_SENSOR -#define HALL_SI7210 -#define BATTFILTERDEPTH 32 -#define DEBUG_UART_OUTPUT -#endif - -#endif /* BSP_PINE64_MODEL_CONFIG_H_ */ diff --git a/source/Core/BSP/Pine64/Power.cpp b/source/Core/BSP/Pine64/Power.cpp index 22fe53e0..5e60764e 100644 --- a/source/Core/BSP/Pine64/Power.cpp +++ b/source/Core/BSP/Pine64/Power.cpp @@ -1,9 +1,9 @@ #include "BSP.h" #include "BSP_Power.h" -#include "Model_Config.h" #include "Pins.h" #include "QC3.h" #include "Settings.h" +#include "configuration.h" #include "fusb_user.h" #include "fusbpd.h" #include "int_n.h" diff --git a/source/Core/BSP/Pine64/configuration.h b/source/Core/BSP/Pine64/configuration.h new file mode 100644 index 00000000..9d8c7f75 --- /dev/null +++ b/source/Core/BSP/Pine64/configuration.h @@ -0,0 +1,151 @@ +#ifndef CONFIGURATION_H_ +#define CONFIGURATION_H_ +#include "Settings.h" +#include +/** + * Configuration.h + * Define here your default pre settings for Pinecil + * + */ + +//=========================================================================== +//============================= Default Settings ============================ +//=========================================================================== +/** + * Default soldering temp is 320.0 C + * Temperature the iron sleeps at - default 150.0 C + */ + +#define SLEEP_TEMP 150 // Default sleep temperature +#define BOOST_TEMP 420 // Default boost temp. +#define BOOST_MODE_ENABLED 1 // 0: Disable 1: Enable + +/** + * Blink the temperature on the cooling screen when its > 50C + */ +#define COOLING_TEMP_BLINK 0 // 0: Disable 1: Enable + +/** + * How many seconds/minutes we wait until going to sleep/shutdown. + * Values -> SLEEP_TIME * 10; i.e. 5*10 = 50 Seconds! + */ +#define SLEEP_TIME 5 // x10 Seconds +#define SHUTDOWN_TIME 10 // Minutes + +/** + * Auto start off for safety. + * Pissible values are: + * 0 - none + * 1 - Soldering Temperature + * 2 - Sleep Temperature + * 3 - Sleep Off Temperature + */ +#define AUTO_START_MODE 0 // Default to none + +/** + * Locking Mode + * When in soldering mode a long press on both keys toggle the lock of the buttons + * Possible values are: + * 0 - Desactivated + * 1 - Lock except boost + * 2 - Full lock + */ +#define LOCKING_MODE 0 // Default to desactivated for safety + +/** + * OLED Orientation + * + */ +#define ORIENTATION_MODE 0 // 0: Right 1:Left 2:Automatic - Default right +#define REVERSE_BUTTON_TEMP_CHANGE 0 // 0:Default 1:Reverse - Reverse the plus and minus button assigment for temperature change + +/** + * Temp change settings + */ +#define TEMP_CHANGE_SHORT_STEP 1 // Default temp change short step +1 +#define TEMP_CHANGE_LONG_STEP 10 // Default temp change long step +10 +#define TEMP_CHANGE_SHORT_STEP_MAX 50 // Temp change short step MAX value +#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 + +#ifdef MODEL_Pinecil +#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 + +/** + * OLED Orientation Sensitivity on Automatic mode! + * Motion Sensitivity <0=Off 1=Least Sensitive 9=Most Sensitive> + */ +#define SENSITIVITY 7 // Default 7 + +/** + * Detailed soldering screen + * Detailed idle screen (off for first time users) + */ +#define DETAILED_SOLDERING 0 // 0: Disable 1: Enable - Default 0 +#define DETAILED_IDLE 0 // 0: Disable 1: Enable - Default 0 + +#define THERMAL_RUNAWAY_TIME_SEC 20 +#define THERMAL_RUNAWAY_TEMP_C 20 + +#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_Pinecil 750 * 1000 // 750 Kilo-ohms -> From schematic, R1 +#define OP_AMP_Rin_Pinecil 2370 // 2.37 Kilo-ohms -> From schematic, R2 + +#define OP_AMP_GAIN_STAGE_PINECIL (1 + (OP_AMP_Rf_Pinecil / OP_AMP_Rin_Pinecil)) + +#if defined(MODEL_Pinecil) == 0 +#error "No model defined!" +#endif + +#ifdef MODEL_Pinecil +#define SOLDERING_TEMP 320 // Default soldering temp is 320.0 °C +#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_PINECIL // Uses Pinecil resistors +#define TEMP_uV_LOOKUP_HAKKO // Use Hakko lookup table +#define USB_PD_VMAX 20 // Maximum voltage for PD to negotiate +#define PID_TIM_HZ (8) // Tick rate of the PID loop +#define MAX_TEMP_C 450 // Max soldering temp selectable °C +#define MAX_TEMP_F 850 // Max soldering temp selectable °F +#define MIN_TEMP_C 10 // Min soldering temp selectable °C +#define MIN_TEMP_F 60 // Min soldering temp selectable °F +#define MIN_BOOST_TEMP_C 250 // The min settable temp for boost mode °C +#define MIN_BOOST_TEMP_F 480 // The min settable temp for boost mode °F + +#define POW_PD +#define POW_QC +#define POW_DC +#define POW_QC_20V +#define ENABLE_QC2 +#define TEMP_TMP36 +#define ACCEL_BMA +#define ACCEL_SC7 +#define HALL_SENSOR +#define HALL_SI7210 +#define DEBUG_UART_OUTPUT + +#define HARDWARE_MAX_WATTAGE_X10 750 +#define TIP_THERMAL_MASS 65 // X10 watts to raise 1 deg C in 1 second +#define tipResistance 75 // x10 ohms, 7.5 typical for Pinecil tips +#endif +#endif diff --git a/source/Core/BSP/Pine64/fusb_user.cpp b/source/Core/BSP/Pine64/fusb_user.cpp index 2d566399..5b9137ec 100644 --- a/source/Core/BSP/Pine64/fusb_user.cpp +++ b/source/Core/BSP/Pine64/fusb_user.cpp @@ -1,4 +1,4 @@ -#include "Model_Config.h" +#include "configuration.h" #ifdef POW_PD #include "BSP.h" #include "I2C_Wrapper.hpp" diff --git a/source/Core/Drivers/FUSB302/fusbpd.cpp b/source/Core/Drivers/FUSB302/fusbpd.cpp index f8a74155..18920c03 100644 --- a/source/Core/Drivers/FUSB302/fusbpd.cpp +++ b/source/Core/Drivers/FUSB302/fusbpd.cpp @@ -4,7 +4,7 @@ * Created on: 13 Jun 2020 * Author: Ralim */ -#include "Model_Config.h" +#include "configuration.h" #ifdef POW_PD #include "BSP.h" #include "I2CBB.hpp" diff --git a/source/Core/Drivers/I2CBB.cpp b/source/Core/Drivers/I2CBB.cpp index f90b09fc..b1fd6b7d 100644 --- a/source/Core/Drivers/I2CBB.cpp +++ b/source/Core/Drivers/I2CBB.cpp @@ -4,7 +4,7 @@ * Created on: 12 Jun 2020 * Author: Ralim */ -#include "Model_Config.h" +#include "configuration.h" #ifdef I2C_SOFT #include "FreeRTOS.h" #include diff --git a/source/Core/Drivers/I2CBB.hpp b/source/Core/Drivers/I2CBB.hpp index cf2e4df1..a66d5954 100644 --- a/source/Core/Drivers/I2CBB.hpp +++ b/source/Core/Drivers/I2CBB.hpp @@ -7,7 +7,7 @@ #ifndef BSP_MINIWARE_I2CBB_HPP_ #define BSP_MINIWARE_I2CBB_HPP_ -#include "Model_Config.h" +#include "configuration.h" #ifdef I2C_SOFT #include "BSP.h" #include "FreeRTOS.h" diff --git a/source/Core/Drivers/OLED.hpp b/source/Core/Drivers/OLED.hpp index f9d63a5a..a13e02a3 100644 --- a/source/Core/Drivers/OLED.hpp +++ b/source/Core/Drivers/OLED.hpp @@ -10,7 +10,7 @@ #ifndef OLED_HPP_ #define OLED_HPP_ #include "Font.h" -#include "Model_Config.h" +#include "configuration.h" #include #include #include diff --git a/source/Core/Src/Settings.cpp b/source/Core/Src/Settings.cpp index b838ba76..bf4f4ef4 100644 --- a/source/Core/Src/Settings.cpp +++ b/source/Core/Src/Settings.cpp @@ -15,6 +15,12 @@ #include // for memset bool sanitiseSettings(); +#ifdef POW_QC_20V +#define QC_SETTINGS_MAX 3 +#else +#define QC_SETTINGS_MAX 2 +#endif + /* * This struct must be a multiple of 2 bytes as it is saved / restored from * flash in uint16_t chunks diff --git a/source/Core/Threads/MOVThread.cpp b/source/Core/Threads/MOVThread.cpp index c929e8bd..e0e7c86e 100644 --- a/source/Core/Threads/MOVThread.cpp +++ b/source/Core/Threads/MOVThread.cpp @@ -12,17 +12,18 @@ #include "LIS2DH12.hpp" #include "MMA8652FC.hpp" #include "MSA301.h" -#include "Model_Config.h" #include "QC3.h" #include "SC7A20.hpp" #include "Settings.h" #include "TipThermoModel.h" #include "cmsis_os.h" +#include "configuration.h" #include "history.hpp" #include "main.hpp" #include "power.hpp" #include "stdlib.h" #include "task.h" + #define MOVFilter 8 uint8_t accelInit = 0; TickType_t lastMovementTime = 0;