mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Cleaning up config
This commit is contained in:
@@ -158,7 +158,6 @@ uint16_t getInputVoltageX10(uint16_t divisor, uint8_t sample) {
|
||||
// Therefore we can divide down from there
|
||||
// Multiplying ADC max by 4 for additional calibration options,
|
||||
// ideal term is 467
|
||||
#define BATTFILTERDEPTH 32
|
||||
static uint8_t preFillneeded = 10;
|
||||
static uint32_t samples[BATTFILTERDEPTH];
|
||||
static uint8_t index = 0;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#define ACCEL_LIS
|
||||
#define ACCEL_MSA
|
||||
#define POW_PD
|
||||
#define POW_QC
|
||||
//#define POW_QC // Unsure if we have this
|
||||
#define TEMP_NTC
|
||||
#define I2C_SOFT
|
||||
#define LIS_ORI_FLIP
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#define SDA_GPIO_Port GPIOB
|
||||
#define SCL2_Pin GPIO_PIN_3
|
||||
#define SCL2_GPIO_Port GPIOB
|
||||
#define SDA2_Pin GPIO_PIN15
|
||||
#define SDA2_Pin GPIO_PIN_15
|
||||
#define SDA2_GPIO_Port GPIOA
|
||||
#define INT_PD_Pin GPIO_PIN_5
|
||||
#define INT_PD_GPIO_Port GPIOB
|
||||
|
||||
@@ -34,11 +34,7 @@ static void MX_ADC2_Init(void);
|
||||
void Setup_HAL() {
|
||||
SystemClock_Config();
|
||||
|
||||
#ifndef SWD_ENABLE
|
||||
__HAL_AFIO_REMAP_SWJ_DISABLE();
|
||||
#else
|
||||
__HAL_AFIO_REMAP_SWJ_NOJTAG();
|
||||
#endif
|
||||
|
||||
MX_GPIO_Init();
|
||||
MX_DMA_Init();
|
||||
@@ -49,7 +45,8 @@ void Setup_HAL() {
|
||||
MX_TIM2_Init();
|
||||
MX_IWDG_Init();
|
||||
HAL_ADC_Start(&hadc2);
|
||||
HAL_ADCEx_MultiModeStart_DMA(&hadc1, ADCReadings, (ADC_SAMPLES * ADC_CHANNELS)); // start DMA of normal readings
|
||||
HAL_ADCEx_MultiModeStart_DMA(&hadc1, ADCReadings,
|
||||
(ADC_SAMPLES * ADC_CHANNELS)); // start DMA of normal readings
|
||||
HAL_ADCEx_InjectedStart(&hadc1); // enable injected readings
|
||||
HAL_ADCEx_InjectedStart(&hadc2); // enable injected readings
|
||||
}
|
||||
@@ -75,7 +72,8 @@ void SystemClock_Config(void) {
|
||||
|
||||
/**Initializes the CPU, AHB and APB busses clocks
|
||||
*/
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI | RCC_OSCILLATORTYPE_LSI;
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI
|
||||
| RCC_OSCILLATORTYPE_LSI;
|
||||
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
|
||||
RCC_OscInitStruct.HSICalibrationValue = 16;
|
||||
RCC_OscInitStruct.LSIState = RCC_LSI_ON;
|
||||
@@ -86,7 +84,8 @@ void SystemClock_Config(void) {
|
||||
|
||||
/**Initializes the CPU, AHB and APB busses clocks
|
||||
*/
|
||||
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
|
||||
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK
|
||||
| RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
|
||||
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
|
||||
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
|
||||
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV16; // TIM
|
||||
@@ -412,14 +411,18 @@ static void MX_GPIO_Init(void) {
|
||||
/*
|
||||
* Configure All pins as analog by default
|
||||
*/
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7 | GPIO_PIN_8 | GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_15;
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3
|
||||
| GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7 | GPIO_PIN_8
|
||||
| GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_15;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 |
|
||||
#ifdef MODEL_TS100
|
||||
GPIO_PIN_3 |
|
||||
#endif
|
||||
GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7 | GPIO_PIN_8 | GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15;
|
||||
GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7 | GPIO_PIN_8
|
||||
| GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_12 | GPIO_PIN_13
|
||||
| GPIO_PIN_14 | GPIO_PIN_15;
|
||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
|
||||
#ifdef MODEL_TS100
|
||||
|
||||
@@ -18,9 +18,7 @@ void preRToSInit() {
|
||||
HAL_Init();
|
||||
Setup_HAL(); // Setup all the HAL objects
|
||||
BSPInit();
|
||||
#ifdef I2C_SOFT
|
||||
I2CBB::init();
|
||||
#endif
|
||||
/* Init the IPC objects */
|
||||
FRToSI2C::FRToSInit();
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ uint32_t TipThermoModel::convertTipRawADCToDegF(uint16_t rawADC) { return conver
|
||||
// x = input value
|
||||
// output is x's interpolated y value
|
||||
int32_t LinearInterpolate(int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t x) { return y1 + (((((x - x1) * 1000) / (x2 - x1)) * (y2 - y1))) / 1000; }
|
||||
#ifdef TEMP_uV_LOOKUP_HAKKO
|
||||
#ifdef TEMP_uV_LOOKUP_MHP30
|
||||
const uint16_t uVtoDegC[] = {
|
||||
//
|
||||
//
|
||||
@@ -122,64 +122,6 @@ const uint16_t uVtoDegC[] = {
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef TEMP_uV_LOOKUP_TS80
|
||||
|
||||
const uint16_t uVtoDegC[] = {
|
||||
//
|
||||
//
|
||||
530, 0, //
|
||||
1282, 10, //
|
||||
2034, 20, //
|
||||
2786, 30, //
|
||||
3538, 40, //
|
||||
4290, 50, //
|
||||
5043, 60, //
|
||||
5795, 70, //
|
||||
6547, 80, //
|
||||
7299, 90, //
|
||||
8051, 100, //
|
||||
8803, 110, //
|
||||
9555, 120, //
|
||||
10308, 130, //
|
||||
11060, 140, //
|
||||
11812, 150, //
|
||||
12564, 160, //
|
||||
13316, 170, //
|
||||
14068, 180, //
|
||||
14820, 190, //
|
||||
15573, 200, //
|
||||
16325, 210, //
|
||||
17077, 220, //
|
||||
17829, 230, //
|
||||
18581, 240, //
|
||||
19333, 250, //
|
||||
20085, 260, //
|
||||
20838, 270, //
|
||||
21590, 280, //
|
||||
22342, 290, //
|
||||
23094, 300, //
|
||||
23846, 310, //
|
||||
24598, 320, //
|
||||
25350, 330, //
|
||||
26103, 340, //
|
||||
26855, 350, //
|
||||
27607, 360, //
|
||||
28359, 370, //
|
||||
29111, 380, //
|
||||
29863, 390, //
|
||||
30615, 400, //
|
||||
31368, 410, //
|
||||
32120, 420, //
|
||||
32872, 430, //
|
||||
33624, 440, //
|
||||
34376, 450, //
|
||||
35128, 460, //
|
||||
35880, 470, //
|
||||
36632, 480, //
|
||||
37385, 490, //
|
||||
38137, 500, //
|
||||
};
|
||||
#endif
|
||||
uint32_t TipThermoModel::convertuVToDegC(uint32_t tipuVDelta) {
|
||||
if (tipuVDelta) {
|
||||
int noItems = sizeof(uVtoDegC) / (2 * sizeof(uint16_t));
|
||||
|
||||
@@ -163,6 +163,18 @@
|
||||
#define USB_PD_VMAX 12 // Maximum voltage for PD to negotiate
|
||||
#endif
|
||||
|
||||
#ifdef MODEL_MHP30
|
||||
#define VOLTAGE_DIV 650 // Default for MHP30 TODO
|
||||
#define PID_POWER_LIMIT 75 // Sets the max pwm power limit
|
||||
#define CALIBRATION_OFFSET 900 // the adc offset in uV
|
||||
#define POWER_LIMIT 65 // 65 watts default power limit
|
||||
#define MAX_POWER_LIMIT 35 //
|
||||
#define POWER_LIMIT_STEPS 2 //
|
||||
#define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_TS100 // TODO
|
||||
#define TEMP_uV_LOOKUP_MHP30 // TODO
|
||||
#define USB_PD_VMAX 20 // Maximum voltage for PD to negotiate
|
||||
#endif
|
||||
|
||||
#ifdef MODEL_TS100
|
||||
const int32_t tipMass = 65; // X10 watts to raise 1 deg C in 1 second
|
||||
const uint8_t tipResistance = 75; // x10 ohms, 7.5 typical for ts100 tips
|
||||
@@ -182,3 +194,10 @@ const uint8_t tipResistance = 45; // x10 ohms, 4.5 typical for ts80 tips
|
||||
const uint32_t tipMass = 40;
|
||||
const uint8_t tipResistance = 45; // x10 ohms, 4.5 typical for ts80 tips
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef MODEL_MHP30
|
||||
const uint32_t tipMass = 80;//TODO
|
||||
const uint8_t tipResistance = 60; // x10 ohms, 6 typical
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user