Skip to content

Commit

Permalink
Start linking in manual tip resistance
Browse files Browse the repository at this point in the history
  • Loading branch information
Ralim committed Sep 9, 2024
1 parent 4e42cdd commit adf86b3
Show file tree
Hide file tree
Showing 9 changed files with 94 additions and 12 deletions.
1 change: 0 additions & 1 deletion Env.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: "3"
name: "ironos"
services:
builder:
Expand Down
13 changes: 11 additions & 2 deletions source/Core/BSP/Miniware/BSP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,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
Expand Down
8 changes: 7 additions & 1 deletion source/Core/BSP/Pinecil/BSP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,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; }

Expand Down
6 changes: 5 additions & 1 deletion source/Core/BSP/Pinecilv2/BSP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,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; }
Expand Down
2 changes: 2 additions & 0 deletions source/Core/BSP/Pinecilv2/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,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
Expand Down
6 changes: 5 additions & 1 deletion source/Core/BSP/Sequre/BSP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,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; }
Expand Down
7 changes: 4 additions & 3 deletions source/Core/Inc/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#define CORE_SETTINGS_H_
#include <stdbool.h>
#include <stdint.h>

#include "configuration.h"
#ifdef MODEL_Pinecilv2
// Required settings reset for PR #1916
#define SETTINGSVERSION (0x55AB) // This number is frozen, do not edit
Expand Down Expand Up @@ -124,7 +124,7 @@ typedef enum {
*/
typedef enum {
#ifdef AUTO_TIP_SELECTION
AUTO, // If the hardware supports automatic detection
TIP_TYPE_AUTO, // If the hardware supports automatic detection
#endif

#ifdef TIPTYPE_T12
Expand All @@ -137,11 +137,12 @@ typedef enum {
// We do not know of other tuning tips (?yet?)
#endif
#ifdef TIPTYPE_JBC
JBC_2_5_OHM, // Small JBC tips as used in the S60
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();

// Settings wide operations
void saveSettings();
Expand Down
61 changes: 59 additions & 2 deletions source/Core/Src/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,12 +304,69 @@ const char *lookupTipName() {

switch (value) {
#ifdef AUTO_TIP_SELECTION
case tipType_t::AUTO:
return translatedString(Tr->USBPDModeDefault);
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->TipTypeJBC);
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;
}
}
2 changes: 1 addition & 1 deletion source/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ifndef model
model:=Pinecil
model:=Pinecilv2
endif

ALL_MINIWARE_MODELS=TS100 TS80 TS80P TS101
Expand Down

0 comments on commit adf86b3

Please sign in to comment.