Merge remote-tracking branch 'upstream/dev' into dev

This commit is contained in:
jonasius
2024-08-07 20:39:30 +02:00
91 changed files with 2413 additions and 1654 deletions

View File

@@ -53,6 +53,7 @@ static const uint16_t NTCHandleLookup[] = {
};
uint16_t getHandleTemperature(uint8_t sample) {
#ifdef TMP36_ADC1_CHANNEL
int32_t result = getADCHandleTemp(sample);
// S60 uses 10k NTC resistor
// For now not doing interpolation
@@ -62,6 +63,9 @@ uint16_t getHandleTemperature(uint8_t sample) {
}
}
return 45 * 10;
#else
return 0; // Not implemented
#endif
}
uint16_t getInputVoltageX10(uint16_t divisor, uint8_t sample) {
@@ -172,7 +176,25 @@ uint64_t getDeviceID() {
return HAL_GetUIDw0() | ((uint64_t)HAL_GetUIDw1() << 32);
}
uint8_t getTipResistanceX10() { return TIP_RESISTANCE; }
uint8_t getTipResistanceX10() {
#ifdef COPPER_HEATER_COIL
// TODO
//! Warning, must never return 0.
TemperatureType_t measuredTemperature = TipThermoModel::getTipInC(false);
if (measuredTemperature < 25) {
return 50; // Start assuming under spec to soft-start
}
// Assuming a temperature rise of 0.00393 per deg c over 20C
uint32_t scaler = 393 * (measuredTemperature - 20);
return TIP_RESISTANCE + ((TIP_RESISTANCE * scaler) / 100000);
#else
return TIP_RESISTANCE;
#endif
}
bool isTipShorted() { return false; }
uint8_t preStartChecksDone() { return 1; }
@@ -182,3 +204,7 @@ uint16_t getTipInertia() { return TIP_THERMAL_INERTIA; }
void setBuzzer(bool on) {}
void showBootLogo(void) { BootLogo::handleShowingLogo((uint8_t *)FLASH_LOGOADDR); }
#ifdef CUSTOM_MAX_TEMP_C
TemperatureType_t getCustomTipMaxInC() { return MAX_TEMP_C; }
#endif