mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Merge remote-tracking branch 'origin/dev' into magic
This commit is contained in:
@@ -6,119 +6,87 @@
|
||||
*/
|
||||
|
||||
#ifndef BSP_MINIWARE_PINS_H_
|
||||
#define BSP_MINIWARE_PINS_H_
|
||||
#include "configuration.h"
|
||||
#define BSP_MINIWARE_PINS_H_
|
||||
#include "configuration.h"
|
||||
|
||||
#ifdef MODEL_TS100
|
||||
#ifdef MODEL_TS100
|
||||
|
||||
#define KEY_B_Pin GPIO_PIN_6
|
||||
#define KEY_B_GPIO_Port GPIOA
|
||||
#define TMP36_INPUT_Pin GPIO_PIN_7
|
||||
#define TMP36_INPUT_GPIO_Port GPIOA
|
||||
#define TMP36_ADC1_CHANNEL ADC_CHANNEL_7
|
||||
#define TMP36_ADC2_CHANNEL ADC_CHANNEL_7
|
||||
#define TIP_TEMP_Pin GPIO_PIN_0
|
||||
#define TIP_TEMP_GPIO_Port GPIOB
|
||||
#define TIP_TEMP_ADC1_CHANNEL ADC_CHANNEL_8
|
||||
#define TIP_TEMP_ADC2_CHANNEL ADC_CHANNEL_8
|
||||
#define VIN_Pin GPIO_PIN_1
|
||||
#define VIN_GPIO_Port GPIOB
|
||||
#define VIN_ADC1_CHANNEL ADC_CHANNEL_9
|
||||
#define VIN_ADC2_CHANNEL ADC_CHANNEL_9
|
||||
#define OLED_RESET_Pin GPIO_PIN_8
|
||||
#define OLED_RESET_GPIO_Port GPIOA
|
||||
#define KEY_A_Pin GPIO_PIN_9
|
||||
#define KEY_A_GPIO_Port GPIOA
|
||||
#define INT_Orientation_Pin GPIO_PIN_3
|
||||
#define INT_Orientation_GPIO_Port GPIOB
|
||||
#define PWM_Out_Pin GPIO_PIN_4
|
||||
#define PWM_Out_GPIO_Port GPIOB
|
||||
#define PWM_Out_CHANNEL TIM_CHANNEL_1
|
||||
#define PWM_Out_CCR
|
||||
#define INT_Movement_Pin GPIO_PIN_5
|
||||
#define INT_Movement_GPIO_Port GPIOB
|
||||
#define SCL_Pin GPIO_PIN_6
|
||||
#define SCL_GPIO_Port GPIOB
|
||||
#define SDA_Pin GPIO_PIN_7
|
||||
#define SDA_GPIO_Port GPIOB
|
||||
#endif
|
||||
#ifdef MODEL_TS80
|
||||
// TS80 pin map
|
||||
#define KEY_B_Pin GPIO_PIN_0
|
||||
#define KEY_B_GPIO_Port GPIOB
|
||||
#define TMP36_INPUT_Pin GPIO_PIN_4
|
||||
#define TMP36_INPUT_GPIO_Port GPIOA
|
||||
#define TMP36_ADC1_CHANNEL ADC_CHANNEL_4
|
||||
#define TMP36_ADC2_CHANNEL ADC_CHANNEL_4
|
||||
#define TIP_TEMP_Pin GPIO_PIN_3
|
||||
#define TIP_TEMP_GPIO_Port GPIOA
|
||||
#define TIP_TEMP_ADC1_CHANNEL ADC_CHANNEL_3
|
||||
#define TIP_TEMP_ADC2_CHANNEL ADC_CHANNEL_3
|
||||
#define KEY_B_Pin GPIO_PIN_6
|
||||
#define KEY_B_GPIO_Port GPIOA
|
||||
#define TMP36_INPUT_Pin GPIO_PIN_7
|
||||
#define TMP36_INPUT_GPIO_Port GPIOA
|
||||
#define TMP36_ADC1_CHANNEL ADC_CHANNEL_7
|
||||
#define TMP36_ADC2_CHANNEL ADC_CHANNEL_7
|
||||
#define TIP_TEMP_Pin GPIO_PIN_0
|
||||
#define TIP_TEMP_GPIO_Port GPIOB
|
||||
#define TIP_TEMP_ADC1_CHANNEL ADC_CHANNEL_8
|
||||
#define TIP_TEMP_ADC2_CHANNEL ADC_CHANNEL_8
|
||||
#define VIN_Pin GPIO_PIN_1
|
||||
#define VIN_GPIO_Port GPIOB
|
||||
#define VIN_ADC1_CHANNEL ADC_CHANNEL_9
|
||||
#define VIN_ADC2_CHANNEL ADC_CHANNEL_9
|
||||
#define OLED_RESET_Pin GPIO_PIN_8
|
||||
#define OLED_RESET_GPIO_Port GPIOA
|
||||
#define KEY_A_Pin GPIO_PIN_9
|
||||
#define KEY_A_GPIO_Port GPIOA
|
||||
#define INT_Orientation_Pin GPIO_PIN_3
|
||||
#define INT_Orientation_GPIO_Port GPIOB
|
||||
#define PWM_Out_Pin GPIO_PIN_4
|
||||
#define PWM_Out_GPIO_Port GPIOB
|
||||
#define PWM_Out_CHANNEL TIM_CHANNEL_1
|
||||
#define PWM_Out_CCR
|
||||
#define INT_Movement_Pin GPIO_PIN_5
|
||||
#define INT_Movement_GPIO_Port GPIOB
|
||||
#define SCL_Pin GPIO_PIN_6
|
||||
#define SCL_GPIO_Port GPIOB
|
||||
#define SDA_Pin GPIO_PIN_7
|
||||
#define SDA_GPIO_Port GPIOB
|
||||
#endif
|
||||
|
||||
#define VIN_Pin GPIO_PIN_2
|
||||
#define VIN_GPIO_Port GPIOA
|
||||
#define VIN_ADC1_CHANNEL ADC_CHANNEL_2
|
||||
#define VIN_ADC2_CHANNEL ADC_CHANNEL_2
|
||||
#define OLED_RESET_Pin GPIO_PIN_15
|
||||
#define OLED_RESET_GPIO_Port GPIOA
|
||||
#define KEY_A_Pin GPIO_PIN_1
|
||||
#define KEY_A_GPIO_Port GPIOB
|
||||
#define INT_Orientation_Pin GPIO_PIN_4
|
||||
#define INT_Orientation_GPIO_Port GPIOB
|
||||
#define PWM_Out_Pin GPIO_PIN_6
|
||||
#define PWM_Out_GPIO_Port GPIOA
|
||||
#define PWM_Out_CHANNEL TIM_CHANNEL_1
|
||||
#define INT_Movement_Pin GPIO_PIN_5
|
||||
#define INT_Movement_GPIO_Port GPIOB
|
||||
#define SCL_Pin GPIO_PIN_6
|
||||
#define SCL_GPIO_Port GPIOB
|
||||
#define SDA_Pin GPIO_PIN_7
|
||||
#define SDA_GPIO_Port GPIOB
|
||||
#define SCL2_Pin GPIO_PIN_5
|
||||
#define SCL2_GPIO_Port GPIOA
|
||||
#define SDA2_Pin GPIO_PIN_1
|
||||
#define SDA2_GPIO_Port GPIOA
|
||||
#if defined(MODEL_TS80) + defined(MODEL_TS80P) > 0
|
||||
// TS80 & TS80P pin map
|
||||
#define KEY_B_Pin GPIO_PIN_0
|
||||
#define KEY_B_GPIO_Port GPIOB
|
||||
#define TMP36_INPUT_Pin GPIO_PIN_4
|
||||
#define TMP36_INPUT_GPIO_Port GPIOA
|
||||
#define TMP36_ADC1_CHANNEL ADC_CHANNEL_4
|
||||
#define TMP36_ADC2_CHANNEL ADC_CHANNEL_4
|
||||
#define TIP_TEMP_Pin GPIO_PIN_3
|
||||
#define TIP_TEMP_GPIO_Port GPIOA
|
||||
#define TIP_TEMP_ADC1_CHANNEL ADC_CHANNEL_3
|
||||
#define TIP_TEMP_ADC2_CHANNEL ADC_CHANNEL_3
|
||||
|
||||
#endif
|
||||
#ifdef MODEL_TS80P
|
||||
// TS80P pin map
|
||||
#define KEY_B_Pin GPIO_PIN_0
|
||||
#define KEY_B_GPIO_Port GPIOB
|
||||
#define TMP36_INPUT_Pin GPIO_PIN_4
|
||||
#define TMP36_INPUT_GPIO_Port GPIOA
|
||||
#define TMP36_ADC1_CHANNEL ADC_CHANNEL_4
|
||||
#define TMP36_ADC2_CHANNEL ADC_CHANNEL_4
|
||||
#define TIP_TEMP_Pin GPIO_PIN_3
|
||||
#define TIP_TEMP_GPIO_Port GPIOA
|
||||
#define TIP_TEMP_ADC1_CHANNEL ADC_CHANNEL_3
|
||||
#define TIP_TEMP_ADC2_CHANNEL ADC_CHANNEL_3
|
||||
#define VIN_Pin GPIO_PIN_2
|
||||
#define VIN_GPIO_Port GPIOA
|
||||
#define VIN_ADC1_CHANNEL ADC_CHANNEL_2
|
||||
#define VIN_ADC2_CHANNEL ADC_CHANNEL_2
|
||||
#define OLED_RESET_Pin GPIO_PIN_15
|
||||
#define OLED_RESET_GPIO_Port GPIOA
|
||||
#define KEY_A_Pin GPIO_PIN_1
|
||||
#define KEY_A_GPIO_Port GPIOB
|
||||
#define INT_Orientation_Pin GPIO_PIN_4
|
||||
#define INT_Orientation_GPIO_Port GPIOB
|
||||
#define PWM_Out_Pin GPIO_PIN_6
|
||||
#define PWM_Out_GPIO_Port GPIOA
|
||||
#define PWM_Out_CHANNEL TIM_CHANNEL_1
|
||||
#define INT_Movement_Pin GPIO_PIN_5
|
||||
#define INT_Movement_GPIO_Port GPIOB
|
||||
#define SCL_Pin GPIO_PIN_6
|
||||
#define SCL_GPIO_Port GPIOB
|
||||
#define SDA_Pin GPIO_PIN_7
|
||||
#define SDA_GPIO_Port GPIOB
|
||||
#define SCL2_Pin GPIO_PIN_5
|
||||
#define SCL2_GPIO_Port GPIOA
|
||||
#define SDA2_Pin GPIO_PIN_1
|
||||
#define SDA2_GPIO_Port GPIOA
|
||||
|
||||
#define VIN_Pin GPIO_PIN_2
|
||||
#define VIN_GPIO_Port GPIOA
|
||||
#define VIN_ADC1_CHANNEL ADC_CHANNEL_2
|
||||
#define VIN_ADC2_CHANNEL ADC_CHANNEL_2
|
||||
#define OLED_RESET_Pin GPIO_PIN_15
|
||||
#define OLED_RESET_GPIO_Port GPIOA
|
||||
#define KEY_A_Pin GPIO_PIN_1
|
||||
#define KEY_A_GPIO_Port GPIOB
|
||||
#define INT_Orientation_Pin GPIO_PIN_4
|
||||
#define INT_Orientation_GPIO_Port GPIOB
|
||||
#define PWM_Out_Pin GPIO_PIN_6
|
||||
#define PWM_Out_GPIO_Port GPIOA
|
||||
#define PWM_Out_CHANNEL TIM_CHANNEL_1
|
||||
#define INT_Movement_Pin GPIO_PIN_5
|
||||
#define INT_Movement_GPIO_Port GPIOB
|
||||
#define SCL_Pin GPIO_PIN_6
|
||||
#define SCL_GPIO_Port GPIOB
|
||||
#define SDA_Pin GPIO_PIN_7
|
||||
#define SDA_GPIO_Port GPIOB
|
||||
#define SCL2_Pin GPIO_PIN_5
|
||||
#define SCL2_GPIO_Port GPIOA
|
||||
#define SDA2_Pin GPIO_PIN_1
|
||||
#define SDA2_GPIO_Port GPIOA
|
||||
#define INT_PD_Pin GPIO_PIN_9
|
||||
#define INT_PD_GPIO_Port GPIOA
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#ifdef MODEL_TS80P
|
||||
// TS80P pin map
|
||||
#define INT_PD_Pin GPIO_PIN_9
|
||||
#define INT_PD_GPIO_Port GPIOA
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* BSP_MINIWARE_PINS_H_ */
|
||||
|
||||
@@ -22,11 +22,7 @@ void power_check() {
|
||||
}
|
||||
|
||||
bool getIsPoweredByDCIN() {
|
||||
#ifdef MODEL_TS80
|
||||
return false;
|
||||
#endif
|
||||
|
||||
#ifdef MODEL_TS80P
|
||||
#if defined(MODEL_TS80) + defined(MODEL_TS80P) > 0
|
||||
return false;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,236 +1,208 @@
|
||||
#ifndef CONFIGURATION_H_
|
||||
#define CONFIGURATION_H_
|
||||
#include "Settings.h"
|
||||
#include <stdint.h>
|
||||
/**
|
||||
* Configuration.h
|
||||
* Define here your default pre settings for TS80(P) or TS100
|
||||
*
|
||||
*/
|
||||
#define CONFIGURATION_H_
|
||||
#include "Settings.h"
|
||||
#include <stdint.h>
|
||||
/**
|
||||
* Configuration.h
|
||||
* Define here your default pre settings for TS80(P) or TS100
|
||||
*
|
||||
*/
|
||||
|
||||
//===========================================================================
|
||||
//============================= Default Settings ============================
|
||||
//===========================================================================
|
||||
/**
|
||||
* Default soldering temp is 320.0 C
|
||||
* Temperature the iron sleeps at - default 150.0 C
|
||||
*/
|
||||
//===========================================================================
|
||||
//============================= 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
|
||||
#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
|
||||
/**
|
||||
* 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
|
||||
/**
|
||||
* 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
|
||||
/**
|
||||
* 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
|
||||
/**
|
||||
* 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 2 // 0: Right 1:Left 2:Automatic - Default Automatic
|
||||
#define REVERSE_BUTTON_TEMP_CHANGE 0 // 0:Default 1:Reverse - Reverse the plus and minus button assigment for temperature change
|
||||
/**
|
||||
* OLED Orientation
|
||||
*
|
||||
*/
|
||||
#define ORIENTATION_MODE 2 // 0: Right 1:Left 2:Automatic - Default Automatic
|
||||
#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
|
||||
/**
|
||||
* 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
|
||||
/* 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
|
||||
#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
|
||||
/**
|
||||
* 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
|
||||
/**
|
||||
* 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 10
|
||||
#define THERMAL_RUNAWAY_TIME_SEC 20
|
||||
#define THERMAL_RUNAWAY_TEMP_C 10
|
||||
|
||||
#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
|
||||
#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
|
||||
|
||||
#define OP_AMP_GAIN_STAGE_TS100 (1 + (OP_AMP_Rf_TS100 / OP_AMP_Rin_TS100))
|
||||
#define OP_AMP_GAIN_STAGE_TS100 (1 + (OP_AMP_Rf_TS100 / OP_AMP_Rin_TS100))
|
||||
|
||||
#define OP_AMP_Rf_TS80 180 * 1000 // 180 Kilo-ohms -> From schematic, R6
|
||||
#define OP_AMP_Rin_TS80 2000 // 2.0 Kilo-ohms -> From schematic, R3
|
||||
#define OP_AMP_Rf_TS80 180 * 1000 // 180 Kilo-ohms -> From schematic, R6
|
||||
#define OP_AMP_Rin_TS80 2000 // 2.0 Kilo-ohms -> From schematic, R3
|
||||
|
||||
#define OP_AMP_GAIN_STAGE_TS80 (1 + (OP_AMP_Rf_TS80 / OP_AMP_Rin_TS80))
|
||||
#define OP_AMP_GAIN_STAGE_TS80 (1 + (OP_AMP_Rf_TS80 / OP_AMP_Rin_TS80))
|
||||
|
||||
// Deriving the Voltage div:
|
||||
// Vin_max = (3.3*(r1+r2))/(r2)
|
||||
// vdiv = (32768*4)/(vin_max*10)
|
||||
// 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!"
|
||||
#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
|
||||
|
||||
// Miniware is swapping IMU's around a bit now, so we turn them all on
|
||||
|
||||
#define ACCEL_MMA
|
||||
#define ACCEL_LIS
|
||||
#define ACCEL_SC7
|
||||
#define ACCEL_MSA
|
||||
#define ACCEL_BMA
|
||||
|
||||
#define MIN_CALIBRATION_OFFSET 100 // Min value for calibration
|
||||
#define SOLDERING_TEMP 320 // Default soldering temp is 320.0 °C
|
||||
#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
|
||||
|
||||
#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 70
|
||||
#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
|
||||
|
||||
#define HARDWARE_MAX_WATTAGE_X10 750
|
||||
#define TIP_THERMAL_MASS 65 // X10 watts to raise 1 deg C in 1 second
|
||||
#define TIP_RESISTANCE 75 // x10 ohms, 7.5 typical for ts100 tips
|
||||
|
||||
#define POW_DC
|
||||
#define POW_PD 0
|
||||
#define TEMP_TMP36
|
||||
#endif
|
||||
|
||||
#if defined(MODEL_TS80) + defined(MODEL_TS80P) > 0
|
||||
#define MAX_POWER_LIMIT 40
|
||||
#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
|
||||
|
||||
#define TIP_THERMAL_MASS 40
|
||||
#define TIP_RESISTANCE 45 // x10 ohms, 4.5 typical for ts80 tips
|
||||
|
||||
#define LIS_ORI_FLIP
|
||||
#define OLED_FLIP
|
||||
#endif
|
||||
|
||||
#ifdef MODEL_TS80
|
||||
#define VOLTAGE_DIV 780 // Default divider from schematic
|
||||
#define CALIBRATION_OFFSET 900 // the adc offset in uV
|
||||
#define PID_POWER_LIMIT 24 // Sets the max pwm power limit
|
||||
#define POWER_LIMIT 24 // 24 watts default power limit
|
||||
|
||||
#define HARDWARE_MAX_WATTAGE_X10 180
|
||||
|
||||
#define POW_QC
|
||||
#define POW_PD 0
|
||||
#define TEMP_TMP36
|
||||
#endif
|
||||
|
||||
#ifdef MODEL_TS80P
|
||||
#define VOLTAGE_DIV 650 // Default for TS80P with slightly different resistors
|
||||
#define CALIBRATION_OFFSET 1500 // the adc offset in uV
|
||||
#define PID_POWER_LIMIT 35 // Sets the max pwm power limit
|
||||
#define POWER_LIMIT 30 // 30 watts default power limit
|
||||
|
||||
#define HARDWARE_MAX_WATTAGE_X10 300
|
||||
|
||||
#define POW_PD 1
|
||||
#define POW_QC 1
|
||||
#define TEMP_NTC
|
||||
#define I2C_SOFT
|
||||
#define SC7_ORI_FLIP
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Miniware is swapping IMU's around a bit now, so we turn them all on
|
||||
|
||||
#define ACCEL_MMA
|
||||
#define ACCEL_LIS
|
||||
#define ACCEL_SC7
|
||||
#define ACCEL_MSA
|
||||
#define ACCEL_BMA
|
||||
|
||||
#ifdef MODEL_TS100
|
||||
#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 MIN_CALIBRATION_OFFSET 100 // Min value for calibration
|
||||
#define PID_POWER_LIMIT 70 // Sets the max pwm power limit
|
||||
#define POWER_LIMIT 0 // 0 watts default limit
|
||||
#define MAX_POWER_LIMIT 70 //
|
||||
#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
|
||||
#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 POW_PD 0
|
||||
|
||||
#define TEMP_TMP36
|
||||
#endif
|
||||
|
||||
#ifdef MODEL_TS80
|
||||
#define SOLDERING_TEMP 320 // Default soldering temp is 320.0 °C
|
||||
#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 MIN_CALIBRATION_OFFSET 100 // Min value for calibration
|
||||
#define POWER_LIMIT 24 // 24 watts default power limit
|
||||
#define MAX_POWER_LIMIT 40 //
|
||||
#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
|
||||
#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_QC
|
||||
#define POW_PD 0
|
||||
#define TEMP_TMP36
|
||||
#define LIS_ORI_FLIP
|
||||
#define OLED_FLIP
|
||||
#endif
|
||||
|
||||
#ifdef MODEL_TS80P
|
||||
#define SOLDERING_TEMP 320 // Default soldering temp is 320.0 °C
|
||||
#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 MIN_CALIBRATION_OFFSET 100 // Min value for calibration
|
||||
#define POWER_LIMIT 30 // 30 watts default power limit
|
||||
#define MAX_POWER_LIMIT 40 //
|
||||
#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
|
||||
#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 1
|
||||
#define POW_QC 1
|
||||
#define TEMP_NTC
|
||||
#define I2C_SOFT
|
||||
#define LIS_ORI_FLIP
|
||||
#define SC7_ORI_FLIP
|
||||
#define OLED_FLIP
|
||||
#endif
|
||||
|
||||
#ifdef MODEL_TS100
|
||||
#define HARDWARE_MAX_WATTAGE_X10 750
|
||||
#define TIP_THERMAL_MASS 65 // X10 watts to raise 1 deg C in 1 second
|
||||
#define TIP_RESISTANCE 75 // x10 ohms, 7.5 typical for ts100 tips
|
||||
#endif
|
||||
|
||||
#ifdef MODEL_TS80
|
||||
#define HARDWARE_MAX_WATTAGE_X10 180
|
||||
#define TIP_THERMAL_MASS 40
|
||||
#define TIP_RESISTANCE 45 // x10 ohms, 4.5 typical for ts80 tips
|
||||
#endif
|
||||
|
||||
#ifdef MODEL_TS80P
|
||||
#define HARDWARE_MAX_WATTAGE_X10 300
|
||||
#define TIP_THERMAL_MASS 40
|
||||
#define TIP_RESISTANCE 45 // x10 ohms, 4.5 typical for ts80 tips
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define FLASH_LOGOADDR (0x08000000 + (62 * 1024))
|
||||
#define FLASH_LOGOADDR (0x08000000 + (62 * 1024))
|
||||
|
||||
@@ -124,7 +124,7 @@
|
||||
#define POWER_LIMIT_STEPS 5 //
|
||||
#define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_PINECIL // Uses TS100 resistors
|
||||
#define TEMP_uV_LOOKUP_HAKKO // Use Hakko lookup table
|
||||
#define USB_PD_VMAX 20 // Maximum voltage for PD to negotiate
|
||||
#define USB_PD_VMAX 21 // 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
|
||||
@@ -153,3 +153,5 @@
|
||||
#endif
|
||||
|
||||
#define FLASH_LOGOADDR (0x08000000 + (126 * 1024))
|
||||
|
||||
#define HAS_POWER_DEBUG_MENU
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* Author: Ralim
|
||||
*/
|
||||
#include "FreeRTOS.h"
|
||||
#include "gui.hpp"
|
||||
#include "settingsGUI.hpp"
|
||||
#include "task.h"
|
||||
#include <Buttons.hpp>
|
||||
uint32_t lastButtonTime = 0;
|
||||
|
||||
@@ -124,7 +124,7 @@ const uint8_t WarningBlock24[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x30, 0x0C, 0x02, 0xF1, 0xF1, 0xF1, 0x02, 0x0C, 0x30, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xC0, 0xB0, 0x8C, 0x83, 0x80, 0x80, 0x80, 0x80, 0xB3, 0xB3, 0xB3, 0x80, 0x80, 0x80, 0x80, 0x83, 0x8C, 0xB0, 0xC0, 0x00, 0x00};
|
||||
|
||||
#if defined(MODEL_TS100) + defined(MODEL_Pinecil) >= 1
|
||||
#if defined(MODEL_TS100) + defined(MODEL_Pinecil) > 0
|
||||
const uint8_t buttonA[] = {
|
||||
// width = 42
|
||||
// height = 16
|
||||
@@ -156,7 +156,7 @@ const uint8_t disconnectedTip[] = {
|
||||
0x04, 0x31, 0x38, 0x1c, 0x0e, 0x04, 0x01, 0x03, 0x07, 0x0e, 0x1c, 0x39, 0x30, 0x01, 0x03, 0x00, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x04, 0x09, 0x0f, 0x00};
|
||||
#endif
|
||||
|
||||
#if defined(MODEL_TS80) + defined(MODEL_TS80P) >= 1
|
||||
#if defined(MODEL_TS80) + defined(MODEL_TS80P) > 0
|
||||
const uint8_t buttonA[] = {
|
||||
// width = 42
|
||||
// height = 16
|
||||
|
||||
@@ -5,11 +5,16 @@
|
||||
* Author: Ralim
|
||||
*/
|
||||
|
||||
#include "LIS2DH12_defines.hpp"
|
||||
#include <SC7A20.hpp>
|
||||
#include <SC7A20_defines.h>
|
||||
#include <array>
|
||||
|
||||
uint8_t SC7A20::activeAddress;
|
||||
bool SC7A20::isInImitationMode;
|
||||
/*
|
||||
- This little accelerometer seems to come in two forms, its "normal" setup, and then one where it imitates the LIS2DH12
|
||||
- This can be detected by checking the whoami registers
|
||||
*/
|
||||
|
||||
bool SC7A20::detect() {
|
||||
if (FRToSI2C::probe(SC7A20_ADDRESS)) {
|
||||
@@ -17,7 +22,7 @@ bool SC7A20::detect() {
|
||||
uint8_t id = 0;
|
||||
if (FRToSI2C::Mem_Read(SC7A20_ADDRESS, SC7A20_WHO_AMI_I, &id, 1)) {
|
||||
if (id == SC7A20_WHO_AM_I_VALUE) {
|
||||
activeAddress = SC7A20_ADDRESS;
|
||||
isInImitationMode = false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -27,7 +32,7 @@ bool SC7A20::detect() {
|
||||
uint8_t id = 0;
|
||||
if (FRToSI2C::Mem_Read(SC7A20_ADDRESS2, SC7A20_WHO_AMI_I, &id, 1)) {
|
||||
if (id == SC7A20_WHO_AM_I_VALUE) {
|
||||
activeAddress = SC7A20_ADDRESS2;
|
||||
isInImitationMode = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -54,6 +59,20 @@ static const FRToSI2C::I2C_REG i2c_registers[] = {
|
||||
|
||||
//
|
||||
};
|
||||
static const FRToSI2C::I2C_REG i2c_registers_alt[] = {{LIS_CTRL_REG1, 0b00110111, 0}, // 200Hz XYZ
|
||||
{LIS_CTRL_REG2, 0b00000000, 0}, //
|
||||
{LIS_CTRL_REG3, 0b01100000, 0}, // Setup interrupt pins
|
||||
{LIS_CTRL_REG4, 0b00001000, 0}, // Block update mode off, HR on
|
||||
{LIS_CTRL_REG5, 0b00000010, 0}, //
|
||||
{LIS_CTRL_REG6, 0b01100010, 0},
|
||||
// Basically setup the unit to run, and enable 4D orientation detection
|
||||
{LIS_INT2_CFG, 0b01111110, 0}, // setup for movement detection
|
||||
{LIS_INT2_THS, 0x28, 0}, //
|
||||
{LIS_INT2_DURATION, 64, 0}, //
|
||||
{LIS_INT1_CFG, 0b01111110, 0}, //
|
||||
{LIS_INT1_THS, 0x28, 0}, //
|
||||
{LIS_INT1_DURATION, 64, 0}};
|
||||
|
||||
bool SC7A20::initalize() {
|
||||
// Setup acceleration readings
|
||||
// 2G range
|
||||
@@ -63,15 +82,18 @@ bool SC7A20::initalize() {
|
||||
// Orientation recognition in symmetrical mode
|
||||
// Hysteresis is set to ~ 16 counts
|
||||
// Theta blocking is set to 0b10
|
||||
|
||||
return FRToSI2C::writeRegistersBulk(activeAddress, i2c_registers, sizeof(i2c_registers) / sizeof(i2c_registers[0]));
|
||||
if (isInImitationMode) {
|
||||
return FRToSI2C::writeRegistersBulk(SC7A20_ADDRESS2, i2c_registers_alt, sizeof(i2c_registers_alt) / sizeof(i2c_registers_alt[0]));
|
||||
} else {
|
||||
return FRToSI2C::writeRegistersBulk(SC7A20_ADDRESS, i2c_registers, sizeof(i2c_registers) / sizeof(i2c_registers[0]));
|
||||
}
|
||||
}
|
||||
|
||||
void SC7A20::getAxisReadings(int16_t &x, int16_t &y, int16_t &z) {
|
||||
// We can tell the accelerometer to output in LE mode which makes this simple
|
||||
uint16_t sensorData[3] = {0, 0, 0};
|
||||
|
||||
if (FRToSI2C::Mem_Read(SC7A20_ADDRESS, SC7A20_OUT_X_L, (uint8_t *)sensorData, 6) == false) {
|
||||
if (FRToSI2C::Mem_Read(isInImitationMode ? SC7A20_ADDRESS2 : SC7A20_ADDRESS, isInImitationMode ? SC7A20_OUT_X_L_ALT : SC7A20_OUT_X_L, (uint8_t *)sensorData, 6) == false) {
|
||||
x = y = z = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ public:
|
||||
static bool initalize();
|
||||
// 1 = rh, 2,=lh, 8=flat
|
||||
static Orientation getOrientation() {
|
||||
uint8_t val = ((FRToSI2C::I2C_RegisterRead(activeAddress, SC7A20_INT2_SOURCE) >> 2) - 1);
|
||||
uint8_t val = ((FRToSI2C::I2C_RegisterRead(isInImitationMode ? SC7A20_ADDRESS2 : SC7A20_ADDRESS, SC7A20_INT2_SOURCE) >> 2) - 1);
|
||||
if (val == 1) {
|
||||
#ifdef SC7_ORI_FLIP
|
||||
return Orientation::ORIENTATION_RIGHT_HAND;
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
static void getAxisReadings(int16_t &x, int16_t &y, int16_t &z);
|
||||
|
||||
private:
|
||||
static uint8_t activeAddress;
|
||||
static bool isInImitationMode;
|
||||
};
|
||||
|
||||
#endif /* CORE_DRIVERS_BMA223_HPP_ */
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#define SC7A20_REFERENCE 0x26
|
||||
#define SC7A20_STATUS_REG 0x27
|
||||
#define SC7A20_OUT_X_L 0x28
|
||||
#define SC7A20_OUT_X_L_ALT 0xA8
|
||||
#define SC7A20_OUT_X_H 0x29
|
||||
#define SC7A20_OUT_Y_L 0x2A
|
||||
#define SC7A20_OUT_Y_H 0x2B
|
||||
|
||||
@@ -65,12 +65,25 @@ bool USBPowerDelivery::fusbPresent() {
|
||||
return detectionState == 1;
|
||||
}
|
||||
|
||||
bool USBPowerDelivery::isVBUSConnected() { return fusb.isVBUSConnected(); }
|
||||
void USBPowerDelivery::triggerRenegotiation() {
|
||||
|
||||
void USBPowerDelivery::triggerRenegotiation() {}
|
||||
bool USBPowerDelivery::isVBUSConnected() {
|
||||
static uint8_t state = 0;
|
||||
if (state) {
|
||||
return state == 1;
|
||||
}
|
||||
if (fusb.isVBUSConnected()) {
|
||||
state = 1;
|
||||
return true;
|
||||
} else {
|
||||
state = 2;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
bool pdbs_dpm_evaluate_capability(const pd_msg *capabilities, pd_msg *request) {
|
||||
pd_msg lastCapabilities;
|
||||
pd_msg *USBPowerDelivery::getLastSeenCapabilities() { return &lastCapabilities; }
|
||||
|
||||
bool pdbs_dpm_evaluate_capability(const pd_msg *capabilities, pd_msg *request) {
|
||||
memcpy(&lastCapabilities, capabilities, sizeof(pd_msg));
|
||||
/* Get the number of PDOs */
|
||||
uint8_t numobj = PD_NUMOBJ_GET(capabilities);
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#ifndef DRIVERS_USBPD_H_
|
||||
#define DRIVERS_USBPD_H_
|
||||
#include "configuration.h"
|
||||
#include "pdb_msg.h"
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -9,17 +10,19 @@
|
||||
#if POW_PD
|
||||
class USBPowerDelivery {
|
||||
public:
|
||||
static bool start(); // Start the PD stack
|
||||
static bool negotiationComplete(); // Has negotiation completed to a voltage > 5v
|
||||
static bool negotiationInProgress(); // Is negotiation ongoing
|
||||
static bool fusbPresent(); // Is the FUSB302 present on the bus
|
||||
static void PPSTimerCallback(); // PPS Timer
|
||||
static void IRQOccured(); // Thread callback that an irq occured
|
||||
static void step(); // Iterate the step machine
|
||||
static bool negotiationHasWorked(); // Has PD negotiation worked (are we in a PD contract)
|
||||
static uint8_t getStateNumber(); // Debugging - Get the internal state number
|
||||
static bool isVBUSConnected(); // Is the VBus pin connected on the FUSB302
|
||||
static void triggerRenegotiation(); // Trigger a restart of voltage selection
|
||||
static bool start(); // Start the PD stack
|
||||
static bool negotiationComplete(); // Has negotiation completed to a voltage > 5v
|
||||
static bool negotiationInProgress(); // Is negotiation ongoing
|
||||
static bool fusbPresent(); // Is the FUSB302 present on the bus
|
||||
static void PPSTimerCallback(); // PPS Timer
|
||||
static void IRQOccured(); // Thread callback that an irq occured
|
||||
static void step(); // Iterate the step machine
|
||||
static bool negotiationHasWorked(); // Has PD negotiation worked (are we in a PD contract)
|
||||
static uint8_t getStateNumber(); // Debugging - Get the internal state number
|
||||
static bool isVBUSConnected(); // Is the VBus pin connected on the FUSB302
|
||||
static void triggerRenegotiation(); // Trigger a restart of voltage selection
|
||||
static bool isVBUSConnected(); // Is the VBus pin connected on the FUSB302
|
||||
static pd_msg *getLastSeenCapabilities(); // returns pointer to the last seen capabilities from the powersource
|
||||
private:
|
||||
//
|
||||
static int detectionState;
|
||||
|
||||
@@ -14,6 +14,7 @@ extern const bool HasFahrenheit;
|
||||
extern const char *SymbolPlus;
|
||||
extern const char *SymbolMinus;
|
||||
extern const char *SymbolSpace;
|
||||
extern const char *SymbolAmps;
|
||||
extern const char *SymbolDot;
|
||||
extern const char *SymbolDegC;
|
||||
extern const char *SymbolDegF;
|
||||
@@ -24,6 +25,10 @@ extern const char *SymbolVolts;
|
||||
extern const char *SymbolDC;
|
||||
extern const char *SymbolCellCount;
|
||||
extern const char *SymbolVersionNumber;
|
||||
extern const char *SymbolPDDebug;
|
||||
extern const char *SymbolState;
|
||||
extern const char *SymbolNoVBus;
|
||||
extern const char *SymbolVBus;
|
||||
|
||||
extern const char *DebugMenu[];
|
||||
extern const char *AccelTypeNames[];
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* gui.h
|
||||
* settingsGUI.h
|
||||
*
|
||||
* Created on: 3Sep.,2017
|
||||
* Author: Ben V. Brown
|
||||
@@ -3,10 +3,10 @@
|
||||
#include "Translation_multi.h"
|
||||
#include "brieflz.h"
|
||||
#include "configuration.h"
|
||||
#include "gui.hpp"
|
||||
#include "settingsGUI.hpp"
|
||||
|
||||
const TranslationIndexTable *Tr = nullptr;
|
||||
const char * TranslationStrings = nullptr;
|
||||
const char *TranslationStrings = nullptr;
|
||||
|
||||
static uint8_t selectedLangIndex = 255;
|
||||
|
||||
@@ -38,7 +38,7 @@ void prepareTranslations() {
|
||||
|
||||
const TranslationData *translationData;
|
||||
uint16_t buffer_remaining_size = translation_data_out_buffer_size;
|
||||
uint8_t * buffer_next_ptr = translation_data_out_buffer;
|
||||
uint8_t *buffer_next_ptr = translation_data_out_buffer;
|
||||
if (langMeta.translation_is_compressed) {
|
||||
unsigned int outsize;
|
||||
outsize = blz_depack_srcsize(langMeta.translation_data, buffer_next_ptr, langMeta.translation_size);
|
||||
@@ -55,7 +55,7 @@ void prepareTranslations() {
|
||||
memset(DynamicFontSections, 0, FontSectionsCount * sizeof(DynamicFontSections[0]));
|
||||
for (int i = 0; i < FontSectionDataCount; i++) {
|
||||
const auto &fontSectionDataInfo = FontSectionDataInfos[i];
|
||||
auto & fontSection = DynamicFontSections[i];
|
||||
auto &fontSection = DynamicFontSections[i];
|
||||
fontSection.symbol_start = fontSectionDataInfo.symbol_start;
|
||||
fontSection.symbol_end = fontSection.symbol_start + fontSectionDataInfo.symbol_count;
|
||||
const uint16_t font12_size = fontSectionDataInfo.symbol_count * (12 * 16 / 8);
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
/*
|
||||
* gui.cpp
|
||||
* settingsGUI.cpp
|
||||
*
|
||||
* Created on: 3Sep.,2017
|
||||
* Author: Ben V. Brown
|
||||
*/
|
||||
|
||||
#include "gui.hpp"
|
||||
#include "settingsGUI.hpp"
|
||||
#include "Buttons.hpp"
|
||||
#include "ScrollMessage.hpp"
|
||||
#include "TipThermoModel.h"
|
||||
@@ -11,21 +11,22 @@ extern "C" {
|
||||
#include "Buttons.hpp"
|
||||
#include "I2CBB.hpp"
|
||||
#include "LIS2DH12.hpp"
|
||||
#include "MMA8652FC.hpp"
|
||||
#include "OLED.hpp"
|
||||
#include "Settings.h"
|
||||
#include "TipThermoModel.h"
|
||||
#include "Translation.h"
|
||||
#include "cmsis_os.h"
|
||||
#include "configuration.h"
|
||||
#include "history.hpp"
|
||||
#include "main.hpp"
|
||||
#include "power.hpp"
|
||||
#include "settingsGUI.hpp"
|
||||
#include "stdlib.h"
|
||||
#include "string.h"
|
||||
#include <MMA8652FC.hpp>
|
||||
#include <gui.hpp>
|
||||
#include <history.hpp>
|
||||
#include <power.hpp>
|
||||
#if POW_PD
|
||||
#include "USBPD.h"
|
||||
#include "pd.h"
|
||||
#endif
|
||||
// File local variables
|
||||
extern uint32_t currentTempTargetDegC;
|
||||
@@ -796,6 +797,82 @@ void showDebugMenu(void) {
|
||||
}
|
||||
}
|
||||
|
||||
#if POW_PD
|
||||
#ifdef HAS_POWER_DEBUG_MENU
|
||||
static void showPDDebug(void) {
|
||||
// Print out the USB-PD state
|
||||
// Basically this is like the Debug menu, but instead we want to print out the PD status
|
||||
uint8_t screen = 0;
|
||||
ButtonState b;
|
||||
for (;;) {
|
||||
OLED::clearScreen(); // Ensure the buffer starts clean
|
||||
OLED::setCursor(0, 0); // Position the cursor at the 0,0 (top left)
|
||||
OLED::print(SymbolPDDebug, FontStyle::SMALL); // Print Title
|
||||
OLED::setCursor(0, 8); // second line
|
||||
if (screen == 0) {
|
||||
// Print the PD state machine
|
||||
OLED::print(SymbolState, FontStyle::SMALL);
|
||||
OLED::print(SymbolSpace, FontStyle::SMALL);
|
||||
OLED::printNumber(USBPowerDelivery::getStateNumber(), 2, FontStyle::SMALL, true);
|
||||
OLED::print(SymbolSpace, FontStyle::SMALL);
|
||||
// Also print vbus mod status
|
||||
if (USBPowerDelivery::fusbPresent()) {
|
||||
if (USBPowerDelivery::negotiationComplete() || (xTaskGetTickCount() > (TICKS_SECOND * 10))) {
|
||||
if (!USBPowerDelivery::isVBUSConnected()) {
|
||||
OLED::print(SymbolNoVBus, FontStyle::SMALL);
|
||||
} else {
|
||||
OLED::print(SymbolVBus, FontStyle::SMALL);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Print out the Proposed power options one by one
|
||||
auto lastCaps = USBPowerDelivery::getLastSeenCapabilities();
|
||||
uint8_t numobj = PD_NUMOBJ_GET(lastCaps);
|
||||
if ((screen - 1) < numobj) {
|
||||
int voltage_mv = 0;
|
||||
int min_voltage = 0;
|
||||
int current_a_x100 = 0;
|
||||
if ((lastCaps->obj[screen - 1] & PD_PDO_TYPE) == PD_PDO_TYPE_FIXED) {
|
||||
voltage_mv = PD_PDV2MV(PD_PDO_SRC_FIXED_VOLTAGE_GET(lastCaps->obj[screen - 1])); // voltage in mV units
|
||||
current_a_x100 = PD_PDO_SRC_FIXED_CURRENT_GET(lastCaps->obj[screen - 1]); // current in 10mA units
|
||||
} else {
|
||||
voltage_mv = PD_PAV2MV(PD_APDO_PPS_MAX_VOLTAGE_GET(lastCaps->obj[screen - 1]));
|
||||
min_voltage = PD_PAV2MV(PD_APDO_PPS_MIN_VOLTAGE_GET(lastCaps->obj[screen - 1]));
|
||||
current_a_x100 = PD_PAI2CA(PD_APDO_PPS_CURRENT_GET(lastCaps->obj[screen - 1])); // max current in 10mA units
|
||||
}
|
||||
// print out this entry of the proposal
|
||||
OLED::printNumber(screen, 1, FontStyle::SMALL, true); // print the entry number
|
||||
OLED::print(SymbolSpace, FontStyle::SMALL);
|
||||
if (min_voltage > 0) {
|
||||
OLED::printNumber(min_voltage / 1000, 2, FontStyle::SMALL, true); // print the voltage
|
||||
OLED::print(SymbolMinus, FontStyle::SMALL);
|
||||
}
|
||||
OLED::printNumber(voltage_mv / 1000, 2, FontStyle::SMALL, true); // print the voltage
|
||||
OLED::print(SymbolVolts, FontStyle::SMALL);
|
||||
OLED::print(SymbolSpace, FontStyle::SMALL);
|
||||
OLED::printNumber(current_a_x100 / 100, 2, FontStyle::SMALL, true); // print the current in 0.1A res
|
||||
OLED::print(SymbolDot, FontStyle::SMALL);
|
||||
OLED::printNumber(current_a_x100 % 100, 2, FontStyle::SMALL, true); // print the current in 0.1A res
|
||||
OLED::print(SymbolAmps, FontStyle::SMALL);
|
||||
|
||||
} else {
|
||||
screen = 0;
|
||||
}
|
||||
}
|
||||
|
||||
OLED::refresh();
|
||||
b = getButtonState();
|
||||
if (b == BUTTON_B_SHORT)
|
||||
return;
|
||||
else if (b == BUTTON_F_SHORT) {
|
||||
screen++;
|
||||
}
|
||||
GUIDelay();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
void showWarnings() {
|
||||
// Display alert if settings were reset
|
||||
if (settingsWereReset) {
|
||||
@@ -863,8 +940,16 @@ void startGUITask(void const *argument) {
|
||||
getTipRawTemp(1); // reset filter
|
||||
|
||||
OLED::setRotation(getSettingValue(SettingsOptions::OrientationMode) & 1);
|
||||
// If the front button is held down, on supported devices, show PD debugging metrics
|
||||
#if POW_PD
|
||||
#ifdef HAS_POWER_DEBUG_MENU
|
||||
if (getButtonA()) {
|
||||
showPDDebug();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
BootLogo::handleShowingLogo((uint8_t *)FLASH_LOGOADDR);
|
||||
|
||||
// BootLogo::handleShowingLogo((uint8_t *)FLASH_LOGOADDR);
|
||||
showWarnings();
|
||||
if (getSettingValue(SettingsOptions::AutoStartMode)) {
|
||||
// jump directly to the autostart mode
|
||||
|
||||
@@ -313,7 +313,7 @@ $(shell find $(DEVICE_BSP_DIR) -type d \( $(EXCLUDED_DIRS) \) -prune -false -o
|
||||
$(shell find $(SOURCE_MIDDLEWARES_DIR) -type f -name '*.cpp')
|
||||
|
||||
# code optimisation ------------------------------------------------------------
|
||||
OPTIM=-Os -finline-small-functions -findirect-inlining -fdiagnostics-color -ffunction-sections -fdata-sections -fshort-enums -fsingle-precision-constant -ffreestanding -fno-common
|
||||
OPTIM=-Os -flto -finline-small-functions -fshort-wchar -findirect-inlining -fdiagnostics-color -ffunction-sections -fdata-sections -fshort-enums -fsingle-precision-constant -fno-common
|
||||
|
||||
# global defines ---------------------------------------------------------------
|
||||
GLOBAL_DEFINES += $(DEV_GLOBAL_DEFS) -D USE_RTOS_SYSTICK -D MODEL_$(model)
|
||||
@@ -412,8 +412,6 @@ CXXFLAGS=$(DEV_CXXFLAGS) \
|
||||
-fno-non-call-exceptions \
|
||||
-fno-use-cxa-atexit \
|
||||
-fno-strict-aliasing \
|
||||
-fno-rtti \
|
||||
-fno-exceptions \
|
||||
-fno-threadsafe-statics \
|
||||
-T$(LDSCRIPT)
|
||||
|
||||
@@ -426,7 +424,7 @@ CFLAGS=$(DEV_CFLAGS) \
|
||||
$(GLOBAL_DEFINES) \
|
||||
-D${COMPILER} \
|
||||
-MMD \
|
||||
-std=gnu99 \
|
||||
-std=gnu11 \
|
||||
$(OPTIM) \
|
||||
-T$(LDSCRIPT) \
|
||||
-c
|
||||
|
||||
4342
source/Middlewares/Third_Party/FreeRTOS/Source/queue.c
vendored
4342
source/Middlewares/Third_Party/FreeRTOS/Source/queue.c
vendored
File diff suppressed because it is too large
Load Diff
@@ -4,4 +4,4 @@
|
||||
* i.e.: BUILD_VERSION = 'Rel. v2.08' --> Will generated to: 'v2.08.1a2b3c4'
|
||||
*/
|
||||
|
||||
#define BUILD_VERSION "v2.17"
|
||||
#define BUILD_VERSION "v2.18"
|
||||
|
||||
Reference in New Issue
Block a user