Custom tip type selection (#1977)
Some checks failed
CI / check_python (push) Has been cancelled
CI / check_shell (push) Has been cancelled
CI / check_readme (push) Has been cancelled
Docs / deploy-docs (push) Has been cancelled
CI / build (MHP30) (push) Has been cancelled
CI / tests (push) Has been cancelled
CI / build (Pinecil) (push) Has been cancelled
CI / build (Pinecilv2) (push) Has been cancelled
CI / build (S60) (push) Has been cancelled
CI / build (S60P) (push) Has been cancelled
CI / build (T55) (push) Has been cancelled
CI / build (TS100) (push) Has been cancelled
CI / check_c-cpp (push) Has been cancelled
CI / build (TS101) (push) Has been cancelled
CI / build (TS80) (push) Has been cancelled
CI / build (TS80P) (push) Has been cancelled
CI / build_multi-lang (Pinecil) (push) Has been cancelled
CI / build_multi-lang (Pinecilv2) (push) Has been cancelled
CI / upload_metadata (push) Has been cancelled

* Minor doc updates

* pydoc

* Draft tip selection menu

* Start linking in manual tip resistance

* Enable on Pinecilv1 / TS10x

* Fixup drawing tip type

* Update Settings.cpp

* Rename JBC type

* Add translations

* Handle one tip type

* Refactor header includes

* Fixup translation_IT.json

* Fixing up includes

* Format

* Apply suggestions from code review

Co-authored-by: discip <53649486+discip@users.noreply.github.com>

* Update Documentation/Hardware.md

Co-authored-by: discip <53649486+discip@users.noreply.github.com>

---------

Co-authored-by: = <=>
Co-authored-by: discip <53649486+discip@users.noreply.github.com>
This commit is contained in:
Ben V. Brown
2024-11-01 12:20:33 +11:00
committed by GitHub
parent 150aa0db13
commit a0a779faba
61 changed files with 1074 additions and 108 deletions

View File

@@ -1,6 +1,5 @@
#ifndef CONFIGURATION_H_
#define CONFIGURATION_H_
#include "Settings.h"
#include <stdint.h>
/**
* Configuration.h
@@ -147,7 +146,7 @@
#define MIN_BOOST_TEMP_F 300 // The min settable temp for boost mode °F
#define NO_DISPLAY_ROTATE // Disable OLED rotation by accel
#define SLEW_LIMIT 50 // Limit to 3.0 Watts per 64ms pid loop update rate slew rate
#define TIPTYPE_MHP30 1 // It's own special tip
#define ACCEL_SC7
#define ACCEL_MSA

View File

@@ -4,6 +4,7 @@
#include "BootLogo.h"
#include "I2C_Wrapper.hpp"
#include "Pins.h"
#include "Settings.h"
#include "Setup.h"
#include "TipThermoModel.h"
#include "USBPD.h"
@@ -382,9 +383,18 @@ uint8_t getTipResistanceX10() {
#ifdef TIP_RESISTANCE_SENSE_Pin
// Return tip resistance in x10 ohms
// We can measure this using the op-amp
return lastTipResistance;
uint8_t user_selected_tip = getUserSelectedTipResistance();
if (user_selected_tip == 0) {
return lastTipResistance; // Auto mode
}
return user_selected_tip;
#else
return TIP_RESISTANCE;
uint8_t user_selected_tip = getUserSelectedTipResistance();
if (user_selected_tip == 0) {
return TIP_RESISTANCE; // Auto mode
}
return user_selected_tip;
#endif
}
#ifdef TIP_RESISTANCE_SENSE_Pin

View File

@@ -1,6 +1,5 @@
#ifndef CONFIGURATION_H_
#define CONFIGURATION_H_
#include "Settings.h"
#include <stdint.h>
/**
* Configuration.h
@@ -181,6 +180,7 @@
#define I2C_SOFT_BUS_1 1
#define OLED_I2CBB1 1
#define ACCEL_I2CBB1 1
#define TIPTYPE_T12 1 // Can manually pick a T12 tip
#define TEMP_TMP36
#endif /* TS100 */
@@ -213,6 +213,8 @@
#define TEMP_NTC 1
#define ACCEL_I2CBB1 1
#define POW_EPR 1
#define AUTO_TIP_SELECTION 1 // Can auto-select the tip
#define TIPTYPE_T12 1 // Can manually pick a T12 tip
#define HAS_POWER_DEBUG_MENU
#define DEBUG_POWER_MENU_BUTTON_B
@@ -230,6 +232,8 @@
#define I2C_SOFT_BUS_2 1
#define LIS_ORI_FLIP
#define OLED_FLIP
#define TIPTYPE_TS80 1 // Only one tip type so far
#endif /* TS80(P) */
#ifdef MODEL_TS80

View File

@@ -5,6 +5,7 @@
#include "I2C_Wrapper.hpp"
#include "IRQ.h"
#include "Pins.h"
#include "Settings.h"
#include "Setup.h"
#include "TipThermoModel.h"
#include "configuration.h"
@@ -93,7 +94,13 @@ void setBuzzer(bool on) {}
uint8_t preStartChecks() { return 1; }
uint64_t getDeviceID() { return dbg_id_get(); }
uint8_t getTipResistanceX10() { return TIP_RESISTANCE; }
uint8_t getTipResistanceX10() {
uint8_t user_selected_tip = getUserSelectedTipResistance();
if (user_selected_tip == 0) {
return TIP_RESISTANCE; // Auto mode
}
return user_selected_tip;
}
bool isTipShorted() { return false; }
uint8_t preStartChecksDone() { return 1; }

View File

@@ -1,6 +1,5 @@
#ifndef CONFIGURATION_H_
#define CONFIGURATION_H_
#include "Settings.h"
#include <stdint.h>
/**
* Configuration.h
@@ -155,6 +154,7 @@
#define POW_QC_20V 1
#define ENABLE_QC2 1
#define MAG_SLEEP_SUPPORT 1
#define TIPTYPE_T12 1 // Can manually pick a T12 tip
#define TEMP_TMP36
#define ACCEL_BMA
#define ACCEL_SC7

View File

@@ -5,6 +5,7 @@
#include "I2C_Wrapper.hpp"
#include "IRQ.h"
#include "Pins.h"
#include "Settings.h"
#include "Setup.h"
#include "TipThermoModel.h"
#include "USBPD.h"
@@ -152,7 +153,11 @@ uint8_t tipResistanceReadingSlot = 0;
uint8_t getTipResistanceX10() {
// Return tip resistance in x10 ohms
// We can measure this using the op-amp
return lastTipResistance;
uint8_t user_selected_tip = getUserSelectedTipResistance();
if (user_selected_tip == 0) {
return lastTipResistance; // Auto mode
}
return user_selected_tip;
}
uint16_t getTipThermalMass() { return 120; }
@@ -289,4 +294,4 @@ TemperatureType_t getCustomTipMaxInC() {
TemperatureType_t maximumTipTemp = TipThermoModel::convertTipRawADCToDegC(max_reading);
maximumTipTemp += getHandleTemperature(0) / 10; // Add handle offset
return maximumTipTemp - 1;
}
}

View File

@@ -1,6 +1,5 @@
#ifndef CONFIGURATION_H_
#define CONFIGURATION_H_
#include "Settings.h"
#include <stdint.h>
/**
* Configuration.h
@@ -155,6 +154,8 @@
#define POW_EPR 1
#define ENABLE_QC2 1
#define MAG_SLEEP_SUPPORT 1
#define AUTO_TIP_SELECTION 1 // Can auto-select the tip
#define TIPTYPE_T12 1 // Can manually pick a T12 tip
#define DEVICE_HAS_VALIDATION_SUPPORT
#define OLED_96x16 1
#define TEMP_NTC

View File

@@ -6,6 +6,7 @@
#include "HUB238.hpp"
#include "I2C_Wrapper.hpp"
#include "Pins.h"
#include "Settings.h"
#include "Setup.h"
#include "TipThermoModel.h"
#include "configuration.h"
@@ -262,7 +263,11 @@ uint8_t getTipResistanceX10() {
return TIP_RESISTANCE + ((TIP_RESISTANCE * scaler) / 100000);
#else
return TIP_RESISTANCE;
uint8_t user_selected_tip = getUserSelectedTipResistance();
if (user_selected_tip == 0) {
return TIP_RESISTANCE; // Auto mode
}
return user_selected_tip;
#endif
}
bool isTipShorted() { return false; }
@@ -277,4 +282,4 @@ void showBootLogo(void) { BootLogo::handleShowingLogo((uint8_t *)FLASH_LOGOADDR)
#ifdef CUSTOM_MAX_TEMP_C
TemperatureType_t getCustomTipMaxInC() { return MAX_TEMP_C; }
#endif
#endif

View File

@@ -1,6 +1,5 @@
#ifndef CONFIGURATION_H_
#define CONFIGURATION_H_
#include "Settings.h"
#include <stdint.h>
/**
* Configuration.h

View File

@@ -2,6 +2,7 @@
#include "BSP.h"
#include "Buttons.hpp"
#include "OLED.hpp"
#include "Settings.h"
#include "cmsis_os.h"
#define LOGO_PAGE_LENGTH 1024

View File

@@ -1,9 +1,11 @@
#include "configuration.h"
#if POW_PD_EXT == 2
#include "BSP.h"
#include "FS2711.hpp"
#include "FS2711_defines.h"
#include "I2CBB2.hpp"
#include "configuration.h"
#if POW_PD_EXT == 2
#include "BSP.h"
#include "Settings.h"
#include "cmsis_os.h"
#include <stdbool.h>
#include <stdint.h>

View File

@@ -6,6 +6,7 @@
*/
#include "Buttons.hpp"
#include "Settings.h"
#include "Translation.h"
#include "cmsis_os.h"
#include "configuration.h"

View File

@@ -1,9 +1,9 @@
#include "USBPD.h"
#include "configuration.h"
#ifdef POW_PD
#include "BSP_PD.h"
#include "FreeRTOS.h"
#include "Settings.h"
#include "fusb302b.h"
#include "main.hpp"
#include "pd.h"

View File

@@ -6,6 +6,7 @@
*/
#include "BSP_Power.h"
#include "Settings.h"
#include "configuration.h"
#include <Utils.h>

View File

@@ -7,11 +7,12 @@
* Houses the system settings and allows saving / restoring from flash
*/
#ifndef SETTINGS_H_
#define SETTINGS_H_
#include "configuration.h"
#ifndef CORE_SETTINGS_H_
#define CORE_SETTINGS_H_
#include <stdbool.h>
#include <stdint.h>
#ifdef MODEL_Pinecilv2
// Required settings reset for PR #1916
#define SETTINGSVERSION (0x55AB) // This number is frozen, do not edit
@@ -74,8 +75,9 @@ enum SettingsOptions {
ProfilePhase5Duration = 51, // Target duration for phase 5
ProfileCooldownSpeed = 52, // Maximum allowed cooldown speed in degrees per second
HallEffectSleepTime = 53, // Seconds (/5) timeout to sleep when hall effect over threshold
SolderingTipType = 54, // Selecting the type of soldering tip fitted
//
SettingsOptionsLength = 54, //
SettingsOptionsLength = 55, // End marker
};
typedef enum {
@@ -117,6 +119,31 @@ typedef enum {
FULL = 2, // Locking buttons for Boost mode AND for Soldering mode
} lockingMode_t;
/* Selection of the soldering tip
* Some devices allow multiple types of tips to be fitted, this allows selecting them or overriding the logic
* The first type will be the default (gets value of 0)
*/
typedef enum {
#ifdef AUTO_TIP_SELECTION
TIP_TYPE_AUTO, // If the hardware supports automatic detection
#endif
#ifdef TIPTYPE_T12
T12_8_OHM, // TS100 style tips or Hakko T12 tips with adaptors
T12_6_2_OHM, // Short Tips manufactured by Pine64
T12_4_OHM, // Longer tip but low resistance for PTS200
#endif
// #ifdef TIPTYPE_TS80
// TS80_4_5_OHM, // TS80(P) default tips
// // We do not know of other tuning tips (?yet?)
// #endif
// #ifdef TIPTYPE_JBC
// JBC_210_2_5_OHM, // Small JBC tips as used in the S60/S60P
// #endif
TIP_TYPE_MAX, // Max value marker
} tipType_t;
uint8_t getUserSelectedTipResistance(); // returns the resistance matching the selected tip type or 0 for auto
// Settings wide operations
void saveSettings();
bool loadSettings();
@@ -129,11 +156,11 @@ uint16_t getSettingValue(const enum SettingsOptions option);
void nextSettingValue(const enum SettingsOptions option);
void prevSettingValue(const enum SettingsOptions option);
bool isLastSettingValue(const enum SettingsOptions option);
// For setting values to settings
void setSettingValue(const enum SettingsOptions option, const uint16_t newValue);
// Special access
uint8_t lookupVoltageLevel();
uint16_t lookupHallEffectThreshold();
#endif /* SETTINGS_H_ */
// Special access helpers, to reduce logic duplication
uint8_t lookupVoltageLevel();
uint16_t lookupHallEffectThreshold();
const char *lookupTipName(); // Get the name string for the current soldering tip
#endif /* SETTINGS_H_ */

View File

@@ -106,6 +106,7 @@ enum class SettingsItemIndex : uint8_t {
PowerPulseDuration,
SettingsReset,
LanguageSwitch,
SolderingTipType,
NUM_ITEMS,
};
@@ -149,6 +150,12 @@ struct TranslationIndexTable {
uint16_t USBPDModeDefault;
uint16_t USBPDModeNoDynamic;
uint16_t USBPDModeSafe;
uint16_t TipTypeAuto;
uint16_t TipTypeT12Long;
uint16_t TipTypeT12Short;
uint16_t TipTypeT12PTS;
uint16_t TipTypeTS80;
uint16_t TipTypeJBCC210;
uint16_t SettingsDescriptions[static_cast<uint32_t>(SettingsItemIndex::NUM_ITEMS)];
uint16_t SettingsShortNames[static_cast<uint32_t>(SettingsItemIndex::NUM_ITEMS)];

View File

@@ -1,6 +1,6 @@
#include "ScrollMessage.hpp"
#include "OLED.hpp"
#include "Settings.h"
#include "configuration.h"
/**

View File

@@ -16,6 +16,10 @@
#include <string.h> // for memset
bool sanitiseSettings();
/*
* Used to constrain the QC 3.0 Voltage selection to suit hardware.
* We allow a little overvoltage for users who want to push it
*/
#ifdef POW_QC_20V
#define QC_VOLTAGE_MAX 220
#else
@@ -51,60 +55,61 @@ typedef struct {
static const SettingConstants settingsConstants[(int)SettingsOptions::SettingsOptionsLength] = {
//{ min, max, increment, default}
{ MIN_TEMP_C, MAX_TEMP_F, 5, SOLDERING_TEMP}, // SolderingTemp
{ MIN_TEMP_C, MAX_TEMP_F, 5, 150}, // SleepTemp
{ 0, 15, 1, SLEEP_TIME}, // SleepTime
{ 0, 4, 1, CUT_OUT_SETTING}, // MinDCVoltageCells
{ 24, 38, 1, RECOM_VOL_CELL}, // MinVoltageCells
{ 90, QC_VOLTAGE_MAX, 2, 90}, // QCIdealVoltage
{ 0, MAX_ORIENTATION_MODE, 1, ORIENTATION_MODE}, // OrientationMode
{ 0, 9, 1, SENSITIVITY}, // Sensitivity
{ 0, 1, 1, ANIMATION_LOOP}, // AnimationLoop
{ 0, settingOffSpeed_t::MAX_VALUE - 1, 1, ANIMATION_SPEED}, // AnimationSpeed
{ 0, 3, 1, AUTO_START_MODE}, // AutoStartMode
{ 0, 60, 1, SHUTDOWN_TIME}, // ShutdownTime
{ 0, 1, 1, COOLING_TEMP_BLINK}, // CoolingTempBlink
{ 0, 1, 1, DETAILED_IDLE}, // DetailedIDLE
{ 0, 1, 1, DETAILED_SOLDERING}, // DetailedSoldering
{ 0, (uint16_t)(HasFahrenheit ? 1 : 0), 1, TEMPERATURE_INF}, // TemperatureInF
{ 0, 1, 1, DESCRIPTION_SCROLL_SPEED}, // DescriptionScrollSpeed
{ 0, 2, 1, LOCKING_MODE}, // LockingMode
{ 0, 99, 1, POWER_PULSE_DEFAULT}, // KeepAwakePulse
{ 1, POWER_PULSE_WAIT_MAX, 1, POWER_PULSE_WAIT_DEFAULT}, // KeepAwakePulseWait
{ 1, POWER_PULSE_DURATION_MAX, 1, POWER_PULSE_DURATION_DEFAULT}, // KeepAwakePulseDuration
{ 360, 900, 1, VOLTAGE_DIV}, // VoltageDiv
{ 0, MAX_TEMP_F, 10, BOOST_TEMP}, // BoostTemp
{MIN_CALIBRATION_OFFSET, 2500, 1, CALIBRATION_OFFSET}, // CalibrationOffset
{ 0, MAX_POWER_LIMIT, POWER_LIMIT_STEPS, POWER_LIMIT}, // PowerLimit
{ 0, 1, 1, REVERSE_BUTTON_TEMP_CHANGE}, // ReverseButtonTempChangeEnabled
{ 5, TEMP_CHANGE_LONG_STEP_MAX, 5, TEMP_CHANGE_LONG_STEP}, // TempChangeLongStep
{ 1, TEMP_CHANGE_SHORT_STEP_MAX, 1, TEMP_CHANGE_SHORT_STEP}, // TempChangeShortStep
{ 0, 9, 1, 7}, // HallEffectSensitivity
{ 0, 9, 1, 0}, // AccelMissingWarningCounter
{ 0, 9, 1, 0}, // PDMissingWarningCounter
{ 0, 0xFFFF, 0, 41431 /*EN*/}, // UILanguage
{ 0, 50, 1, 20}, // PDNegTimeout
{ 0, 1, 1, 0}, // OLEDInversion
{ MIN_BRIGHTNESS, MAX_BRIGHTNESS, BRIGHTNESS_STEP, DEFAULT_BRIGHTNESS}, // OLEDBrightness
{ 0, 6, 1, 1}, // LOGOTime
{ 0, 1, 1, 0}, // CalibrateCJC
{ 0, 1, 1, 0}, // BluetoothLE
{ 0, 2, 1, 1}, // USBPDMode
{ 1, 5, 1, 4}, // ProfilePhases
{ MIN_TEMP_C, MAX_TEMP_F, 5, 90}, // ProfilePreheatTemp
{ 1, 10, 1, 1}, // ProfilePreheatSpeed
{ MIN_TEMP_C, MAX_TEMP_F, 5, 130}, // ProfilePhase1Temp
{ 10, 180, 5, 90}, // ProfilePhase1Duration
{ MIN_TEMP_C, MAX_TEMP_F, 5, 140}, // ProfilePhase2Temp
{ 10, 180, 5, 30}, // ProfilePhase2Duration
{ MIN_TEMP_C, MAX_TEMP_F, 5, 165}, // ProfilePhase3Temp
{ 10, 180, 5, 30}, // ProfilePhase3Duration
{ MIN_TEMP_C, MAX_TEMP_F, 5, 140}, // ProfilePhase4Temp
{ 10, 180, 5, 30}, // ProfilePhase4Duration
{ MIN_TEMP_C, MAX_TEMP_F, 5, 90}, // ProfilePhase5Temp
{ 10, 180, 5, 30}, // ProfilePhase5Duration
{ 1, 10, 1, 2}, // ProfileCooldownSpeed
{ 0, 12, 1, 0}, // HallEffectSleepTime
{ MIN_TEMP_C, MAX_TEMP_F, 5, SOLDERING_TEMP}, // SolderingTemp
{ MIN_TEMP_C, MAX_TEMP_F, 5, 150}, // SleepTemp
{ 0, 15, 1, SLEEP_TIME}, // SleepTime
{ 0, 4, 1, CUT_OUT_SETTING}, // MinDCVoltageCells
{ 24, 38, 1, RECOM_VOL_CELL}, // MinVoltageCells
{ 90, QC_VOLTAGE_MAX, 2, 90}, // QCIdealVoltage
{ 0, MAX_ORIENTATION_MODE, 1, ORIENTATION_MODE}, // OrientationMode
{ 0, 9, 1, SENSITIVITY}, // Sensitivity
{ 0, 1, 1, ANIMATION_LOOP}, // AnimationLoop
{ 0, settingOffSpeed_t::MAX_VALUE - 1, 1, ANIMATION_SPEED}, // AnimationSpeed
{ 0, 3, 1, AUTO_START_MODE}, // AutoStartMode
{ 0, 60, 1, SHUTDOWN_TIME}, // ShutdownTime
{ 0, 1, 1, COOLING_TEMP_BLINK}, // CoolingTempBlink
{ 0, 1, 1, DETAILED_IDLE}, // DetailedIDLE
{ 0, 1, 1, DETAILED_SOLDERING}, // DetailedSoldering
{ 0, (uint16_t)(HasFahrenheit ? 1 : 0), 1, TEMPERATURE_INF}, // TemperatureInF
{ 0, 1, 1, DESCRIPTION_SCROLL_SPEED}, // DescriptionScrollSpeed
{ 0, 2, 1, LOCKING_MODE}, // LockingMode
{ 0, 99, 1, POWER_PULSE_DEFAULT}, // KeepAwakePulse
{ 1, POWER_PULSE_WAIT_MAX, 1, POWER_PULSE_WAIT_DEFAULT}, // KeepAwakePulseWait
{ 1, POWER_PULSE_DURATION_MAX, 1, POWER_PULSE_DURATION_DEFAULT}, // KeepAwakePulseDuration
{ 360, 900, 1, VOLTAGE_DIV}, // VoltageDiv
{ 0, MAX_TEMP_F, 10, BOOST_TEMP}, // BoostTemp
{MIN_CALIBRATION_OFFSET, 2500, 1, CALIBRATION_OFFSET}, // CalibrationOffset
{ 0, MAX_POWER_LIMIT, POWER_LIMIT_STEPS, POWER_LIMIT}, // PowerLimit
{ 0, 1, 1, REVERSE_BUTTON_TEMP_CHANGE}, // ReverseButtonTempChangeEnabled
{ 5, TEMP_CHANGE_LONG_STEP_MAX, 5, TEMP_CHANGE_LONG_STEP}, // TempChangeLongStep
{ 1, TEMP_CHANGE_SHORT_STEP_MAX, 1, TEMP_CHANGE_SHORT_STEP}, // TempChangeShortStep
{ 0, 9, 1, 7}, // HallEffectSensitivity
{ 0, 9, 1, 0}, // AccelMissingWarningCounter
{ 0, 9, 1, 0}, // PDMissingWarningCounter
{ 0, 0xFFFF, 0, 41431 /*EN*/}, // UILanguage
{ 0, 50, 1, 20}, // PDNegTimeout
{ 0, 1, 1, 0}, // OLEDInversion
{ MIN_BRIGHTNESS, MAX_BRIGHTNESS, BRIGHTNESS_STEP, DEFAULT_BRIGHTNESS}, // OLEDBrightness
{ 0, 6, 1, 1}, // LOGOTime
{ 0, 1, 1, 0}, // CalibrateCJC
{ 0, 1, 1, 0}, // BluetoothLE
{ 0, 2, 1, 1}, // USBPDMode
{ 1, 5, 1, 4}, // ProfilePhases
{ MIN_TEMP_C, MAX_TEMP_F, 5, 90}, // ProfilePreheatTemp
{ 1, 10, 1, 1}, // ProfilePreheatSpeed
{ MIN_TEMP_C, MAX_TEMP_F, 5, 130}, // ProfilePhase1Temp
{ 10, 180, 5, 90}, // ProfilePhase1Duration
{ MIN_TEMP_C, MAX_TEMP_F, 5, 140}, // ProfilePhase2Temp
{ 10, 180, 5, 30}, // ProfilePhase2Duration
{ MIN_TEMP_C, MAX_TEMP_F, 5, 165}, // ProfilePhase3Temp
{ 10, 180, 5, 30}, // ProfilePhase3Duration
{ MIN_TEMP_C, MAX_TEMP_F, 5, 140}, // ProfilePhase4Temp
{ 10, 180, 5, 30}, // ProfilePhase4Duration
{ MIN_TEMP_C, MAX_TEMP_F, 5, 90}, // ProfilePhase5Temp
{ 10, 180, 5, 30}, // ProfilePhase5Duration
{ 1, 10, 1, 2}, // ProfileCooldownSpeed
{ 0, 12, 1, 0}, // HallEffectSleepTime
{ 0, (tipType_t::TIP_TYPE_MAX - 1) > 0 ? (tipType_t::TIP_TYPE_MAX - 1) : 0, 1, 0}, // SolderingTipType
};
static_assert((sizeof(settingsConstants) / sizeof(SettingConstants)) == ((int)SettingsOptions::SettingsOptionsLength));
@@ -292,3 +297,76 @@ uint8_t lookupVoltageLevel() {
return (minVoltageOnCell * minVoltageCellCount) + (minVoltageCellCount * 2);
}
}
const char *lookupTipName() {
// Get the name string for the current soldering tip
tipType_t value = (tipType_t)getSettingValue(SettingsOptions::SolderingTipType);
switch (value) {
#ifdef AUTO_TIP_SELECTION
case tipType_t::TIP_TYPE_AUTO:
return translatedString(Tr->TipTypeAuto);
break;
#endif
#ifdef TIPTYPE_T12
case tipType_t::T12_8_OHM:
return translatedString(Tr->TipTypeT12Long);
break;
case tipType_t::T12_6_2_OHM:
return translatedString(Tr->TipTypeT12Short);
break;
case tipType_t::T12_4_OHM:
return translatedString(Tr->TipTypeT12PTS);
break;
#endif
#ifdef TIPTYE_TS80
case tipType_t::TS80_4_5_OHM:
return translatedString(Tr->TipTypeTS80);
break;
#endif
#ifdef TIPTYPE_JBC
case tipType_t::JBC_210_2_5_OHM:
return translatedString(Tr->TipTypeJBCC210);
break;
#endif
default:
return nullptr;
break;
}
}
// Returns the resistance for the current tip selected by the user or 0 for auto
uint8_t getUserSelectedTipResistance() {
tipType_t value = (tipType_t)getSettingValue(SettingsOptions::SolderingTipType);
switch (value) {
#ifdef AUTO_TIP_SELECTION
case tipType_t::TIP_TYPE_AUTO:
return 0;
break;
#endif
#ifdef TIPTYPE_T12
case tipType_t::T12_8_OHM:
return 80;
break;
case tipType_t::T12_6_2_OHM:
return 62;
break;
case tipType_t::T12_4_OHM:
return 40;
break;
#endif
#ifdef TIPTYE_TS80
case tipType_t::TS80_4_5_OHM:
return 45;
break;
#endif
#ifdef TIPTYPE_JBC
case tipType_t::JBC_210_2_5_OHM:
return 25;
break;
#endif
default:
return 0;
break;
}
}

View File

@@ -115,6 +115,10 @@ static void displayHallEffectSleepTime(void);
static bool showHallEffect(void);
#endif /* HALL_SENSOR */
// Tip type selection
static void displaySolderingTipType(void);
static bool showSolderingTipType(void);
// Menu functions
#if defined(POW_DC) || defined(POW_QC) || defined(POW_PD)
@@ -137,6 +141,7 @@ static void displayAdvancedMenu(void);
* USBPDMode
*
* Soldering
* Tip Type selection
* Boost Mode Temp
* Auto Start
* Temp Change Short Step
@@ -262,6 +267,7 @@ const menuitem powerMenu[] = {
const menuitem solderingMenu[] = {
/*
* Tip Type
* Boost Mode Temp
* Auto Start
* Temp Change Short Step
@@ -282,6 +288,8 @@ const menuitem solderingMenu[] = {
* Profile Phase 5 Duration (s)
* Profile Cooldown Max Temperature Change Per Second
*/
/* Tip Type */
{SETTINGS_DESC(SettingsItemIndex::SolderingTipType), nullptr, displaySolderingTipType, showSolderingTipType, SettingsOptions::SolderingTipType, SettingsItemIndex::SolderingTipType, 5},
/* Boost Temp */
{SETTINGS_DESC(SettingsItemIndex::BoostTemperature), setBoostTemp, displayBoostTemp, nullptr, SettingsOptions::BoostTemp, SettingsItemIndex::BoostTemperature, 5},
/* Auto start */
@@ -755,7 +763,12 @@ static void displayHallEffectSleepTime(void) {
}
}
#endif /* HALL_SENSOR */
static void displaySolderingTipType(void) {
// TODO wrapping X value
OLED::print(lookupTipName(), FontStyle::SMALL, 255, OLED::getCursorX());
}
// If there is no detection, and no options, max is 0
static bool showSolderingTipType(void) { return tipType_t::TIP_TYPE_MAX != 0; }
static void setTempF(const enum SettingsOptions option) {
uint16_t Temp = getSettingValue(option);
if (getSettingValue(SettingsOptions::TemperatureInF)) {

View File

@@ -3,6 +3,7 @@
#include "Buttons.hpp"
#include "OLED.hpp"
#include "OperatingModeUtilities.h"
#include "Settings.h"
#include "configuration.h"
#include <stdbool.h>
#include <stdint.h>
@@ -21,13 +22,13 @@ void ui_draw_soldering_power_status(bool boost_mode_on);
void ui_draw_soldering_basic_status(bool boostModeOn);
void ui_draw_soldering_detailed_sleep(TemperatureType_t tipTemp);
void ui_draw_soldering_basic_sleep(TemperatureType_t tipTemp);
void ui_draw_soldering_profile_advanced(TemperatureType_t tipTemp, TemperatureType_t profileCurrentTargetTemp, uint32_t phaseElapsedSeconds, uint32_t phase,const uint32_t phaseTimeGoal);
void ui_draw_soldering_profile_advanced(TemperatureType_t tipTemp, TemperatureType_t profileCurrentTargetTemp, uint32_t phaseElapsedSeconds, uint32_t phase, const uint32_t phaseTimeGoal);
//Temp change
// Temp change
void ui_draw_temperature_change(void);
//USB-PD debug
void ui_draw_usb_pd_debug_state(const uint16_t vbus_sense_state, const uint8_t stateNumber) ;
void ui_draw_usb_pd_debug_pdo(const uint8_t entry_num, const uint16_t min_voltage, const uint16_t max_voltage, const uint16_t current_a_x100, const uint16_t wattage) ;
// USB-PD debug
void ui_draw_usb_pd_debug_state(const uint16_t vbus_sense_state, const uint8_t stateNumber);
void ui_draw_usb_pd_debug_pdo(const uint8_t entry_num, const uint16_t min_voltage, const uint16_t max_voltage, const uint16_t current_a_x100, const uint16_t wattage);
// Utils
void printVoltage(void);
#endif // UI_DRAWING_UI_DRAWING_HPP_
#endif // UI_DRAWING_UI_DRAWING_HPP_

View File

@@ -2,6 +2,7 @@
#define OPERATING_MODE_UTILITIES_H_
#include "Buttons.hpp"
#include "OLED.hpp"
#include "Settings.h"
#include <stdbool.h>
void GUIDelay(); //
@@ -14,4 +15,4 @@ void printVoltage(void); //
bool checkForUnderVoltage(void); //
uint16_t min(uint16_t a, uint16_t b); //
void printCountdownUntilSleep(int sleepThres); //
#endif
#endif