* Show power source type on detailed screen in soldering mode (#1708) * Update according to code review
This commit is contained in:
@@ -188,8 +188,8 @@ def get_power_source_list() -> List[str]:
|
|||||||
return [
|
return [
|
||||||
"DC",
|
"DC",
|
||||||
"QC",
|
"QC",
|
||||||
"PD W. VBus",
|
"PV:PDwVBus",
|
||||||
"PD No VBus",
|
"PD:No VBus",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -404,14 +404,14 @@ void OLED::setInverseDisplay(bool inverse) {
|
|||||||
I2C_CLASS::I2C_RegisterWrite(DEVICEADDR_OLED, 0x80, normalInverseCmd);
|
I2C_CLASS::I2C_RegisterWrite(DEVICEADDR_OLED, 0x80, normalInverseCmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
// print a string to the current cursor location
|
// print a string to the current cursor location, len chars MAX
|
||||||
void OLED::print(const char *const str, FontStyle fontStyle) {
|
void OLED::print(const char *const str, FontStyle fontStyle, uint8_t len) {
|
||||||
const uint8_t *next = reinterpret_cast<const uint8_t *>(str);
|
const uint8_t *next = reinterpret_cast<const uint8_t *>(str);
|
||||||
if (next[0] == 0x01) {
|
if (next[0] == 0x01) {
|
||||||
fontStyle = FontStyle::LARGE;
|
fontStyle = FontStyle::LARGE;
|
||||||
next++;
|
next++;
|
||||||
}
|
}
|
||||||
while (next[0]) {
|
while (next[0] && len--) {
|
||||||
uint16_t index;
|
uint16_t index;
|
||||||
if (next[0] <= 0xF0) {
|
if (next[0] <= 0xF0) {
|
||||||
index = next[0];
|
index = next[0];
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ public:
|
|||||||
static void setBrightness(uint8_t contrast);
|
static void setBrightness(uint8_t contrast);
|
||||||
static void setInverseDisplay(bool inverted);
|
static void setInverseDisplay(bool inverted);
|
||||||
static int16_t getCursorX() { return cursor_x; }
|
static int16_t getCursorX() { return cursor_x; }
|
||||||
static void print(const char *string, FontStyle fontStyle); // Draw a string to the current location, with selected font
|
static void print(const char *string, FontStyle fontStyle, uint8_t length = 255); // Draw a string to the current location, with selected font; optionally - with MAX length only
|
||||||
static void printWholeScreen(const char *string);
|
static void printWholeScreen(const char *string);
|
||||||
// Set the cursor location by pixels
|
// Set the cursor location by pixels
|
||||||
static void setCursor(int16_t x, int16_t y) {
|
static void setCursor(int16_t x, int16_t y) {
|
||||||
|
|||||||
@@ -35,39 +35,8 @@ void showDebugMenu(void) {
|
|||||||
OLED::print(AccelTypeNames[(int)DetectedAccelerometerVersion], FontStyle::SMALL);
|
OLED::print(AccelTypeNames[(int)DetectedAccelerometerVersion], FontStyle::SMALL);
|
||||||
break;
|
break;
|
||||||
case 3: // Power Negotiation Status
|
case 3: // Power Negotiation Status
|
||||||
{
|
OLED::print(PowerSourceNames[getPowerSourceNumber()], FontStyle::SMALL);
|
||||||
int sourceNumber = 0;
|
break;
|
||||||
if (getIsPoweredByDCIN()) {
|
|
||||||
sourceNumber = 0;
|
|
||||||
} else {
|
|
||||||
// We are not powered via DC, so want to display the appropriate state for PD or QC
|
|
||||||
bool poweredbyPD = false;
|
|
||||||
bool pdHasVBUSConnected = false;
|
|
||||||
#ifdef POW_PD
|
|
||||||
if (USBPowerDelivery::fusbPresent()) {
|
|
||||||
// We are PD capable
|
|
||||||
if (USBPowerDelivery::negotiationComplete()) {
|
|
||||||
// We are powered via PD
|
|
||||||
poweredbyPD = true;
|
|
||||||
#ifdef VBUS_MOD_TEST
|
|
||||||
pdHasVBUSConnected = USBPowerDelivery::isVBUSConnected();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (poweredbyPD) {
|
|
||||||
|
|
||||||
if (pdHasVBUSConnected) {
|
|
||||||
sourceNumber = 2;
|
|
||||||
} else {
|
|
||||||
sourceNumber = 3;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
sourceNumber = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
OLED::print(PowerSourceNames[sourceNumber], FontStyle::SMALL);
|
|
||||||
} break;
|
|
||||||
case 4: // Input Voltage
|
case 4: // Input Voltage
|
||||||
printVoltage();
|
printVoltage();
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -33,15 +33,18 @@ enum OperatingMode {
|
|||||||
debug = 5
|
debug = 5
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Main functions
|
||||||
void performCJCC(void); // Used to calibrate the Cold Junction offset
|
void performCJCC(void); // Used to calibrate the Cold Junction offset
|
||||||
void gui_solderingTempAdjust(void); // For adjusting the setpoint temperature of the iron
|
void gui_solderingTempAdjust(void); // For adjusting the setpoint temperature of the iron
|
||||||
int gui_SolderingSleepingMode(bool stayOff, bool autoStarted); // Sleep mode
|
int gui_SolderingSleepingMode(bool stayOff, bool autoStarted); // Sleep mode
|
||||||
void gui_solderingMode(uint8_t jumpToSleep); // Main mode for hot pointy tool
|
void gui_solderingMode(uint8_t jumpToSleep); // Main mode for hot pointy tool
|
||||||
void gui_solderingProfileMode(); // Profile mode for hot likely-not-so-pointy tool
|
void gui_solderingProfileMode(); // Profile mode for hot likely-not-so-pointy tool
|
||||||
void showDebugMenu(void); // Debugging values
|
void showDebugMenu(void); // Debugging values
|
||||||
void showPDDebug(void); // Debugging menu that hows PD adaptor info
|
void showPDDebug(void); // Debugging menu that shows PD adaptor info
|
||||||
void showWarnings(void); // Shows user warnings if required
|
void showWarnings(void); // Shows user warnings if required
|
||||||
void drawHomeScreen(bool buttonLockout) __attribute__((noreturn)); // IDLE / Home screen
|
void drawHomeScreen(bool buttonLockout) __attribute__((noreturn)); // IDLE / Home screen
|
||||||
void renderHomeScreenAssets(void); // Called to act as start delay and used to render out flipped images for home screen graphics
|
void renderHomeScreenAssets(void); // Called to act as start delay and used to render out flipped images for home screen graphics
|
||||||
//
|
|
||||||
|
// Common helpers
|
||||||
|
int8_t getPowerSourceNumber(void); // Returns number ID of power source
|
||||||
#endif
|
#endif
|
||||||
@@ -129,6 +129,13 @@ void gui_solderingMode(uint8_t jumpToSleep) {
|
|||||||
OLED::setCursor(55, 8);
|
OLED::setCursor(55, 8);
|
||||||
}
|
}
|
||||||
OLED::print(SmallSymbolPlus, FontStyle::SMALL);
|
OLED::print(SmallSymbolPlus, FontStyle::SMALL);
|
||||||
|
} else {
|
||||||
|
if (OLED::getRotation()) {
|
||||||
|
OLED::setCursor(32, 8);
|
||||||
|
} else {
|
||||||
|
OLED::setCursor(47, 8);
|
||||||
|
}
|
||||||
|
OLED::print(PowerSourceNames[getPowerSourceNumber()], FontStyle::SMALL, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
detailedPowerStatus();
|
detailedPowerStatus();
|
||||||
|
|||||||
@@ -121,3 +121,36 @@ bool checkExitSoldering(void) {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int8_t getPowerSourceNumber(void) {
|
||||||
|
int8_t sourceNumber = 0;
|
||||||
|
if (getIsPoweredByDCIN()) {
|
||||||
|
sourceNumber = 0;
|
||||||
|
} else {
|
||||||
|
// We are not powered via DC, so want to display the appropriate state for PD or QC
|
||||||
|
bool poweredbyPD = false;
|
||||||
|
bool pdHasVBUSConnected = false;
|
||||||
|
#ifdef POW_PD
|
||||||
|
if (USBPowerDelivery::fusbPresent()) {
|
||||||
|
// We are PD capable
|
||||||
|
if (USBPowerDelivery::negotiationComplete()) {
|
||||||
|
// We are powered via PD
|
||||||
|
poweredbyPD = true;
|
||||||
|
#ifdef VBUS_MOD_TEST
|
||||||
|
pdHasVBUSConnected = USBPowerDelivery::isVBUSConnected();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
if (poweredbyPD) {
|
||||||
|
if (pdHasVBUSConnected) {
|
||||||
|
sourceNumber = 2;
|
||||||
|
} else {
|
||||||
|
sourceNumber = 3;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sourceNumber = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sourceNumber;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user