Update configuration #defines

More backported functions
This commit is contained in:
Ben V. Brown
2022-07-25 21:08:08 +10:00
parent bab66acaad
commit e0ec44c10d
11 changed files with 200 additions and 182 deletions

View File

@@ -26,7 +26,7 @@ void resetWatchdog() { HAL_IWDG_Refresh(&hiwdg); }
#ifdef TEMP_NTC #ifdef TEMP_NTC
// Lookup table for the NTC // Lookup table for the NTC
// Stored as ADCReading,Temp in degC // Stored as ADCReading,Temp in degC
static const uint16_t NTCHandleLookup[] = { static const int32_t NTCHandleLookup[] = {
// ADC Reading , Temp in Cx10 // ADC Reading , Temp in Cx10
808, 1600, // 808, 1600, //
832, 1590, // 832, 1590, //
@@ -475,3 +475,7 @@ uint64_t getDeviceID() {
// //
return HAL_GetUIDw0() | ((uint64_t)HAL_GetUIDw1() << 32); return HAL_GetUIDw0() | ((uint64_t)HAL_GetUIDw1() << 32);
} }
uint8_t preStartChecksDone() { return 1; }
uint8_t getTipThermalMass() { return TIP_THERMAL_MASS; }

View File

@@ -74,6 +74,9 @@
#define POWER_PULSE_WAIT_MAX 9 // 9*2.5s = 22.5 seconds #define POWER_PULSE_WAIT_MAX 9 // 9*2.5s = 22.5 seconds
#define POWER_PULSE_DURATION_MAX 9 // 9*250ms = 2.25 seconds #define POWER_PULSE_DURATION_MAX 9 // 9*250ms = 2.25 seconds
#define ADC_MAX_READING (4096 * 8) // Maximum reading of the adc
#define ADC_VDD_MV 3300 // ADC max reading millivolts
#ifdef MODEL_TS100 #ifdef MODEL_TS100
#define POWER_PULSE_DEFAULT 0 #define POWER_PULSE_DEFAULT 0
#else #else

View File

@@ -154,7 +154,7 @@ uint8_t lastTipResistance = 0; // default to unknown
const uint8_t numTipResistanceReadings = 3; const uint8_t numTipResistanceReadings = 3;
uint32_t tipResistanceReadings[3] = {0, 0, 0}; uint32_t tipResistanceReadings[3] = {0, 0, 0};
uint8_t tipResistanceReadingSlot = 0; uint8_t tipResistanceReadingSlot = 0;
uint8_t getTipResitanceX10() { uint8_t getTipResistanceX10() {
// Return tip resistance in x10 ohms // Return tip resistance in x10 ohms
// We can measure this using the op-amp // We can measure this using the op-amp
return lastTipResistance; return lastTipResistance;

View File

@@ -142,6 +142,7 @@
#define POW_QC_20V 1 // Supported features #define POW_QC_20V 1 // Supported features
#define POW_EPR 1 #define POW_EPR 1
#define ENABLE_QC2 1 #define ENABLE_QC2 1
#define DEVICE_HAS_VALIDATION_SUPPORT
#define TEMP_NTC #define TEMP_NTC
#define ACCEL_BMA #define ACCEL_BMA
#define ACCEL_SC7 #define ACCEL_SC7

View File

@@ -290,3 +290,5 @@ uint64_t getDeviceID() {
} }
uint8_t getTipResistanceX10() { return TIP_RESISTANCE; } uint8_t getTipResistanceX10() { return TIP_RESISTANCE; }
uint8_t getTipThermalMass() { return TIP_THERMAL_MASS; }

View File

@@ -114,6 +114,9 @@
#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))
#define ADC_MAX_READING (4096 * 8) // Maximum reading of the adc
#define ADC_VDD_MV 3300 // ADC max reading millivolts
// Deriving the Voltage div: // Deriving the Voltage div:
// Vin_max = (3.3*(r1+r2))/(r2) // Vin_max = (3.3*(r1+r2))/(r2)
// vdiv = (32768*4)/(vin_max*10) // vdiv = (32768*4)/(vin_max*10)

View File

@@ -95,3 +95,7 @@ uint8_t preStartChecks() { return 0; }
uint64_t getDeviceID() { return dbg_id_get(); } uint64_t getDeviceID() { return dbg_id_get(); }
uint8_t getTipResistanceX10() { return TIP_RESISTANCE; } uint8_t getTipResistanceX10() { return TIP_RESISTANCE; }
uint8_t preStartChecksDone() { return 1; }
uint8_t getTipThermalMass() { return TIP_THERMAL_MASS; }

View File

@@ -9,7 +9,7 @@
#include "configuration.h" #include "configuration.h"
#ifdef TEMP_uV_LOOKUP_HAKKO #ifdef TEMP_uV_LOOKUP_HAKKO
const uint16_t uVtoDegC[] = { const int32_t uVtoDegC[] = {
// //
// uv -> temp in C // uv -> temp in C
0, 0, // 0, 0, //

View File

@@ -109,6 +109,9 @@
#define OP_AMP_GAIN_STAGE_PINECIL (1 + (OP_AMP_Rf_Pinecil / OP_AMP_Rin_Pinecil)) #define OP_AMP_GAIN_STAGE_PINECIL (1 + (OP_AMP_Rf_Pinecil / OP_AMP_Rin_Pinecil))
#define ADC_MAX_READING (4096 * 8) // Maximum reading of the adc
#define ADC_VDD_MV 3300 // ADC max reading millivolts
#if defined(MODEL_Pinecil) == 0 #if defined(MODEL_Pinecil) == 0
#error "No model defined!" #error "No model defined!"
#endif #endif

View File

@@ -4,7 +4,6 @@
#include "BSP_PD.h" #include "BSP_PD.h"
#include "FreeRTOS.h" #include "FreeRTOS.h"
#include "bflb_platform.h"
#include "fusb302b.h" #include "fusb302b.h"
#include "main.hpp" #include "main.hpp"
#include "pd.h" #include "pd.h"
@@ -66,10 +65,6 @@ bool USBPowerDelivery::fusbPresent() {
return detectionState == 1; return detectionState == 1;
} }
void USBPowerDelivery::triggerRenegotiation() {
// TODO; trigger the source to send its capabilities again
}
bool USBPowerDelivery::isVBUSConnected() { bool USBPowerDelivery::isVBUSConnected() {
static uint8_t state = 0; static uint8_t state = 0;
if (state) { if (state) {

View File

@@ -776,9 +776,10 @@ void showDebugMenu(void) {
break; break;
case 11: case 11:
// Tip resistance // Tip resistance
OLED::printNumber(getTipResitanceX10() / 10, 4, FontStyle::SMALL); // large to pad over so that we cover ID left overs OLED::printNumber(getTipResistanceX10() / 10, 4, FontStyle::SMALL); // large to pad over so that we cover ID left overs
OLED::print(SymbolDot, FontStyle::SMALL); OLED::print(SymbolDot, FontStyle::SMALL);
OLED::printNumber(getTipResitanceX10() % 10, 1, FontStyle::SMALL); OLED::printNumber(getTipResistanceX10() % 10, 1, FontStyle::SMALL);
break;
case 12: case 12:
// High water mark for GUI // High water mark for GUI
OLED::printNumber(uxTaskGetStackHighWaterMark(GUITaskHandle), 5, FontStyle::SMALL); OLED::printNumber(uxTaskGetStackHighWaterMark(GUITaskHandle), 5, FontStyle::SMALL);
@@ -920,10 +921,12 @@ void showWarnings() {
if (settingsWereReset) { if (settingsWereReset) {
warnUser(translatedString(Tr->SettingsResetMessage), 10 * TICKS_SECOND); warnUser(translatedString(Tr->SettingsResetMessage), 10 * TICKS_SECOND);
} }
#ifdef DEVICE_HAS_VALIDATION_SUPPORT
if (getDeviceValidationStatus()) { if (getDeviceValidationStatus()) {
// Warn user this device might be counterfeit // Warn user this device might be counterfeit
warnUser(translatedString(Tr->DeviceFailedValidationWarning), 10 * TICKS_SECOND); warnUser(translatedString(Tr->DeviceFailedValidationWarning), 10 * TICKS_SECOND);
} }
#endif
#ifndef NO_WARN_MISSING #ifndef NO_WARN_MISSING
// We also want to alert if accel or pd is not detected / not responding // We also want to alert if accel or pd is not detected / not responding
// In this case though, we dont want to nag the user _too_ much // In this case though, we dont want to nag the user _too_ much