Merge remote-tracking branch 'upstream/dev' into magic
This commit is contained in:
12
README.md
12
README.md
@@ -20,6 +20,18 @@ This project is considered feature complete for use as a soldering iron, _so ple
|
|||||||
|
|
||||||
_This firmware does **NOT** support the USB port while running for changing settings. This is done through the onscreen menu only. Logos are edited using the tool or python script and uploaded in DFU mode._
|
_This firmware does **NOT** support the USB port while running for changing settings. This is done through the onscreen menu only. Logos are edited using the tool or python script and uploaded in DFU mode._
|
||||||
|
|
||||||
|
|
||||||
|
| Device | DC Supported | QC Supported | PD Supported | Reccomended |
|
||||||
|
|--------: |:------------: |:------------: |:------------: |:-----------: |
|
||||||
|
| MHP30 | ❌ | ❌ | ✔️ | ✔️ |
|
||||||
|
| Pinecil | ✔️ | ✔️ | ✔️ | ✔️ |
|
||||||
|
| TS100 | ✔️ | ❌ | ❌ | ❌ |
|
||||||
|
| TS80 | ❌ | ✔️ | ❌ | ❌ |
|
||||||
|
| TS80P | ❌ | ✔️ | ✔️ | ✔️ |
|
||||||
|
|
||||||
|
Please note that Miniware have started to ship TS100's using cloned STM32 Chips. While these do work with IronOS, their DFU bootloader works terribly and it is hard to get it to successfully flash larger firmware images like IronOS without timing out. THis is the main reason why the TS100 is _no longer reccomended_.
|
||||||
|
|
||||||
|
|
||||||
## Getting Started
|
## Getting Started
|
||||||
|
|
||||||
To get started with IronOS firmware, please jump to [Getting Started Guide](Documentation/GettingStarted.md).
|
To get started with IronOS firmware, please jump to [Getting Started Guide](Documentation/GettingStarted.md).
|
||||||
|
|||||||
@@ -80,8 +80,8 @@
|
|||||||
"desc": "Délai avant mise en veille (s=secondes | m=minutes)"
|
"desc": "Délai avant mise en veille (s=secondes | m=minutes)"
|
||||||
},
|
},
|
||||||
"ShutdownTimeout": {
|
"ShutdownTimeout": {
|
||||||
"text2": ["Délai", "extinction"],
|
"text2": ["Délai", "arrêt"],
|
||||||
"desc": "Délai avant extinction (m=minutes)"
|
"desc": "Délai avant l'arrêt du fer à souder (m=minutes)"
|
||||||
},
|
},
|
||||||
"MotionSensitivity": {
|
"MotionSensitivity": {
|
||||||
"text2": ["Sensibilité", "au mouvement"],
|
"text2": ["Sensibilité", "au mouvement"],
|
||||||
@@ -136,7 +136,7 @@
|
|||||||
"desc": "Tension maximale désirée avec une alimentation QC"
|
"desc": "Tension maximale désirée avec une alimentation QC"
|
||||||
},
|
},
|
||||||
"PDNegTimeout": {
|
"PDNegTimeout": {
|
||||||
"text2": ["Délai", "expiration PD"],
|
"text2": ["Délai", "expir. PD"],
|
||||||
"desc": "Délai de la negociation PD par étapes de 100ms pour la compatiblité avec certains chargeurs QC"
|
"desc": "Délai de la negociation PD par étapes de 100ms pour la compatiblité avec certains chargeurs QC"
|
||||||
},
|
},
|
||||||
"PowerLimit": {
|
"PowerLimit": {
|
||||||
@@ -156,17 +156,17 @@
|
|||||||
"desc": "Incrément de changement de température sur appui long"
|
"desc": "Incrément de changement de température sur appui long"
|
||||||
},
|
},
|
||||||
"PowerPulsePower": {
|
"PowerPulsePower": {
|
||||||
"text2": ["Puissance des", "impulsions"],
|
"text2": ["Puissance", "impulsions"],
|
||||||
"desc": "Puissance des impulsions pour éviter la mise en veille des batteries (watts)"
|
"desc": "Puissance des impulsions pour éviter la mise en veille des batteries (watts)"
|
||||||
},
|
},
|
||||||
"LockingMode": {
|
|
||||||
"text2": ["Verrouiller", "les boutons"],
|
|
||||||
"desc": "Pendant la soudure, appuyer sur les deux boutons pour les verrouiller (D=désactivé | B=boost seulement | V=verr. total)"
|
|
||||||
},
|
|
||||||
"HallEffSensitivity": {
|
"HallEffSensitivity": {
|
||||||
"text2": ["Sensibilité", "capteur effet hall"],
|
"text2": ["Sensibilité", "capteur effet hall"],
|
||||||
"desc": "Sensibilité du capteur à effet Hall pour la mise en veille (0=désactivé | 1=peu sensible | ... | 9=très sensible)"
|
"desc": "Sensibilité du capteur à effet Hall pour la mise en veille (0=désactivé | 1=peu sensible | ... | 9=très sensible)"
|
||||||
},
|
},
|
||||||
|
"LockingMode": {
|
||||||
|
"text2": ["Verrouiller", "les boutons"],
|
||||||
|
"desc": "Pendant la soudure, appuyer sur les deux boutons pour les verrouiller (D=désactivé | B=boost seulement | V=verr. total)"
|
||||||
|
},
|
||||||
"MinVolCell": {
|
"MinVolCell": {
|
||||||
"text2": ["Tension", "minimale"],
|
"text2": ["Tension", "minimale"],
|
||||||
"desc": "Tension minimale autorisée par cellule (3S: 3 - 3.7V | 4-6S: 2.4 - 3.7V)"
|
"desc": "Tension minimale autorisée par cellule (3S: 3 - 3.7V | 4-6S: 2.4 - 3.7V)"
|
||||||
@@ -193,15 +193,15 @@
|
|||||||
},
|
},
|
||||||
"Brightness": {
|
"Brightness": {
|
||||||
"text2": ["Luminosité", "de l'écran"],
|
"text2": ["Luminosité", "de l'écran"],
|
||||||
"desc": "Ajuster le contraste/luminosité de l'écran OLED"
|
"desc": "Ajuster la luminosité de l'écran OLED"
|
||||||
},
|
},
|
||||||
"ColourInversion": {
|
"ColourInversion": {
|
||||||
"text2": ["Inverser", "les couleurs"],
|
"text2": ["Inverser", "les couleurs"],
|
||||||
"desc": "Inverser les couleurs de l'écran OLED"
|
"desc": "Inverser les couleurs de l'écran OLED"
|
||||||
},
|
},
|
||||||
"LOGOTime": {
|
"LOGOTime": {
|
||||||
"text2": ["Boot logo", "duration"],
|
"text2": ["Durée logo", "au démarrage"],
|
||||||
"desc": "Sets the duration for the boot logo (s=seconds)"
|
"desc": "Définit la durée d'affichage du logo au démarrage (s=secondes)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,8 +132,8 @@
|
|||||||
"desc": "Szybkość przewijania tekstu"
|
"desc": "Szybkość przewijania tekstu"
|
||||||
},
|
},
|
||||||
"QCMaxVoltage": {
|
"QCMaxVoltage": {
|
||||||
"text2": ["Moc", "w W"],
|
"text2": ["QC", "napięcie"],
|
||||||
"desc": "Moc używanego zasilacza w (W)"
|
"desc": "Maksymalne napięcie, które lutownica będzie próbowała wynegocjować z ładowarką Quick Charge (V)"
|
||||||
},
|
},
|
||||||
"PDNegTimeout": {
|
"PDNegTimeout": {
|
||||||
"text2": ["Limit czasu", "PD"],
|
"text2": ["Limit czasu", "PD"],
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ extern "C" {
|
|||||||
void power_check();
|
void power_check();
|
||||||
|
|
||||||
// Returns the tip resistance in x10 ohms, so 7.5 = 75; 14=140 etc
|
// Returns the tip resistance in x10 ohms, so 7.5 = 75; 14=140 etc
|
||||||
uint8_t getTipResitanceX10();
|
uint8_t getTipResistanceX10();
|
||||||
|
|
||||||
uint8_t getTipThermalMass();
|
uint8_t getTipThermalMass();
|
||||||
|
|
||||||
|
|||||||
@@ -17,3 +17,5 @@ void power_check() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool getIsPoweredByDCIN() { return false; }
|
bool getIsPoweredByDCIN() { return false; }
|
||||||
|
|
||||||
|
uint8_t getTipResistanceX10() { return TIP_RESISTANCE; }
|
||||||
@@ -27,7 +27,8 @@
|
|||||||
|
|
||||||
#ifndef PORTMACRO_H
|
#ifndef PORTMACRO_H
|
||||||
#define PORTMACRO_H
|
#define PORTMACRO_H
|
||||||
|
#include "FreeRTOSConfig.h"
|
||||||
|
#include "projdefs.h"
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -288,3 +288,5 @@ uint64_t getDeviceID() {
|
|||||||
//
|
//
|
||||||
return HAL_GetUIDw0() | ((uint64_t)HAL_GetUIDw1() << 32);
|
return HAL_GetUIDw0() | ((uint64_t)HAL_GetUIDw1() << 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t getTipResistanceX10() { return TIP_RESISTANCE; }
|
||||||
@@ -100,7 +100,7 @@ extern uint32_t SystemCoreClock;
|
|||||||
#define configUSE_IDLE_HOOK 1
|
#define configUSE_IDLE_HOOK 1
|
||||||
#define configUSE_TICK_HOOK 0
|
#define configUSE_TICK_HOOK 0
|
||||||
#define configCPU_CLOCK_HZ (SystemCoreClock)
|
#define configCPU_CLOCK_HZ (SystemCoreClock)
|
||||||
#define configTICK_RATE_HZ ((TickType_t)1000)
|
#define configTICK_RATE_HZ (1000)
|
||||||
#define configMAX_PRIORITIES (6)
|
#define configMAX_PRIORITIES (6)
|
||||||
#define configMINIMAL_STACK_SIZE ((uint16_t)256)
|
#define configMINIMAL_STACK_SIZE ((uint16_t)256)
|
||||||
#define configTOTAL_HEAP_SIZE ((size_t)1024 * 14) /*Currently use about 9000*/
|
#define configTOTAL_HEAP_SIZE ((size_t)1024 * 14) /*Currently use about 9000*/
|
||||||
|
|||||||
@@ -27,6 +27,8 @@
|
|||||||
|
|
||||||
#ifndef PORTMACRO_H
|
#ifndef PORTMACRO_H
|
||||||
#define PORTMACRO_H
|
#define PORTMACRO_H
|
||||||
|
#include "FreeRTOSConfig.h"
|
||||||
|
#include "projdefs.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|||||||
@@ -93,3 +93,5 @@ void setStatusLED(const enum StatusLED state) {}
|
|||||||
|
|
||||||
uint8_t preStartChecks() { return 0; }
|
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; }
|
||||||
@@ -58,14 +58,9 @@ typedef portSTACK_TYPE StackType_t;
|
|||||||
typedef long BaseType_t;
|
typedef long BaseType_t;
|
||||||
typedef unsigned long UBaseType_t;
|
typedef unsigned long UBaseType_t;
|
||||||
|
|
||||||
#if (configUSE_16_BIT_TICKS == 1)
|
|
||||||
typedef uint16_t TickType_t;
|
|
||||||
#define portMAX_DELAY (TickType_t)0xffff
|
|
||||||
#else
|
|
||||||
/* RISC-V TIMER is 64-bit long */
|
/* RISC-V TIMER is 64-bit long */
|
||||||
typedef uint64_t TickType_t;
|
typedef uint64_t TickType_t;
|
||||||
#define portMAX_DELAY (TickType_t)0xFFFFFFFFFFFFFFFFULL
|
#define portMAX_DELAY (TickType_t)0xFFFFFFFFFFFFFFFFULL
|
||||||
#endif
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/* Architecture specifics. */
|
/* Architecture specifics. */
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
#include "settingsGUI.hpp"
|
#include "settingsGUI.hpp"
|
||||||
#include "task.h"
|
#include "task.h"
|
||||||
#include <Buttons.hpp>
|
#include <Buttons.hpp>
|
||||||
uint32_t lastButtonTime = 0;
|
TickType_t lastButtonTime = 0;
|
||||||
|
|
||||||
ButtonState getButtonState() {
|
ButtonState getButtonState() {
|
||||||
/*
|
/*
|
||||||
@@ -22,10 +22,11 @@ ButtonState getButtonState() {
|
|||||||
* press (buttons still down), or if release we trigger press
|
* press (buttons still down), or if release we trigger press
|
||||||
* (downtime>filter)
|
* (downtime>filter)
|
||||||
*/
|
*/
|
||||||
static uint8_t previousState = 0;
|
static uint8_t previousState = 0;
|
||||||
static uint32_t previousStateChange = 0;
|
static bool longPressed = false;
|
||||||
const uint16_t timeout = TICKS_100MS * 4;
|
static TickType_t previousStateChange = 0;
|
||||||
uint8_t currentState;
|
const TickType_t timeout = TICKS_100MS * 4;
|
||||||
|
uint8_t currentState;
|
||||||
currentState = (getButtonA()) << 0;
|
currentState = (getButtonA()) << 0;
|
||||||
currentState |= (getButtonB()) << 1;
|
currentState |= (getButtonB()) << 1;
|
||||||
|
|
||||||
@@ -34,9 +35,10 @@ ButtonState getButtonState() {
|
|||||||
if (currentState == previousState) {
|
if (currentState == previousState) {
|
||||||
if (currentState == 0)
|
if (currentState == 0)
|
||||||
return BUTTON_NONE;
|
return BUTTON_NONE;
|
||||||
if ((xTaskGetTickCount() - previousStateChange) > timeout) {
|
if ((xTaskGetTickCount() - previousStateChange) >= timeout) {
|
||||||
// User has been holding the button down
|
// User has been holding the button down
|
||||||
// We want to send a button is held message
|
// We want to send a button is held message
|
||||||
|
longPressed = true;
|
||||||
if (currentState == 0x01)
|
if (currentState == 0x01)
|
||||||
return BUTTON_F_LONG;
|
return BUTTON_F_LONG;
|
||||||
else if (currentState == 0x02)
|
else if (currentState == 0x02)
|
||||||
@@ -50,19 +52,15 @@ ButtonState getButtonState() {
|
|||||||
ButtonState retVal = BUTTON_NONE;
|
ButtonState retVal = BUTTON_NONE;
|
||||||
if (currentState) {
|
if (currentState) {
|
||||||
// User has pressed a button down (nothing done on down)
|
// User has pressed a button down (nothing done on down)
|
||||||
if (currentState != previousState) {
|
// If there is a rising edge on one of the buttons from double press we
|
||||||
// There has been a change in the button states
|
// want to mask that out As users are having issues with not release
|
||||||
// If there is a rising edge on one of the buttons from double press we
|
// both at once
|
||||||
// want to mask that out As users are having issues with not release
|
previousState |= currentState;
|
||||||
// both at once
|
|
||||||
if (previousState == 0x03)
|
|
||||||
currentState = 0x03;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// User has released buttons
|
// User has released buttons
|
||||||
// If they previously had the buttons down we want to check if they were <
|
// If they previously had the buttons down we want to check if they were <
|
||||||
// long hold and trigger a press
|
// long hold and trigger a press
|
||||||
if ((xTaskGetTickCount() - previousStateChange) < timeout) {
|
if (!longPressed) {
|
||||||
// The user didn't hold the button for long
|
// The user didn't hold the button for long
|
||||||
// So we send button press
|
// So we send button press
|
||||||
|
|
||||||
@@ -73,8 +71,9 @@ ButtonState getButtonState() {
|
|||||||
else
|
else
|
||||||
retVal = BUTTON_BOTH; // Both being held case
|
retVal = BUTTON_BOTH; // Both being held case
|
||||||
}
|
}
|
||||||
|
previousState = 0;
|
||||||
|
longPressed = false;
|
||||||
}
|
}
|
||||||
previousState = currentState;
|
|
||||||
previousStateChange = xTaskGetTickCount();
|
previousStateChange = xTaskGetTickCount();
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
@@ -95,7 +94,7 @@ void waitForButtonPress() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void waitForButtonPressOrTimeout(uint32_t timeout) {
|
void waitForButtonPressOrTimeout(TickType_t timeout) {
|
||||||
timeout += xTaskGetTickCount();
|
timeout += xTaskGetTickCount();
|
||||||
// calculate the exit point
|
// calculate the exit point
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,8 @@
|
|||||||
#include "BSP.h"
|
#include "BSP.h"
|
||||||
#ifndef INC_BUTTONS_H_
|
#ifndef INC_BUTTONS_H_
|
||||||
#define INC_BUTTONS_H_
|
#define INC_BUTTONS_H_
|
||||||
|
#include "portmacro.h"
|
||||||
extern uint32_t lastButtonTime;
|
extern TickType_t lastButtonTime;
|
||||||
|
|
||||||
enum ButtonState {
|
enum ButtonState {
|
||||||
BUTTON_NONE = 0, /* No buttons pressed / < filter time*/
|
BUTTON_NONE = 0, /* No buttons pressed / < filter time*/
|
||||||
@@ -29,7 +29,7 @@ enum ButtonState {
|
|||||||
// Returns what buttons are pressed (if any)
|
// Returns what buttons are pressed (if any)
|
||||||
ButtonState getButtonState();
|
ButtonState getButtonState();
|
||||||
// Helpers
|
// Helpers
|
||||||
void waitForButtonPressOrTimeout(uint32_t timeout);
|
void waitForButtonPressOrTimeout(TickType_t timeout);
|
||||||
void waitForButtonPress();
|
void waitForButtonPress();
|
||||||
|
|
||||||
#endif /* INC_BUTTONS_H_ */
|
#endif /* INC_BUTTONS_H_ */
|
||||||
|
|||||||
@@ -221,7 +221,7 @@ void OLED::maskScrollIndicatorOnOLED() {
|
|||||||
// it from the screen buffer which is updated by `OLED::setRotation`.
|
// it from the screen buffer which is updated by `OLED::setRotation`.
|
||||||
uint8_t rightmostColumn = screenBuffer[7];
|
uint8_t rightmostColumn = screenBuffer[7];
|
||||||
uint8_t maskCommands[] = {
|
uint8_t maskCommands[] = {
|
||||||
// Set column address:
|
// Set column address:
|
||||||
// A[6:0] - Column start address = rightmost column
|
// A[6:0] - Column start address = rightmost column
|
||||||
// B[6:0] - Column end address = rightmost column
|
// B[6:0] - Column end address = rightmost column
|
||||||
0x80,
|
0x80,
|
||||||
@@ -252,10 +252,10 @@ void OLED::transitionSecondaryFramebuffer(bool forwardNavigation) {
|
|||||||
uint8_t *firstBackStripPtr = &secondFrameBuffer[0];
|
uint8_t *firstBackStripPtr = &secondFrameBuffer[0];
|
||||||
uint8_t *secondBackStripPtr = &secondFrameBuffer[OLED_WIDTH];
|
uint8_t *secondBackStripPtr = &secondFrameBuffer[OLED_WIDTH];
|
||||||
|
|
||||||
uint32_t totalDuration = TICKS_100MS * 5; // 500ms
|
TickType_t totalDuration = TICKS_100MS * 5; // 500ms
|
||||||
uint32_t duration = 0;
|
TickType_t duration = 0;
|
||||||
uint32_t start = xTaskGetTickCount();
|
TickType_t start = xTaskGetTickCount();
|
||||||
uint8_t offset = 0;
|
uint8_t offset = 0;
|
||||||
|
|
||||||
while (duration <= totalDuration) {
|
while (duration <= totalDuration) {
|
||||||
duration = xTaskGetTickCount() - start;
|
duration = xTaskGetTickCount() - start;
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ bool USBPowerDelivery::isVBUSConnected() {
|
|||||||
uint32_t lastCapabilities[11];
|
uint32_t lastCapabilities[11];
|
||||||
uint32_t *USBPowerDelivery::getLastSeenCapabilities() { return lastCapabilities; }
|
uint32_t *USBPowerDelivery::getLastSeenCapabilities() { return lastCapabilities; }
|
||||||
|
|
||||||
|
#ifdef POW_EPR
|
||||||
static unsigned int sqrtI(unsigned long sqrtArg) {
|
static unsigned int sqrtI(unsigned long sqrtArg) {
|
||||||
unsigned int answer, x;
|
unsigned int answer, x;
|
||||||
unsigned long temp;
|
unsigned long temp;
|
||||||
@@ -108,6 +109,7 @@ static unsigned int sqrtI(unsigned long sqrtArg) {
|
|||||||
}
|
}
|
||||||
return answer; // approximate root
|
return answer; // approximate root
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// parseCapabilitiesArray returns true if a valid capability was found
|
// parseCapabilitiesArray returns true if a valid capability was found
|
||||||
// caps is the array of capabilities objects
|
// caps is the array of capabilities objects
|
||||||
@@ -119,7 +121,7 @@ bool parseCapabilitiesArray(const uint8_t numCaps, uint8_t *bestIndex, uint16_t
|
|||||||
*bestVoltage = 5000; // Default 5V
|
*bestVoltage = 5000; // Default 5V
|
||||||
|
|
||||||
// Fudge of 0.5 ohms to round up a little to account for us always having off periods in PWM
|
// Fudge of 0.5 ohms to round up a little to account for us always having off periods in PWM
|
||||||
uint8_t tipResistance = getTipResitanceX10() + 5;
|
uint8_t tipResistance = getTipResistanceX10() + 5;
|
||||||
#ifdef MODEL_HAS_DCDC
|
#ifdef MODEL_HAS_DCDC
|
||||||
// If this device has step down DC/DC inductor to smooth out current spikes
|
// If this device has step down DC/DC inductor to smooth out current spikes
|
||||||
// We can instead ignore resistance and go for max voltage we can accept; and rely on the DC/DC regulation to keep under current limit
|
// We can instead ignore resistance and go for max voltage we can accept; and rely on the DC/DC regulation to keep under current limit
|
||||||
@@ -173,7 +175,9 @@ bool parseCapabilitiesArray(const uint8_t numCaps, uint8_t *bestIndex, uint16_t
|
|||||||
*bestIsPPS = true;
|
*bestIsPPS = true;
|
||||||
*bestIsAVO = false;
|
*bestIsAVO = false;
|
||||||
}
|
}
|
||||||
} else if ((lastCapabilities[i] & PD_PDO_TYPE) == PD_PDO_TYPE_AUGMENTED && (((lastCapabilities[i] & PD_APDO_TYPE) == PD_APDO_TYPE_AVS))) {
|
}
|
||||||
|
#ifdef POW_EPR
|
||||||
|
else if ((lastCapabilities[i] & PD_PDO_TYPE) == PD_PDO_TYPE_AUGMENTED && (((lastCapabilities[i] & PD_APDO_TYPE) == PD_APDO_TYPE_AVS))) {
|
||||||
*bestIsAVO = true;
|
*bestIsAVO = true;
|
||||||
uint16_t max_voltage = PD_PAV2MV(PD_APDO_AVS_MAX_VOLTAGE_GET(lastCapabilities[i]));
|
uint16_t max_voltage = PD_PAV2MV(PD_APDO_AVS_MAX_VOLTAGE_GET(lastCapabilities[i]));
|
||||||
uint8_t max_wattage = PD_APDO_AVS_MAX_POWER_GET(lastCapabilities[i]);
|
uint8_t max_wattage = PD_APDO_AVS_MAX_POWER_GET(lastCapabilities[i]);
|
||||||
@@ -187,7 +191,6 @@ bool parseCapabilitiesArray(const uint8_t numCaps, uint8_t *bestIndex, uint16_t
|
|||||||
ideal_max_voltage = (max_voltage); // constrain to model max voltage safe to select
|
ideal_max_voltage = (max_voltage); // constrain to model max voltage safe to select
|
||||||
}
|
}
|
||||||
auto operating_current = (ideal_max_voltage / tipResistance); // Current in centiamps
|
auto operating_current = (ideal_max_voltage / tipResistance); // Current in centiamps
|
||||||
MSG((char *)"AVS max %d wattage %d tipRes %d sqrt %d -> %d\r\n", max_voltage, max_wattage, tipResistance, ideal_max_voltage, operating_current);
|
|
||||||
|
|
||||||
if (ideal_max_voltage > *bestVoltage) {
|
if (ideal_max_voltage > *bestVoltage) {
|
||||||
*bestIndex = i;
|
*bestIndex = i;
|
||||||
@@ -196,8 +199,8 @@ bool parseCapabilitiesArray(const uint8_t numCaps, uint8_t *bestIndex, uint16_t
|
|||||||
*bestIsAVO = true;
|
*bestIsAVO = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now that the best index is known, set the current values
|
// Now that the best index is known, set the current values
|
||||||
return *bestIndex != 0xFF; // have we selected one
|
return *bestIndex != 0xFF; // have we selected one
|
||||||
}
|
}
|
||||||
@@ -220,7 +223,6 @@ bool EPREvaluateCapabilityFunc(const epr_pd_msg *capabilities, pd_msg *request)
|
|||||||
/* We got what we wanted, so build a request for that */
|
/* We got what we wanted, so build a request for that */
|
||||||
request->hdr = PD_MSGTYPE_EPR_REQUEST | PD_NUMOBJ(2);
|
request->hdr = PD_MSGTYPE_EPR_REQUEST | PD_NUMOBJ(2);
|
||||||
request->obj[1] = lastCapabilities[bestIndex]; // Copy PDO into slot 2
|
request->obj[1] = lastCapabilities[bestIndex]; // Copy PDO into slot 2
|
||||||
MSG((char *)"Eval index %d volt %d current %d pps %d avo %d\r\n", bestIndex, bestIndexVoltage, bestIndexCurrent, bestIsPPS ? 1 : 0, bestIsAVO ? 1 : 0);
|
|
||||||
|
|
||||||
if (bestIsAVO) {
|
if (bestIsAVO) {
|
||||||
request->obj[0] = PD_RDO_PROG_CURRENT_SET(PD_CA2PAI(bestIndexCurrent)) | PD_RDO_PROG_VOLTAGE_SET(PD_MV2APS(bestIndexVoltage)) | PD_RDO_NO_USB_SUSPEND | PD_RDO_OBJPOS_SET(bestIndex + 1);
|
request->obj[0] = PD_RDO_PROG_CURRENT_SET(PD_CA2PAI(bestIndexCurrent)) | PD_RDO_PROG_VOLTAGE_SET(PD_MV2APS(bestIndexVoltage)) | PD_RDO_NO_USB_SUSPEND | PD_RDO_OBJPOS_SET(bestIndex + 1);
|
||||||
@@ -315,7 +317,7 @@ void pdbs_dpm_get_sink_capability(pd_msg *cap, const bool isPD3) {
|
|||||||
// if (requested_voltage_mv != 5000) {
|
// if (requested_voltage_mv != 5000) {
|
||||||
// voltage = requested_voltage_mv;
|
// voltage = requested_voltage_mv;
|
||||||
// }
|
// }
|
||||||
// uint16_t current = (voltage) / getTipResitanceX10(); // In centi-amps
|
// uint16_t current = (voltage) / getTipResistanceX10(); // In centi-amps
|
||||||
|
|
||||||
// /* Add a PDO for the desired power. */
|
// /* Add a PDO for the desired power. */
|
||||||
// cap->obj[numobj++] = PD_PDO_TYPE_FIXED | PD_PDO_SNK_FIXED_VOLTAGE_SET(PD_MV2PDV(voltage)) | PD_PDO_SNK_FIXED_CURRENT_SET(current);
|
// cap->obj[numobj++] = PD_PDO_TYPE_FIXED | PD_PDO_SNK_FIXED_VOLTAGE_SET(PD_MV2PDV(voltage)) | PD_PDO_SNK_FIXED_CURRENT_SET(current);
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ public:
|
|||||||
static bool negotiationHasWorked(); // Has PD negotiation worked (are we in a PD contract)
|
static bool negotiationHasWorked(); // Has PD negotiation worked (are we in a PD contract)
|
||||||
static uint8_t getStateNumber(); // Debugging - Get the internal state number
|
static uint8_t getStateNumber(); // Debugging - Get the internal state number
|
||||||
static bool isVBUSConnected(); // Is the VBus pin connected on the FUSB302
|
static bool isVBUSConnected(); // Is the VBus pin connected on the FUSB302
|
||||||
static void triggerRenegotiation(); // Trigger a restart of voltage selection
|
|
||||||
static uint32_t *getLastSeenCapabilities(); // returns pointer to the last seen capabilities from the powersource
|
static uint32_t *getLastSeenCapabilities(); // returns pointer to the last seen capabilities from the powersource
|
||||||
private:
|
private:
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
#ifndef SCROLL_MESSAGE_HPP_
|
#ifndef SCROLL_MESSAGE_HPP_
|
||||||
#define SCROLL_MESSAGE_HPP_
|
#define SCROLL_MESSAGE_HPP_
|
||||||
|
|
||||||
|
#include "portmacro.h"
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A helper class for showing a full-screen scrolling message.
|
* A helper class for showing a full-screen scrolling message.
|
||||||
*/
|
*/
|
||||||
class ScrollMessage {
|
class ScrollMessage {
|
||||||
uint32_t messageStart = 0;
|
TickType_t messageStart = 0;
|
||||||
int16_t lastOffset = -1;
|
int16_t lastOffset = -1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calcualte the width in pixels of the message string, in the large
|
* Calcualte the width in pixels of the message string, in the large
|
||||||
@@ -47,7 +47,7 @@ public:
|
|||||||
* @param currentTick The current tick as returned by `xTaskGetTickCount()`.
|
* @param currentTick The current tick as returned by `xTaskGetTickCount()`.
|
||||||
* @return Whether the OLED framebuffer has been modified.
|
* @return Whether the OLED framebuffer has been modified.
|
||||||
*/
|
*/
|
||||||
bool drawUpdate(const char *message, uint32_t currentTick);
|
bool drawUpdate(const char *message, TickType_t currentTick);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SCROLL_MESSAGE_HPP_ */
|
#endif /* SCROLL_MESSAGE_HPP_ */
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ static uint16_t str_display_len(const char *const str) {
|
|||||||
|
|
||||||
uint16_t ScrollMessage::messageWidth(const char *message) { return FONT_12_WIDTH * str_display_len(message); }
|
uint16_t ScrollMessage::messageWidth(const char *message) { return FONT_12_WIDTH * str_display_len(message); }
|
||||||
|
|
||||||
bool ScrollMessage::drawUpdate(const char *message, uint32_t currentTick) {
|
bool ScrollMessage::drawUpdate(const char *message, TickType_t currentTick) {
|
||||||
bool lcdRefresh = false;
|
bool lcdRefresh = false;
|
||||||
|
|
||||||
if (messageStart == 0) {
|
if (messageStart == 0) {
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ uint32_t availableW10(uint8_t sample) {
|
|||||||
// R = R*10
|
// R = R*10
|
||||||
// P therefore is in V^2*100/R*10 = W*10.
|
// P therefore is in V^2*100/R*10 = W*10.
|
||||||
uint32_t v = getInputVoltageX10(getSettingValue(SettingsOptions::VoltageDiv), sample); // 100 = 10v
|
uint32_t v = getInputVoltageX10(getSettingValue(SettingsOptions::VoltageDiv), sample); // 100 = 10v
|
||||||
uint32_t tipResistance = getTipResitanceX10();
|
uint32_t tipResistance = getTipResistanceX10();
|
||||||
if (tipResistance == 0) {
|
if (tipResistance == 0) {
|
||||||
return 100; // say 100 watt to force scale down
|
return 100; // say 100 watt to force scale down
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -171,9 +171,9 @@ static void gui_drawBatteryIcon() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
static void gui_solderingTempAdjust() {
|
static void gui_solderingTempAdjust() {
|
||||||
uint32_t lastChange = xTaskGetTickCount();
|
TickType_t lastChange = xTaskGetTickCount();
|
||||||
currentTempTargetDegC = 0; // Turn off header while adjusting temp
|
currentTempTargetDegC = 0; // Turn off header while adjusting temp
|
||||||
uint32_t autoRepeatTimer = 0;
|
TickType_t autoRepeatTimer = 0;
|
||||||
uint8_t autoRepeatAcceleration = 0;
|
uint8_t autoRepeatAcceleration = 0;
|
||||||
bool waitForRelease = false;
|
bool waitForRelease = false;
|
||||||
ButtonState buttons = getButtonState();
|
ButtonState buttons = getButtonState();
|
||||||
@@ -370,7 +370,7 @@ static void display_countdown(int sleepThres) {
|
|||||||
* Print seconds or minutes (if > 99 seconds) until sleep
|
* Print seconds or minutes (if > 99 seconds) until sleep
|
||||||
* mode is triggered.
|
* mode is triggered.
|
||||||
*/
|
*/
|
||||||
int lastEventTime = lastButtonTime < lastMovementTime ? lastMovementTime : lastButtonTime;
|
TickType_t lastEventTime = lastButtonTime < lastMovementTime ? lastMovementTime : lastButtonTime;
|
||||||
TickType_t downCount = sleepThres - xTaskGetTickCount() + lastEventTime;
|
TickType_t downCount = sleepThres - xTaskGetTickCount() + lastEventTime;
|
||||||
if (downCount > (99 * TICKS_SECOND)) {
|
if (downCount > (99 * TICKS_SECOND)) {
|
||||||
OLED::printNumber(downCount / 60000 + 1, 2, FontStyle::SMALL);
|
OLED::printNumber(downCount / 60000 + 1, 2, FontStyle::SMALL);
|
||||||
|
|||||||
@@ -116,8 +116,8 @@ int32_t getPIDResultX10Watts(int32_t setpointDelta) {
|
|||||||
static TickType_t lastCall = 0;
|
static TickType_t lastCall = 0;
|
||||||
static Integrator<int32_t> powerStore = {0};
|
static Integrator<int32_t> powerStore = {0};
|
||||||
|
|
||||||
const int rate = 1000 / (xTaskGetTickCount() - lastCall);
|
const TickType_t rate = 1000 / (xTaskGetTickCount() - lastCall);
|
||||||
lastCall = xTaskGetTickCount();
|
lastCall = xTaskGetTickCount();
|
||||||
// Sandman note:
|
// Sandman note:
|
||||||
// PID Challenge - we have a small thermal mass that we to want heat up as fast as possible but we don't
|
// PID Challenge - we have a small thermal mass that we to want heat up as fast as possible but we don't
|
||||||
// want to overshot excessively (if at all) the setpoint temperature. In the same time we have 'imprecise'
|
// want to overshot excessively (if at all) the setpoint temperature. In the same time we have 'imprecise'
|
||||||
|
|||||||
@@ -4,4 +4,4 @@
|
|||||||
* i.e.: BUILD_VERSION = 'Rel. v2.08' --> Will generated to: 'v2.08.1a2b3c4'
|
* i.e.: BUILD_VERSION = 'Rel. v2.08' --> Will generated to: 'v2.08.1a2b3c4'
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define BUILD_VERSION "v2.18"
|
#define BUILD_VERSION "v2.19"
|
||||||
|
|||||||
Reference in New Issue
Block a user