Merge pull request #1292 from MRprusa3d/PFW-639

Bed PowerMonitor
This commit is contained in:
PavelSindler 2018-11-02 19:37:29 +01:00 committed by GitHub
commit ba8de39443
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 9 deletions

View file

@ -8,6 +8,7 @@
#include "stepper.h" #include "stepper.h"
#include "planner.h" #include "planner.h"
#include "fastio.h" #include "fastio.h"
#include "io_atmega2560.h"
#include "cmdqueue.h" #include "cmdqueue.h"
#include "ultralcd.h" #include "ultralcd.h"
#include "ConfigurationStore.h" #include "ConfigurationStore.h"
@ -32,8 +33,8 @@
const char ERRMSG_PAT9125_NOT_RESP[] PROGMEM = "PAT9125 not responding (%d)!\n"; const char ERRMSG_PAT9125_NOT_RESP[] PROGMEM = "PAT9125 not responding (%d)!\n";
#define FSENSOR_INT_PIN 63 //!< filament sensor interrupt pin PK1 #define FSENSOR_INT_PIN 74 //!< filament sensor interrupt pin PJ7
#define FSENSOR_INT_PIN_MSK 0x02 //!< filament sensor interrupt pin mask (bit1) #define FSENSOR_INT_PIN_MSK 0x80 //!< filament sensor interrupt pin mask (bit7)
//uint8_t fsensor_int_pin = FSENSOR_INT_PIN; //uint8_t fsensor_int_pin = FSENSOR_INT_PIN;
uint8_t fsensor_int_pin_old = 0; uint8_t fsensor_int_pin_old = 0;
@ -442,8 +443,8 @@ void fsensor_st_block_begin(block_t* bl)
if (((fsensor_st_cnt > 0) && (bl->direction_bits & 0x8)) || if (((fsensor_st_cnt > 0) && (bl->direction_bits & 0x8)) ||
((fsensor_st_cnt < 0) && !(bl->direction_bits & 0x8))) ((fsensor_st_cnt < 0) && !(bl->direction_bits & 0x8)))
{ {
if (_READ(63)) _WRITE(63, LOW); if (PIN_GET(FSENSOR_INT_PIN)) {PIN_VAL(FSENSOR_INT_PIN, LOW);}
else _WRITE(63, HIGH); else {PIN_VAL(FSENSOR_INT_PIN, HIGH);}
} }
} }
@ -453,8 +454,8 @@ void fsensor_st_block_chunk(block_t* bl, int cnt)
fsensor_st_cnt += (bl->direction_bits & 0x8)?-cnt:cnt; fsensor_st_cnt += (bl->direction_bits & 0x8)?-cnt:cnt;
if ((fsensor_st_cnt >= fsensor_chunk_len) || (fsensor_st_cnt <= -fsensor_chunk_len)) if ((fsensor_st_cnt >= fsensor_chunk_len) || (fsensor_st_cnt <= -fsensor_chunk_len))
{ {
if (_READ(63)) _WRITE(63, LOW); if (PIN_GET(FSENSOR_INT_PIN)) {PIN_VAL(FSENSOR_INT_PIN, LOW);}
else _WRITE(63, HIGH); else {PIN_VAL(FSENSOR_INT_PIN, HIGH);}
} }
} }

View file

@ -2037,9 +2037,8 @@ static void lcd_menu_voltages()
{ {
lcd_timeoutToStatus.stop(); //infinite timeout lcd_timeoutToStatus.stop(); //infinite timeout
float volt_pwr = VOLT_DIV_REF * ((float)current_voltage_raw_pwr / (1023 * OVERSAMPLENR)) / VOLT_DIV_FAC; float volt_pwr = VOLT_DIV_REF * ((float)current_voltage_raw_pwr / (1023 * OVERSAMPLENR)) / VOLT_DIV_FAC;
// float volt_bed = VOLT_DIV_REF * ((float)current_voltage_raw_bed / (1023 * OVERSAMPLENR)) / VOLT_DIV_FAC; float volt_bed = VOLT_DIV_REF * ((float)current_voltage_raw_bed / (1023 * OVERSAMPLENR)) / VOLT_DIV_FAC;
// lcd_printf_P(PSTR(ESC_H(1,1)"PWR: %d.%01dV" ESC_H(1,2)"BED: %d.%01dV"), (int)volt_pwr, (int)(10*fabs(volt_pwr - (int)volt_pwr)), (int)volt_bed, (int)(10*fabs(volt_bed - (int)volt_bed))); lcd_printf_P(PSTR(ESC_H(1,1)"PWR: %d.%01dV" ESC_H(1,2)"BED: %d.%01dV"), (int)volt_pwr, (int)(10*fabs(volt_pwr - (int)volt_pwr)), (int)volt_bed, (int)(10*fabs(volt_bed - (int)volt_bed)));
lcd_printf_P(PSTR( ESC_H(1,1)"PWR: %d.%01dV"), (int)volt_pwr, (int)(10*fabs(volt_pwr - (int)volt_pwr))) ;
menu_back_if_clicked(); menu_back_if_clicked();
} }
#endif //defined VOLT_BED_PIN || defined VOLT_PWR_PIN #endif //defined VOLT_BED_PIN || defined VOLT_PWR_PIN