Skip to content

Commit

Permalink
Bunch of Misc Fixups
Browse files Browse the repository at this point in the history
  • Loading branch information
Ralim committed Jun 18, 2023
1 parent 3d11a30 commit d5c88fe
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 14 deletions.
12 changes: 12 additions & 0 deletions source/Core/BSP/Miniware/BSP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,20 +379,32 @@ uint8_t preStartChecksDone() {
}

uint8_t getTipResistanceX10() {
#ifdef TIP_RESISTANCE_SENSE_Pin
// Return tip resistance in x10 ohms
// We can measure this using the op-amp
return lastTipResistance;
#else
return TIP_RESISTANCE;
#endif
}

uint8_t getTipThermalMass() {
#ifdef TIP_RESISTANCE_SENSE_Pin
if (lastTipResistance >= 80) {
return TIP_THERMAL_MASS;
}
return 45;
#else
return TIP_THERMAL_MASS;
#endif
}
uint8_t getTipInertia() {
#ifdef TIP_RESISTANCE_SENSE_Pin
if (lastTipResistance >= 80) {
return TIP_THERMAL_MASS;
}
return 10;
#else
return TIP_THERMAL_MASS;
#endif
}
4 changes: 2 additions & 2 deletions source/Core/BSP/Miniware/Power.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "Settings.h"
#include "USBPD.h"
#include "configuration.h"

#include "stm32f1xx_hal.h"
void power_check() {
#ifdef POW_PD
// Cant start QC until either PD works or fails
Expand All @@ -27,7 +27,7 @@ bool getIsPoweredByDCIN() {
#endif
#ifdef MODEL_TS101
// TODO have to check what we are using
return false;
return HAL_GPIO_ReadPin(DC_SELECT_GPIO_Port, DC_SELECT_Pin) == GPIO_PIN_SET;
#endif
#ifdef MODEL_TS100
return true;
Expand Down
10 changes: 5 additions & 5 deletions source/Core/BSP/Miniware/Setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ uint16_t getADCVin(uint8_t sample) {
latestADC += hadc2.Instance->JDR2;
latestADC += hadc2.Instance->JDR3;
latestADC += hadc2.Instance->JDR4;
latestADC <<= 3;
latestADC <<= 1;
filter.update(latestADC);
}
return filter.average();
Expand Down Expand Up @@ -333,7 +333,7 @@ static void MX_TIP_CONTROL_TIMER_Init(void) {
#ifdef TIP_HAS_DIRECT_PWM
sConfigOC.Pulse = 0; // PWM is direct to tip
#else
sConfigOC.Pulse = 127; // 50% duty cycle, that is AC coupled through the cap to provide an on signal (This does not do tip at 50% duty cycle)
sConfigOC.Pulse = 127; // 50% duty cycle, that is AC coupled through the cap to provide an on signal (This does not do tip at 50% duty cycle)
#endif
sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
sConfigOC.OCFastMode = TIM_OCFAST_ENABLE;
Expand All @@ -352,7 +352,7 @@ static void MX_TIP_CONTROL_TIMER_Init(void) {
// Remap TIM3_CH1 to be on PB4
__HAL_AFIO_REMAP_TIM3_PARTIAL();
#else
// No re-map required
// No re-map required
#endif
HAL_TIM_PWM_Start(&htimTip, PWM_Out_CHANNEL);
}
Expand Down Expand Up @@ -496,8 +496,8 @@ static void MX_GPIO_Init(void) {
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
#endif
#else
/* TS80 */
/* Leave USB lines open circuit*/
/* TS80 */
/* Leave USB lines open circuit*/

#endif

Expand Down
10 changes: 5 additions & 5 deletions source/Core/BSP/Miniware/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,10 @@
#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 PID_POWER_LIMIT 35 // Sets the max pwm power limit
#define POWER_LIMIT 32 // 24 watts default power limit

#define HARDWARE_MAX_WATTAGE_X10 180
#define HARDWARE_MAX_WATTAGE_X10 320

#define POW_QC

Expand All @@ -238,9 +238,9 @@
#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 POWER_LIMIT 32 // 30 watts default power limit

#define HARDWARE_MAX_WATTAGE_X10 300
#define HARDWARE_MAX_WATTAGE_X10 320

#define POW_PD 1
#define POW_QC 1
Expand Down
4 changes: 2 additions & 2 deletions source/Core/BSP/Sequre_S60/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,12 @@
#define HAS_POWER_DEBUG_MENU
#define TEMP_NTC
#define I2C_SOFT_BUS_2 // For now we are doing software I2C to get around hardware chip issues
#define OLED_I2CBB
#define OLED_I2CBB2

#define MODEL_HAS_DCDC // We dont have DC/DC but have reallly fast PWM that gets us roughly the same place
#endif

#endif

#define FLASH_LOGOADDR (0x08000000 + (62 * 1024))
#define FLASH_LOGOADDR (0x08000000 + (62 * 1024))
#define SETTINGS_START_PAGE (0x08000000 + (63 * 1024))

0 comments on commit d5c88fe

Please sign in to comment.