mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Show validation code
This commit is contained in:
@@ -77,6 +77,9 @@ bool isTipDisconnected();
|
||||
// Return hardware unique ID if possible
|
||||
uint64_t getDeviceID();
|
||||
|
||||
// If device has burned in validation code's, return the code
|
||||
uint32_t getDeviceValidation();
|
||||
|
||||
// Status LED controls
|
||||
|
||||
enum StatusLED {
|
||||
|
||||
@@ -296,5 +296,23 @@ uint64_t getDeviceID() {
|
||||
// return tmp | (((uint64_t)tmp2) << 32);
|
||||
uint64_t tmp = 0;
|
||||
EF_Ctrl_Read_Chip_ID((uint8_t *)&tmp);
|
||||
return tmp;
|
||||
|
||||
return __builtin_bswap64(tmp);
|
||||
}
|
||||
|
||||
uint32_t getDeviceValidation() {
|
||||
uint32_t userData = 0;
|
||||
EF_Ctrl_Read_Sw_Usage(0, &userData);
|
||||
// 4 byte user data burned in at factory
|
||||
|
||||
return userData;
|
||||
}
|
||||
|
||||
uint8_t getDeviceValidationStatus() {
|
||||
uint32_t userData = 0;
|
||||
EF_Ctrl_Read_Sw_Usage(0, &userData);
|
||||
userData &= 0xFFFF; // We only want the lower two bytes
|
||||
userData = 0xDEAD; // TODO TESTING KEY
|
||||
|
||||
return 1; // Device is OK
|
||||
}
|
||||
@@ -115,32 +115,32 @@
|
||||
#endif
|
||||
|
||||
#ifdef MODEL_Magic
|
||||
#define ADC_VDD_MV 3300 // ADC max reading millivolts
|
||||
#define ADC_MAX_READING (62000 >> 1) // Maximum reading of the adc
|
||||
#define SOLDERING_TEMP 320 // Default soldering temp is 320.0 °C
|
||||
#define VOLTAGE_DIV 600 // 600 - Default divider from schematic
|
||||
#define CALIBRATION_OFFSET 900 // 900 - Default adc offset in uV
|
||||
#define MIN_CALIBRATION_OFFSET 100 // Min value for calibration
|
||||
#define PID_POWER_LIMIT 220 // Sets the max pwm power limit
|
||||
#define POWER_LIMIT 0 // 0 watts default limit
|
||||
#define MAX_POWER_LIMIT 220 //
|
||||
#define POWER_LIMIT_STEPS 5 //
|
||||
#define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_PINECIL // Uses TS100 resistors
|
||||
#define TEMP_uV_LOOKUP_HAKKO // Use Hakko lookup table
|
||||
#define USB_PD_VMAX 20 // Maximum voltage for PD to negotiate
|
||||
#define PID_TIM_HZ (10) // Tick rate of the PID loop
|
||||
#define MAX_TEMP_C 450 // Max soldering temp selectable °C
|
||||
#define MAX_TEMP_F 850 // Max soldering temp selectable °F
|
||||
#define MIN_TEMP_C 10 // Min soldering temp selectable °C
|
||||
#define MIN_TEMP_F 60 // Min soldering temp selectable °F
|
||||
#define MIN_BOOST_TEMP_C 250 // The min settable temp for boost mode °C
|
||||
#define MIN_BOOST_TEMP_F 480 // The min settable temp for boost mode °F
|
||||
|
||||
#define POW_PD 1
|
||||
#define POW_QC 1
|
||||
#define POW_DC 1
|
||||
#define POW_QC_20V 1
|
||||
#define ENABLE_QC2 1
|
||||
#define ADC_VDD_MV 3300 // ADC max reading millivolts
|
||||
#define ADC_MAX_READING (62000 >> 1) // Maximum reading of the adc
|
||||
#define SOLDERING_TEMP 320 // Default soldering temp is 320.0 °C
|
||||
#define VOLTAGE_DIV 600 // 600 - Default divider from schematic
|
||||
#define CALIBRATION_OFFSET 900 // 900 - Default adc offset in uV
|
||||
#define MIN_CALIBRATION_OFFSET 100 // Min value for calibration
|
||||
#define PID_POWER_LIMIT 220 // Sets the max pwm power limit
|
||||
#define POWER_LIMIT 0 // 0 watts default limit
|
||||
#define MAX_POWER_LIMIT 220 //
|
||||
#define POWER_LIMIT_STEPS 5 //
|
||||
#define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_PINECIL // Uses TS100 resistors
|
||||
#define TEMP_uV_LOOKUP_HAKKO // Use Hakko lookup table
|
||||
#define USB_PD_VMAX 20 // Maximum voltage for PD to negotiate
|
||||
#define PID_TIM_HZ (10) // Tick rate of the PID loop
|
||||
#define MAX_TEMP_C 450 // Max soldering temp selectable °C
|
||||
#define MAX_TEMP_F 850 // Max soldering temp selectable °F
|
||||
#define MIN_TEMP_C 10 // Min soldering temp selectable °C
|
||||
#define MIN_TEMP_F 60 // Min soldering temp selectable °F
|
||||
#define MIN_BOOST_TEMP_C 250 // The min settable temp for boost mode °C
|
||||
#define MIN_BOOST_TEMP_F 480 // The min settable temp for boost mode °F
|
||||
#define DEVICE_HAS_VALIDATION_CODE // We have 2 digit validations
|
||||
#define POW_PD 1
|
||||
#define POW_QC 1
|
||||
#define POW_DC 1
|
||||
#define POW_QC_20V 1
|
||||
#define ENABLE_QC2 1
|
||||
#define TEMP_NTC
|
||||
#define ACCEL_BMA
|
||||
#define ACCEL_SC7
|
||||
|
||||
@@ -758,8 +758,14 @@ void showDebugMenu(void) {
|
||||
// Print device ID Numbers
|
||||
{
|
||||
uint64_t id = getDeviceID();
|
||||
OLED::drawHex((uint32_t)(id >> 32), FontStyle::SMALL, 2);
|
||||
|
||||
#ifdef DEVICE_HAS_VALIDATION_CODE
|
||||
// If device has validation code; then we want to take over both lines of the screen
|
||||
OLED::clearScreen(); // Ensure the buffer starts clean
|
||||
OLED::setCursor(0, 0); // Position the cursor at the 0,0 (top left)
|
||||
OLED::print(DebugMenu[screen], FontStyle::SMALL);
|
||||
OLED::drawHex(getDeviceValidation(), FontStyle::SMALL, 8);
|
||||
OLED::setCursor(0, 8); // second line
|
||||
#endif
|
||||
OLED::drawHex((uint32_t)(id >> 32), FontStyle::SMALL, 8);
|
||||
OLED::drawHex((uint32_t)(id & 0xFFFFFFFF), FontStyle::SMALL, 8);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user