Skip to content

Commit

Permalink
Merge branch 'dev' into Pinecil-PID-tune
Browse files Browse the repository at this point in the history
  • Loading branch information
discip authored Jul 11, 2024
2 parents 41359e6 + 18e936a commit 1e12d12
Show file tree
Hide file tree
Showing 89 changed files with 89 additions and 86 deletions.
52 changes: 26 additions & 26 deletions Translations/translation_BE.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,13 @@
},
"menuValues": {
"USBPDModeDefault": {
"displayText": "Default\nMode"
"displayText": "\nРэжым"
},
"USBPDModeNoDynamic": {
"displayText": "No\nDynamic"
"displayText": "Няма\nдынамікі"
},
"USBPDModeSafe": {
"displayText": "Safe\nMode"
"displayText": "Бяспечны\nрэжым"
}
},
"menuOptions": {
Expand All @@ -134,7 +134,7 @@
"description": "Час чакання ўзгаднення PD з крокам 100 мс для сумяшчальнасці з некаторымі зараднымі зараднымі прыладамі QC (0: адключана)"
},
"USBPDMode": {
"displayText": "PD\nMode",
"displayText": "PD\nРэжым",
"description": "Уключае рэжымы PPS & EPR."
},
"BoostTemperature": {
Expand All @@ -158,59 +158,59 @@
"description": "Пры рабоце падоўжаны націск дзьвух кнопак блакуе іх (Т=Толькі турба | П=Поўная блакіроўка)"
},
"ProfilePhases": {
"displayText": "Profile\nPhases",
"displayText": "Фазы\nпрофілю",
"description": "Колькасць фаз у рэжыме профілю"
},
"ProfilePreheatTemp": {
"displayText": "Preheat\nTemp",
"displayText": "Тэмпература\nразагравання",
"description": "Разагрэйце да гэтай тэмпературы ў пачатку профільнага рэжыму"
},
"ProfilePreheatSpeed": {
"displayText": "Preheat\nSpeed",
"displayText": "Хуткасть\nразагравання",
"description": "Разагрэйце з гэтай хуткасцю (градусы ў секунду)"
},
"ProfilePhase1Temp": {
"displayText": "Phase 1\nTemp",
"displayText": "Фаза 1\nтэмпература",
"description": "Мэтавая тэмпература ў канцы гэтай фазы"
},
"ProfilePhase1Duration": {
"displayText": "Phase 1\nDuration",
"displayText": "Фаза 1\nпрацягласць",
"description": "Мэтавая працягласць гэтай фазы (секунды)"
},
"ProfilePhase2Temp": {
"displayText": "Phase 2\nTemp",
"description": ""
"displayText": "Фаза 2\nтэмпература",
"description": "Мэтавая тэмпература ў канцы гэтай фазы"
},
"ProfilePhase2Duration": {
"displayText": "Phase 2\nDuration",
"description": ""
"displayText": "Фаза 2\nпрацягласць",
"description": "Мэтавая працягласць гэтай фазы (секунды)"
},
"ProfilePhase3Temp": {
"displayText": "Phase 3\nTemp",
"description": ""
"displayText": "Фаза 3\nтэмпература",
"description": "Мэтавая тэмпература ў канцы гэтай фазы"
},
"ProfilePhase3Duration": {
"displayText": "Phase 3\nDuration",
"description": ""
"displayText": "Фаза 3\nпрацягласць",
"description": "Мэтавая працягласць гэтай фазы (секунды)"
},
"ProfilePhase4Temp": {
"displayText": "Phase 4\nTemp",
"description": ""
"displayText": "Фаза 4\nтэмпература",
"description": "Мэтавая тэмпература ў канцы гэтай фазы"
},
"ProfilePhase4Duration": {
"displayText": "Phase 4\nDuration",
"description": ""
"displayText": "Фаза 4\nпрацягласць",
"description": "Мэтавая працягласць гэтай фазы (секунды)"
},
"ProfilePhase5Temp": {
"displayText": "Phase 5\nTemp",
"description": ""
"displayText": "Фаза 5\nтэмпература",
"description": "Мэтавая тэмпература ў канцы гэтай фазы"
},
"ProfilePhase5Duration": {
"displayText": "Phase 5\nDuration",
"description": ""
"displayText": "Фаза 5\nпрацягласць",
"description": "Мэтавая працягласць гэтай фазы (секунды)"
},
"ProfileCooldownSpeed": {
"displayText": "Cooldown\nSpeed",
"displayText": "Хуткасць\nастывання",
"description": "Астуджаць з гэтай хуткасцю ў канцы профільнага рэжыму (градусы ў секунду)"
},
"MotionSensitivity": {
Expand Down
10 changes: 5 additions & 5 deletions Translations/translation_BG.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,13 @@
},
"menuValues": {
"USBPDModeDefault": {
"displayText": "Default\nMode"
"displayText": "Вкл.\nPPSиERP"
},
"USBPDModeNoDynamic": {
"displayText": "No\nDynamic"
"displayText": "Изкл.\n"
},
"USBPDModeSafe": {
"displayText": "Safe\nMode"
"displayText": "Вкл.без\nискане"
}
},
"menuOptions": {
Expand All @@ -134,8 +134,8 @@
"description": "PD интервал за договаряне на захранването на стъпки от 100 мс за съвместимост с някои QC захранвания (0=Изкл.)"
},
"USBPDMode": {
"displayText": "PD\nMode",
"description": "Включи PPS & EPR"
"displayText": "PD\nрежим",
"description": "Вкл.без искане: включи PPS и EPR без да искате повече мощност"
},
"BoostTemperature": {
"displayText": "Турбо\nтемп.",
Expand Down
6 changes: 3 additions & 3 deletions Translations/translation_IT.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,13 @@
},
"menuValues": {
"USBPDModeDefault": {
"displayText": "Default\nMode"
"displayText": "Modo\npredefinito"
},
"USBPDModeNoDynamic": {
"displayText": "No\nDynamic"
"displayText": "Modo\nstatico"
},
"USBPDModeSafe": {
"displayText": "Safe\nMode"
"displayText": "Modo\nsicuro"
}
},
"menuOptions": {
Expand Down
12 changes: 6 additions & 6 deletions Translations/translation_RU.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,13 @@
},
"menuValues": {
"USBPDModeDefault": {
"displayText": "Default\nMode"
"displayText": "Вкл.\nPPSиEPR"
},
"USBPDModeNoDynamic": {
"displayText": "No\nDynamic"
"displayText": "Откл.\n"
},
"USBPDModeSafe": {
"displayText": "Safe\nMode"
"displayText": "Вкл.без\nзапроса"
}
},
"menuOptions": {
Expand All @@ -130,12 +130,12 @@
"description": "Максимальное напряжение для согласования с источником питания по QC"
},
"PDNegTimeout": {
"displayText": "PD\nинтервал",
"displayText": "Интервал\nPD",
"description": "Интервал согласования питания по Power Delivery с шагом 100 мс для совместимости с некоторыми источниками питания по QC (0=Откл.)"
},
"USBPDMode": {
"displayText": "PD\nMode",
"description": "Включить режимы PPS & EPR"
"displayText": "Режим\nPD",
"description": "Вкл.без запроса: включить PPS и EPR без запроса большей мощности"
},
"BoostTemperature": {
"displayText": "t° турбо\nрежима",
Expand Down
6 changes: 3 additions & 3 deletions Translations/translation_UK.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,13 @@
},
"menuValues": {
"USBPDModeDefault": {
"displayText": "Default\nMode"
"displayText": "Режим\nЗамовчуванню"
},
"USBPDModeNoDynamic": {
"displayText": "No\nDynamic"
"displayText": "Без\nДинамічного"
},
"USBPDModeSafe": {
"displayText": "Safe\nMode"
"displayText": "Безпечний\nРежим"
}
},
"menuOptions": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) {
if (PWMSafetyTimer == 0) {
htim4.Instance->CCR3 = 0;
} else {
htim4.Instance->CCR3 = pendingPWM;
htim4.Instance->CCR3 = pendingPWM / 4;
}
} else if (htim->Instance == TIM1) {
// STM uses this for internal functions as a counter for timeouts
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void Setup_HAL() {
GPIO_InitStruct.Pin = MOVEMENT_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_PULLDOWN;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; // We would like sharp rising edges
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(MOVEMENT_GPIO_Port, &GPIO_InitStruct);
}
}
Expand Down Expand Up @@ -254,23 +254,20 @@ static void MX_IWDG_Init(void) {

static void MX_TIM4_Init(void) {
/*
* We use the channel 1 to trigger the ADC at end of PWM period
* And we use the channel 4 as the PWM modulation source using Interrupts
* On Sequre devies we run the output PWM as fast as possible due to the low tip resistance + no inductor for filtering.
* So we run it as fast as we can and hope that the caps filter out the current spikes.
* */
TIM_ClockConfigTypeDef sClockSourceConfig;
TIM_MasterConfigTypeDef sMasterConfig;
TIM_OC_InitTypeDef sConfigOC;
memset(&sConfigOC, 0, sizeof(sConfigOC));
// Timer 2 is fairly slow as its being used to run the PWM and trigger the ADC
// in the PWM off time.

htim4.Instance = TIM4;
// dummy value, will be reconfigured by BSPInit()
htim4.Init.Prescaler = 10; // 2 MHz timer clock/1000 = 2 kHz tick rate
htim4.Init.Prescaler = 10; // 2 MHz timer clock/10 = 200 kHz tick rate

// pwm out is 10k from tim3, we want to run our PWM at around 10hz or slower on the output stage
// These values give a rate of around 3.5 Hz for "fast" mode and 1.84 Hz for "slow"
htim4.Init.CounterMode = TIM_COUNTERMODE_UP;
htim4.Init.Period = 255;
htim4.Init.Period = 64;

htim4.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1; // 8 MHz (x2 APB1) before divide
htim4.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@

#define HARDWARE_MAX_WATTAGE_X10 600

#define TIP_THERMAL_MASS 8 // X10 watts to raise 1 deg C in 1 second
#define TIP_THERMAL_MASS 10 // X10 watts to raise 1 deg C in 1 second
#define TIP_THERMAL_INERTIA 128 // We use a large inertia value to smooth out the drive to the tip since its stupidly sensitive

#define TIP_RESISTANCE 20 //(actually 2.5 ish but we need to be more conservative on pwm'ing watt limit) x10 ohms
Expand All @@ -162,6 +162,7 @@
#define TEMP_NTC
#define I2C_SOFT_BUS_2 // For now we are doing software I2C to get around hardware chip issues
#define OLED_I2CBB2
#define FILTER_DISPLAYED_TIP_TEMP 4 // Filtering for GUI display

#define MODEL_HAS_DCDC // We dont have DC/DC but have reallly fast PWM that gets us roughly the same place
#endif /* S60 */
Expand All @@ -179,7 +180,7 @@

#define HARDWARE_MAX_WATTAGE_X10 600

#define TIP_THERMAL_MASS 8 // X10 watts to raise 1 deg C in 1 second
#define TIP_THERMAL_MASS 10 // X10 watts to raise 1 deg C in 1 second
#define TIP_THERMAL_INERTIA 128 // We use a large inertia value to smooth out the drive to the tip since its stupidly sensitive

#define TIP_RESISTANCE 20 //(actually 2.5 ish but we need to be more conservative on pwm'ing watt limit) x10 ohms
Expand All @@ -193,6 +194,7 @@
#define TEMP_NTC
#define I2C_SOFT_BUS_2 // For now we are doing software I2C to get around hardware chip issues
#define OLED_I2CBB2
#define FILTER_DISPLAYED_TIP_TEMP 4 // Filtering for GUI display

#define MODEL_HAS_DCDC // We dont have DC/DC but have reallly fast PWM that gets us roughly the same place
#endif /* S60P */
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion source/Core/Drivers/FS2711.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ void FS2711::negotiate() {
// FS2711 uses mV instead of V
const uint16_t vmax = USB_PD_VMAX * 1000;
uint8_t tip_resistance = getTipResistanceX10();
if (getSettingValue(SettingsOptions::USBPDMode) == 1) {
if (getSettingValue(SettingsOptions::USBPDMode) == usbpdMode_t::DEFAULT) {
tip_resistance += 5;
}

Expand Down
1 change: 1 addition & 0 deletions source/Core/Drivers/OLED.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ class OLED {
static void drawBattery(uint8_t state) { drawSymbol(3 + (state > 10 ? 10 : state)); }
// Draws a checkbox
static void drawCheckbox(bool state) { drawSymbol((state) ? 16 : 17); }
inline static void drawUnavailableIcon() { drawArea(OLED_WIDTH - 16 - 2, 0, 16, 16, UnavailableIcon); }
static void debugNumber(int32_t val, FontStyle fontStyle);
static void drawHex(uint32_t x, FontStyle fontStyle, uint8_t digits);
static void drawSymbol(uint8_t symbolID); // Used for drawing symbols of a predictable width
Expand Down
2 changes: 1 addition & 1 deletion source/Core/Drivers/USBPD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ bool parseCapabilitiesArray(const uint8_t numCaps, uint8_t *bestIndex, uint16_t

// Fudge of 0.5 ohms to round up a little to account for us always having off periods in PWM
uint8_t tipResistance = getTipResistanceX10();
if (getSettingValue(SettingsOptions::USBPDMode) == 1) {
if (getSettingValue(SettingsOptions::USBPDMode) == usbpdMode_t::DEFAULT) {
tipResistance += 5;
}
#ifdef MODEL_HAS_DCDC
Expand Down
4 changes: 2 additions & 2 deletions source/Core/Drivers/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ int32_t Utils::LinearInterpolate(int32_t x1, int32_t y1, int32_t x2, int32_t y2,

uint16_t Utils::RequiredCurrentForTipAtVoltage(uint16_t voltageX10) {
uint8_t tipResistancex10 = getTipResistanceX10();
if (getSettingValue(SettingsOptions::USBPDMode) == 1) {
if (getSettingValue(SettingsOptions::USBPDMode) == usbpdMode_t::DEFAULT) {
tipResistancex10 += 5;
}
#ifdef MODEL_HAS_DCDC
Expand All @@ -34,4 +34,4 @@ uint16_t Utils::RequiredCurrentForTipAtVoltage(uint16_t voltageX10) {
// V/R = I
uint16_t currentX10 = (voltageX10 * 10) / tipResistancex10;
return currentX10;
}
}
6 changes: 6 additions & 0 deletions source/Core/Inc/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ typedef enum {
INFINITY = 6, // Show boot logo on repeat (if animated) until a button toggled
} logoMode_t;

typedef enum {
DEFAULT = 1, // PPS + EPR + more power request through increasing resistance by 0.5 Ohm to compensate power loss over cable/PCB/etc.
SAFE = 2, // PPS + EPR, without requesting more power
NO_DYNAMIC = 0, // PPS + EPR disabled, fixed PDO only
} usbpdMode_t;

// Settings wide operations
void saveSettings();
bool loadSettings();
Expand Down
Loading

0 comments on commit 1e12d12

Please sign in to comment.