diff --git a/workspace/TS100/Core/BSP/Miniware/Pins.h b/workspace/TS100/Core/BSP/Miniware/Pins.h index ff6586b6..e932d9eb 100644 --- a/workspace/TS100/Core/BSP/Miniware/Pins.h +++ b/workspace/TS100/Core/BSP/Miniware/Pins.h @@ -8,9 +8,9 @@ #ifndef BSP_MINIWARE_PINS_H_ #define BSP_MINIWARE_PINS_H_ -#if defined(MODEL_TS100) + defined(MODEL_TS80) > 1 +#if defined(MODEL_TS100) + defined(MODEL_TS80)+defined(MODEL_TS80P) > 1 #error "Multiple models defined!" -#elif defined(MODEL_TS100) + defined(MODEL_TS80) == 0 +#elif defined(MODEL_TS100) + defined(MODEL_TS80)+ defined(MODEL_TS80P) == 0 #error "No model defined!" #endif @@ -45,8 +45,8 @@ #define SCL_GPIO_Port GPIOB #define SDA_Pin GPIO_PIN_7 #define SDA_GPIO_Port GPIOB - -#else +#endif +#ifdef MODEL_TS80 // TS80 pin map #define KEY_B_Pin GPIO_PIN_0 #define KEY_B_GPIO_Port GPIOB @@ -84,6 +84,45 @@ #define INT_PD_Pin GPIO_PIN_9 #define INT_PD_GPIO_Port GPIOA +#endif +#ifdef MODEL_TS80P +// TS80P pin map +#define KEY_B_Pin GPIO_PIN_0 +#define KEY_B_GPIO_Port GPIOB +#define TMP36_INPUT_Pin GPIO_PIN_4 +#define TMP36_INPUT_GPIO_Port GPIOA +#define TMP36_ADC1_CHANNEL ADC_CHANNEL_4 +#define TIP_TEMP_Pin GPIO_PIN_3 +#define TIP_TEMP_GPIO_Port GPIOA +#define TIP_TEMP_ADC1_CHANNEL ADC_CHANNEL_3 +#define TIP_TEMP_ADC2_CHANNEL ADC_CHANNEL_3 + +#define VIN_Pin GPIO_PIN_2 +#define VIN_GPIO_Port GPIOA +#define VIN_ADC1_CHANNEL ADC_CHANNEL_2 +#define VIN_ADC2_CHANNEL ADC_CHANNEL_2 +#define OLED_RESET_Pin GPIO_PIN_15 +#define OLED_RESET_GPIO_Port GPIOA +#define KEY_A_Pin GPIO_PIN_1 +#define KEY_A_GPIO_Port GPIOB +#define INT_Orientation_Pin GPIO_PIN_4 +#define INT_Orientation_GPIO_Port GPIOB +#define PWM_Out_Pin GPIO_PIN_6 +#define PWM_Out_GPIO_Port GPIOA +#define PWM_Out_CHANNEL TIM_CHANNEL_1 +#define INT_Movement_Pin GPIO_PIN_5 +#define INT_Movement_GPIO_Port GPIOB +#define SCL_Pin GPIO_PIN_6 +#define SCL_GPIO_Port GPIOB +#define SDA_Pin GPIO_PIN_7 +#define SDA_GPIO_Port GPIOB +#define SCL2_Pin GPIO_PIN_5 +#define SCL2_GPIO_Port GPIOA +#define SDA2_Pin GPIO_PIN_1 +#define SDA2_GPIO_Port GPIOA +#define INT_PD_Pin GPIO_PIN_9 +#define INT_PD_GPIO_Port GPIOA + #endif #endif /* BSP_MINIWARE_PINS_H_ */ diff --git a/workspace/TS100/Core/BSP/Miniware/Power.cpp b/workspace/TS100/Core/BSP/Miniware/Power.cpp index 4421151e..3faeedb5 100644 --- a/workspace/TS100/Core/BSP/Miniware/Power.cpp +++ b/workspace/TS100/Core/BSP/Miniware/Power.cpp @@ -8,10 +8,9 @@ bool FUSB302_present = false; void power_probe() { // If TS80 probe for QC // If TS100 - noop -#ifdef MODEL_TS80 +#ifdef defined(MODEL_TS80)+defined(MODEL_TS80P)>0 startQC(systemSettings.voltageDiv); - seekQC((systemSettings.cutoutSetting) ? 120 : 90, systemSettings.voltageDiv); // this will move the QC output to the preferred voltage to start with @@ -19,12 +18,12 @@ void power_probe() { } void power_check() { -#ifdef MODEL_TS80 +#ifdef defined(MODEL_TS80)+defined(MODEL_TS80P)>0 QC_resync(); #endif } uint8_t usb_pd_detect() { -#ifdef MODEL_TS80 +#ifdef MODEL_TS80P FUSB302_present = fusb302_detect(); if (FUSB302_present) { GPIO_InitTypeDef GPIO_InitStruct; @@ -39,9 +38,11 @@ uint8_t usb_pd_detect() { return false; } uint8_t pd_irq_read() { -#ifdef MODEL_TS80 - return HAL_GPIO_ReadPin(INT_PD_GPIO_Port, INT_PD_Pin) == GPIO_PIN_SET ? - 1 : 0; +#ifdef MODEL_TS80P + if (FUSB302_present) { + return HAL_GPIO_ReadPin(INT_PD_GPIO_Port, INT_PD_Pin) == GPIO_PIN_SET ? + 1 : 0; + } #endif return 0; } diff --git a/workspace/TS100/Core/BSP/Miniware/QC_GPIO.cpp b/workspace/TS100/Core/BSP/Miniware/QC_GPIO.cpp index bd3841c3..5d5f3b10 100644 --- a/workspace/TS100/Core/BSP/Miniware/QC_GPIO.cpp +++ b/workspace/TS100/Core/BSP/Miniware/QC_GPIO.cpp @@ -67,8 +67,8 @@ void QC_Post_Probe_En() { uint8_t QC_DM_PulledDown() { return HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_11) == GPIO_PIN_RESET ? 1 : 0; } void QC_resync() { -#ifdef MODEL_TS80 +#if defined(MODEL_TS80) + defined(MODEL_TS80P) >0 seekQC((systemSettings.cutoutSetting) ? 120 : 90, systemSettings.voltageDiv); // Run the QC seek again if we have drifted too much #endif -} \ No newline at end of file +} diff --git a/workspace/TS100/Core/BSP/Miniware/UnitSettings.h b/workspace/TS100/Core/BSP/Miniware/UnitSettings.h index f3588b8b..46a1b78c 100644 --- a/workspace/TS100/Core/BSP/Miniware/UnitSettings.h +++ b/workspace/TS100/Core/BSP/Miniware/UnitSettings.h @@ -8,7 +8,7 @@ #ifndef BSP_MINIWARE_UNITSETTINGS_H_ #define BSP_MINIWARE_UNITSETTINGS_H_ //On the TS80, the LIS accel is mounted backwards -#ifdef MODEL_TS80 +#if defined(MODEL_TS80)+defined(MODEL_TS80P)>0 #define LIS_ORI_FLIP #endif diff --git a/workspace/TS100/Core/BSP/Miniware/preRTOS.cpp b/workspace/TS100/Core/BSP/Miniware/preRTOS.cpp index 2e81642a..f342f8a7 100644 --- a/workspace/TS100/Core/BSP/Miniware/preRTOS.cpp +++ b/workspace/TS100/Core/BSP/Miniware/preRTOS.cpp @@ -20,7 +20,7 @@ void preRToSInit() { HAL_Delay(50); HAL_GPIO_WritePin(OLED_RESET_GPIO_Port, OLED_RESET_Pin, GPIO_PIN_SET); HAL_Delay(50); -#ifdef MODEL_TS80 +#ifdef MODEL_TS80P I2CBB::init(); //Spawn all of the USB-C processors fusb302_start_processing(); diff --git a/workspace/TS100/Core/Drivers/FUSB302/fusb302b.cpp b/workspace/TS100/Core/Drivers/FUSB302/fusb302b.cpp index 6e57b9fc..df6e105f 100644 --- a/workspace/TS100/Core/Drivers/FUSB302/fusb302b.cpp +++ b/workspace/TS100/Core/Drivers/FUSB302/fusb302b.cpp @@ -42,7 +42,9 @@ static uint8_t fusb_read_byte(uint8_t addr) { * buf: The buffer into which data will be read */ static void fusb_read_buf(uint8_t addr, uint8_t size, uint8_t *buf) { - I2CBB::Mem_Read(FUSB302B_ADDR, addr, (uint8_t*) buf, size); + if(!I2CBB::Mem_Read(FUSB302B_ADDR, addr, (uint8_t*) buf, size)){ + asm("bkpt"); + } } @@ -54,7 +56,9 @@ static void fusb_read_buf(uint8_t addr, uint8_t size, uint8_t *buf) { * byte: The value to write */ static void fusb_write_byte(uint8_t addr, uint8_t byte) { - I2CBB::Mem_Write(FUSB302B_ADDR, addr, (uint8_t*) &byte, 1); + if(!I2CBB::Mem_Write(FUSB302B_ADDR, addr, (uint8_t*) &byte, 1)){ + asm("bkpt"); + } } @@ -67,7 +71,9 @@ static void fusb_write_byte(uint8_t addr, uint8_t byte) { * buf: The buffer to write */ static void fusb_write_buf(uint8_t addr, uint8_t size, const uint8_t *buf) { - I2CBB::Mem_Write(FUSB302B_ADDR, addr, (uint8_t*) &buf, size); + if(!I2CBB::Mem_Write(FUSB302B_ADDR, addr, (uint8_t*) &buf, size)){ + asm("bkpt"); + } } diff --git a/workspace/TS100/Core/Drivers/FUSB302/fusbpd.cpp b/workspace/TS100/Core/Drivers/FUSB302/fusbpd.cpp index 00b84e96..f6afe163 100644 --- a/workspace/TS100/Core/Drivers/FUSB302/fusbpd.cpp +++ b/workspace/TS100/Core/Drivers/FUSB302/fusbpd.cpp @@ -21,7 +21,7 @@ uint8_t fusb302_detect() { } void fusb302_start_processing() { - + HAL_Delay(30); /* Initialize the FUSB302B */ fusb_setup(); diff --git a/workspace/TS100/Core/Drivers/FUSB302/hard_reset.cpp b/workspace/TS100/Core/Drivers/FUSB302/hard_reset.cpp index 648a7f4e..0f81f646 100644 --- a/workspace/TS100/Core/Drivers/FUSB302/hard_reset.cpp +++ b/workspace/TS100/Core/Drivers/FUSB302/hard_reset.cpp @@ -103,7 +103,7 @@ void ResetHandler::init() { void ResetHandler::notify(uint32_t notification) { xTaskNotify(TaskHandle, notification, - eNotifyAction::eSetValueWithOverwrite); + eNotifyAction::eSetBits); } void ResetHandler::Thread(const void *arg) { diff --git a/workspace/TS100/Core/Drivers/FUSB302/pd.h b/workspace/TS100/Core/Drivers/FUSB302/pd.h index c6b94c6c..e94e9cbe 100644 --- a/workspace/TS100/Core/Drivers/FUSB302/pd.h +++ b/workspace/TS100/Core/Drivers/FUSB302/pd.h @@ -278,15 +278,13 @@ #define PD_T_PS_TRANSITION (500) #define PD_T_SENDER_RESPONSE (27) #define PD_T_SINK_REQUEST (100) -#define PD_T_TYPEC_SINK_WAIT_CAP (465) -#define PD_T_PPS_REQUEST TIME_S2I(10) -/* This is actually from Type-C, not Power Delivery, but who cares? */ +#define PD_T_TYPEC_SINK_WAIT_CAP (465+100) #define PD_T_PD_DEBOUNCE (15) /* * Counter maximums */ -#define PD_N_HARD_RESET_COUNT 2 +#define PD_N_HARD_RESET_COUNT 10 /* * Value parameters diff --git a/workspace/TS100/Core/Drivers/FUSB302/pdb_conf.h b/workspace/TS100/Core/Drivers/FUSB302/pdb_conf.h index ef733c3d..c2ca0f3f 100644 --- a/workspace/TS100/Core/Drivers/FUSB302/pdb_conf.h +++ b/workspace/TS100/Core/Drivers/FUSB302/pdb_conf.h @@ -22,21 +22,6 @@ /* Number of messages in the message pool */ #define PDB_MSG_POOL_SIZE 4 -/* Size of the Policy Engine thread's working area */ -#define PDB_PE_WA_SIZE 256 - -/* Size of the protocol layer RX thread's working area */ -#define PDB_PRLRX_WA_SIZE 256 - -/* Size of the protocol layer TX thread's working area */ -#define PDB_PRLTX_WA_SIZE 256 - -/* Size of the protocol layer hard reset thread's working area */ -#define PDB_HARDRST_WA_SIZE 256 - -/* Size of the INT_N thread's working area */ -#define PDB_INT_N_WA_SIZE 128 - #define EVENT_MASK(x) (1<obj[i] & PD_PDO_TYPE) == PD_PDO_TYPE_AUGMENTED @@ -108,6 +109,7 @@ bool PolicyEngine::pdbs_dpm_evaluate_capability( // // return true; } +#endif } /* If there's a PDO in the voltage range, use it */ // int8_t i = dpm_get_range_fixed_pdo_index(caps, scfg); diff --git a/workspace/TS100/Core/Drivers/FUSB302/protocol_rx.cpp b/workspace/TS100/Core/Drivers/FUSB302/protocol_rx.cpp index a3ebb2b2..14573aca 100644 --- a/workspace/TS100/Core/Drivers/FUSB302/protocol_rx.cpp +++ b/workspace/TS100/Core/Drivers/FUSB302/protocol_rx.cpp @@ -34,10 +34,12 @@ uint8_t ProtocolReceive::_tx_messageidcounter; */ ProtocolReceive::protocol_rx_state ProtocolReceive::protocol_rx_wait_phy() { /* Wait for an event */ + _rx_messageid = 0; eventmask_t evt = waitForEvent(0xFFFFFFFF); /* If we got a reset event, reset */ if (evt & PDB_EVT_PRLRX_RESET) { + waitForEvent(PDB_EVT_PRLRX_RESET, 0); return PRLRxWaitPHY; } /* If we got an I_GCRCSENT event, read the message and decide what to do */ @@ -75,7 +77,7 @@ ProtocolReceive::protocol_rx_state ProtocolReceive::protocol_rx_reset() { taskYIELD(); /* If we got a RESET signal, reset the machine */ - if (waitForEvent(PDB_EVT_PRLRX_RESET) != 0) { + if (waitForEvent(PDB_EVT_PRLRX_RESET, 0) != 0) { return PRLRxWaitPHY; } @@ -88,17 +90,16 @@ ProtocolReceive::protocol_rx_state ProtocolReceive::protocol_rx_reset() { */ ProtocolReceive::protocol_rx_state ProtocolReceive::protocol_rx_check_messageid() { /* If we got a RESET signal, reset the machine */ - if (waitForEvent(PDB_EVT_PRLRX_RESET) != 0) { - + if (waitForEvent(PDB_EVT_PRLRX_RESET, 0) == PDB_EVT_PRLRX_RESET) { return PRLRxWaitPHY; } - /* If the message has the stored ID, we've seen this message before. Free * it and don't pass it to the policy engine. */ + + /* Otherwise, there's either no stored ID or this message has an ID we + * haven't just seen. Transition to the Store_MessageID state. */ if (PD_MESSAGEID_GET(&tempMessage) == _rx_messageid) { return PRLRxWaitPHY; - /* Otherwise, there's either no stored ID or this message has an ID we - * haven't just seen. Transition to the Store_MessageID state. */ } else { return PRLRxStoreMessageID; } @@ -160,12 +161,11 @@ void ProtocolReceive::thread(const void *args) { } void ProtocolReceive::notify(uint32_t notification) { - xTaskNotify(TaskHandle, notification, - eNotifyAction::eSetValueWithOverwrite); + xTaskNotify(TaskHandle, notification, eNotifyAction::eSetBits); } uint32_t ProtocolReceive::waitForEvent(uint32_t mask, uint32_t ticksToWait) { uint32_t pulNotificationValue; xTaskNotifyWait(0x00, mask, &pulNotificationValue, ticksToWait); - return pulNotificationValue; + return pulNotificationValue & mask; } diff --git a/workspace/TS100/Core/Drivers/FUSB302/protocol_tx.cpp b/workspace/TS100/Core/Drivers/FUSB302/protocol_tx.cpp index 759cb003..00fd8f02 100644 --- a/workspace/TS100/Core/Drivers/FUSB302/protocol_tx.cpp +++ b/workspace/TS100/Core/Drivers/FUSB302/protocol_tx.cpp @@ -45,7 +45,9 @@ ProtocolTransmit::protocol_tx_state ProtocolTransmit::protocol_tx_phy_reset() { /* Tell the policy engine that we failed */ PolicyEngine::notify( PDB_EVT_PE_TX_ERR); /* Finish failing to send the message */ - getMessage(); //Discard + while (messagePending()) { + getMessage(); //Discard + } } /* Wait for a message request */ @@ -103,7 +105,7 @@ ProtocolTransmit::protocol_tx_state ProtocolTransmit::protocol_tx_reset() { ProtocolTransmit::protocol_tx_state ProtocolTransmit::protocol_tx_construct_message() { /* Make sure nobody wants us to reset */ eventmask_t evt = waitForEvent( - PDB_EVT_PRLTX_RESET | PDB_EVT_PRLTX_DISCARD); + PDB_EVT_PRLTX_RESET | PDB_EVT_PRLTX_DISCARD, 0); if (evt & PDB_EVT_PRLTX_RESET) { return PRLTxPHYReset; @@ -119,7 +121,7 @@ ProtocolTransmit::protocol_tx_state ProtocolTransmit::protocol_tx_construct_mess /* PD 3.0 collision avoidance */ if (PolicyEngine::isPD3_0()) { /* If we're starting an AMS, wait for permission to transmit */ - evt = waitForEvent(PDB_EVT_PRLTX_START_AMS); + evt = waitForEvent(PDB_EVT_PRLTX_START_AMS, 0); if (evt & PDB_EVT_PRLTX_START_AMS) { while (fusb_get_typec_current() != fusb_sink_tx_ok) { osDelay(1); @@ -253,14 +255,14 @@ void ProtocolTransmit::thread(const void *args) { void ProtocolTransmit::notify(uint32_t notification) { xTaskNotify(TaskHandle, notification, - eNotifyAction::eSetValueWithOverwrite); + eNotifyAction::eSetBits); } void ProtocolTransmit::init() { messagesWaiting = xQueueCreateStatic(PDB_MSG_POOL_SIZE, sizeof(union pd_msg), ucQueueStorageArea, &xStaticQueue); - osThreadStaticDef(pd_txTask, thread, PDB_PRIO_PRL, 0, TaskStackSize, + osThreadStaticDef(pd_txTask, thread,osPriorityAboveNormal, 0, TaskStackSize, TaskBuffer, &TaskControlBlock); TaskHandle = osThreadCreate(osThread(pd_txTask), NULL); } diff --git a/workspace/TS100/Core/Inc/power.hpp b/workspace/TS100/Core/Inc/power.hpp index c882a99a..31fddd33 100644 --- a/workspace/TS100/Core/Inc/power.hpp +++ b/workspace/TS100/Core/Inc/power.hpp @@ -9,6 +9,7 @@ #include #include "BSP.h" #include "expMovingAverage.h" +#include "../../configuration.h" #ifndef POWER_HPP_ #define POWER_HPP_ @@ -18,16 +19,6 @@ // This is necessary because of the temp noise and thermal lag in the system. // Once we have feed-forward temp estimation we should be able to better tune this. -#ifdef MODEL_TS100 -const int32_t tipMass = 45; // X10 watts to raise 1 deg C in 1 second -const uint8_t tipResistance = 85; //x10 ohms, 8.5 typical for ts100, 4.5 typical for ts80 - -#endif -#ifdef MODEL_TS80 -const uint32_t tipMass = 40; -const uint8_t tipResistance = 45; //x10 ohms, 8.5 typical for ts100, 4.5 typical for ts80 - -#endif const uint8_t wattHistoryFilter = 24; // I term look back weighting extern expMovingAverage x10WattHistory; diff --git a/workspace/TS100/Core/Src/main.cpp b/workspace/TS100/Core/Src/main.cpp index e8258523..023fd287 100644 --- a/workspace/TS100/Core/Src/main.cpp +++ b/workspace/TS100/Core/Src/main.cpp @@ -43,6 +43,8 @@ int main(void) { OLED::setFont(0); // default to bigger font // Testing for which accelerometer is mounted resetWatchdog(); + usb_pd_available = usb_pd_detect(); + resetWatchdog(); settingsWereReset = restoreSettings(); // load the settings from flash if (MMA8652FC::detect()) { PCBVersion = 1; @@ -58,8 +60,6 @@ int main(void) { systemSettings.sensitivity = 0; } resetWatchdog(); - usb_pd_available = usb_pd_detect(); - resetWatchdog(); /* Create the thread(s) */ /* definition and creation of GUITask */ diff --git a/workspace/TS100/Makefile b/workspace/TS100/Makefile index a9868318..ba6ba490 100644 --- a/workspace/TS100/Makefile +++ b/workspace/TS100/Makefile @@ -22,6 +22,7 @@ FRTOS_CMIS_INC_DIR = ./Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS FRTOS_INC_DIR = ./Middlewares/Third_Party/FreeRTOS/Source/include FRTOS_GCC_INC_DIR = ./Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM3 DRIVER_INC_DIR =./Core/Drivers +FUSB_DRIVERS_INC_DIR = ./Core/Drivers/FUSB302 BSP_INC_DIR = ./Core/BSP MINIWARE_INC_DIR = ./Core/BSP/Miniware THREADS_INC_DIR = ./Core/Threads @@ -37,7 +38,8 @@ INCLUDES = -I$(APP_INC_DIR) \ -I$(DRIVER_INC_DIR) \ -I$(BSP_INC_DIR) \ -I$(MINIWARE_INC_DIR) \ - -I$(THREADS_INC_DIR) + -I$(THREADS_INC_DIR) \ + -I$(FUSB_DRIVERS_INC_DIR) # output folder HEXFILE_DIR=Hexfile diff --git a/workspace/TS100/configuration.h b/workspace/TS100/configuration.h index 1bdc13d0..66688f12 100644 --- a/workspace/TS100/configuration.h +++ b/workspace/TS100/configuration.h @@ -76,7 +76,6 @@ #define DETAILED_SOLDERING 0 // 0: Disable 1: Enable - Default 0 #define DETAILED_IDLE 0 // 0: Disable 1: Enable - Default 0 - #define CUT_OUT_SETTING 0 // default to no cut-off voltage (or 18W for TS80) #define TEMPERATURE_INF 0 // default to 0 #define DESCRIPTION_SCROLL_SPEED 0 // 0: Slow 1: Fast - default to slow @@ -94,6 +93,10 @@ #define OP_AMP_GAIN_STAGE_TS80 (1+(OP_AMP_Rf_TS80/OP_AMP_Rin_TS80)) +//Deriving the Voltage div: +// Vin_max = (3.3*(r1+r2))/(r2) +//vdiv = (32768*4)/(vin_max*10) + #ifdef MODEL_TS100 #define VOLTAGE_DIV 467 // 467 - Default divider from schematic #define CALIBRATION_OFFSET 900 // 900 - Default adc offset in uV @@ -105,11 +108,39 @@ #endif #ifdef MODEL_TS80 - #define VOLTAGE_DIV 780 // Default divider from schematic - #define PID_POWER_LIMIT 24 // Sets the max pwm power limit - #define CALIBRATION_OFFSET 900 // the adc offset in uV - #define POWER_LIMIT 24 // 24 watts default power limit - #define MAX_POWER_LIMIT 30 // - #define POWER_LIMIT_STEPS 2 - #define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_TS80 +#define VOLTAGE_DIV_TS80P 768 // Default for TS80P with slightly different resistors +#define VOLTAGE_DIV 780 // Default divider from schematic +#define PID_POWER_LIMIT 24 // Sets the max pwm power limit +#define CALIBRATION_OFFSET 900 // the adc offset in uV +#define POWER_LIMIT 24 // 24 watts default power limit +#define MAX_POWER_LIMIT 30 // +#define POWER_LIMIT_STEPS 2 +#define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_TS80 +#endif + +#ifdef MODEL_TS80P +#define VOLTAGE_DIV 768 // Default for TS80P with slightly different resistors +#define PID_POWER_LIMIT 30 // Sets the max pwm power limit +#define CALIBRATION_OFFSET 900 // the adc offset in uV +#define POWER_LIMIT 24 // 24 watts default power limit +#define MAX_POWER_LIMIT 30 // +#define POWER_LIMIT_STEPS 2 +#define OP_AMP_GAIN_STAGE OP_AMP_GAIN_STAGE_TS80 +#endif + + + +#ifdef MODEL_TS100 +const int32_t tipMass = 45; // X10 watts to raise 1 deg C in 1 second +const uint8_t tipResistance = 85; //x10 ohms, 8.5 typical for ts100, 4.5 typical for ts80 +#endif + +#ifdef MODEL_TS80 +const uint32_t tipMass = 40; +const uint8_t tipResistance = 45; //x10 ohms, 4.5 typical for ts80 tips +#endif + +#ifdef MODEL_TS80P +const uint32_t tipMass = 40; +const uint8_t tipResistance = 45; //x10 ohms, 4.5 typical for ts80 tips #endif