Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix NaN readings issue in thermocouple TCTempProbeClass class #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/TCTempProbeClass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ uint8_t* boardInfo();
TCTempProbeClass::TCTempProbeClass(PinName tc_cs_pin,
PinName ch_sel0_pin,
PinName ch_sel1_pin,
PinName ch_sel2_pin)
: MAX31855Class(tc_cs_pin), _tc_cs{tc_cs_pin}, _ch_sel0{ch_sel0_pin}, _ch_sel1{ch_sel1_pin}, _ch_sel2{ch_sel2_pin}
PinName ch_sel2_pin,
PinName tc_th_pin)
: MAX31855Class(tc_cs_pin), _tc_cs{tc_cs_pin}, _ch_sel0{ch_sel0_pin}, _ch_sel1{ch_sel1_pin}, _ch_sel2{ch_sel2_pin}, _tc_th{tc_th_pin}
{ }

TCTempProbeClass::~TCTempProbeClass()
Expand All @@ -31,6 +32,7 @@ bool TCTempProbeClass::begin() {
pinMode(_ch_sel0, OUTPUT);
pinMode(_ch_sel1, OUTPUT);
pinMode(_ch_sel2, OUTPUT);
pinMode(_tc_th, OUTPUT);

pinMode(_tc_cs, OUTPUT);

Expand Down Expand Up @@ -92,10 +94,12 @@ void TCTempProbeClass::end() {

void TCTempProbeClass::_enable() {
digitalWrite(_tc_cs, LOW);
digitalWrite(_tc_th, LOW);
}

void TCTempProbeClass::_disable() {
digitalWrite(_tc_cs, HIGH);
digitalWrite(_tc_th, HIGH);
}

TCTempProbeClass MachineControl_TCTempProbe;
Expand Down
4 changes: 3 additions & 1 deletion src/TCTempProbeClass.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ class TCTempProbeClass: public MAX31855Class {
TCTempProbeClass(PinName tc_cs_pin = MC_TC_CS_PIN,
PinName ch_sel0_pin = MC_TC_SEL0_PIN,
PinName ch_sel1_pin = MC_TC_SEL1_PIN,
PinName ch_sel2_pin = MC_TC_SEL2_PIN);
PinName ch_sel2_pin = MC_TC_SEL2_PIN,
PinName tc_th_pin = MC_TC_TH_PIN);

/**
* @brief Destruct the TCTempProbeClass object.
Expand Down Expand Up @@ -74,6 +75,7 @@ class TCTempProbeClass: public MAX31855Class {
PinName _ch_sel0; // Pin for the first channel selection bit
PinName _ch_sel1; // Pin for the second channel selection bit
PinName _ch_sel2; // Pin for the third channel selection bit
PinName _tc_th; // Pin for the TC/RTD connection

/**
* @brief Enable the chip select (CS) of the MAX31855 digital converter.
Expand Down
1 change: 1 addition & 0 deletions src/pins_mc.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
#define MC_TC_SEL0_PIN MC_RTD_SEL0_PIN
#define MC_TC_SEL1_PIN MC_RTD_SEL1_PIN
#define MC_TC_SEL2_PIN MC_RTD_SEL2_PIN
#define MC_TC_TH_PIN MC_RTD_TH_PIN

/* USB */
#define MC_USB_PWR_PIN PB_14
Expand Down