conditional compilation updated

This commit is contained in:
PavelSindler 2019-01-24 16:14:02 +01:00
parent da2c963893
commit 6b1cf99066
3 changed files with 22 additions and 20 deletions

View File

@ -1481,9 +1481,9 @@ void setup()
setup_fan_interrupt();
#endif //DEBUG_DISABLE_FANCHECK
#ifdef FILAMENT_SENSOR
#ifdef PAT9125
fsensor_setup_interrupt();
#endif //FILAMENT_SENSOR
#endif //PAT9125
for (int i = 0; i<4; i++) EEPROM_read_B(EEPROM_BOWDEN_LENGTH + i * 2, &bowden_length[i]);
#ifndef DEBUG_DISABLE_STARTMSGS

View File

@ -388,7 +388,7 @@ bool fsensor_oq_result(void)
printf_P(_N("fsensor_oq_result %S\n"), (res?_OK:_NG));
return res;
}
#ifdef PAT9125
ISR(FSENSOR_INT_PIN_VECT)
{
if (mmu_enabled || ir_sensor_detected) return;
@ -475,6 +475,23 @@ ISR(FSENSOR_INT_PIN_VECT)
return;
}
void fsensor_setup_interrupt(void)
{
pinMode(FSENSOR_INT_PIN, OUTPUT);
digitalWrite(FSENSOR_INT_PIN, LOW);
fsensor_int_pin_old = 0;
//pciSetup(FSENSOR_INT_PIN);
// !!! "pciSetup()" does not provide the correct results for some MCU pins
// so interrupt registers settings:
FSENSOR_INT_PIN_PCMSK_REG |= bit(FSENSOR_INT_PIN_PCMSK_BIT); // enable corresponding PinChangeInterrupt (individual pin)
PCIFR |= bit(FSENSOR_INT_PIN_PCICR_BIT); // clear previous occasional interrupt (set of pins)
PCICR |= bit(FSENSOR_INT_PIN_PCICR_BIT); // enable corresponding PinChangeInterrupt (set of pins)
}
#endif //PAT9125
void fsensor_st_block_begin(block_t* bl)
{
if (!fsensor_enabled) return;
@ -569,18 +586,3 @@ void fsensor_update(void)
}
#endif //PAT9125
}
void fsensor_setup_interrupt(void)
{
pinMode(FSENSOR_INT_PIN, OUTPUT);
digitalWrite(FSENSOR_INT_PIN, LOW);
fsensor_int_pin_old = 0;
//pciSetup(FSENSOR_INT_PIN);
// !!! "pciSetup()" does not provide the correct results for some MCU pins
// so interrupt registers settings:
FSENSOR_INT_PIN_PCMSK_REG |= bit(FSENSOR_INT_PIN_PCMSK_BIT); // enable corresponding PinChangeInterrupt (individual pin)
PCIFR |= bit(FSENSOR_INT_PIN_PCICR_BIT); // clear previous occasional interrupt (set of pins)
PCICR |= bit(FSENSOR_INT_PIN_PCICR_BIT); // enable corresponding PinChangeInterrupt (set of pins)
}

View File

@ -35,13 +35,13 @@ extern bool fsensor_autoload_enabled;
extern void fsensor_autoload_set(bool State);
extern void fsensor_update(void);
#ifdef PAT9125
//! setup pin-change interrupt
extern void fsensor_setup_interrupt(void);
//! @name autoload support
//! @{
#ifdef PAT9125
extern void fsensor_autoload_check_start(void);
extern void fsensor_autoload_check_stop(void);
#endif //PAT9125