@ Ziss
I have the qynx controller tested, with a small engine one of the controllers hold while flying. I think the settings were not correct for this engine.
I must further test.
if RC input below RCP_MIN (by powerup) the controller won't arm.
Furthermore, with these settings I hear and see a small dip with ca.1770us to the input.
//*************************
// RC Input *
//*************************
#define RCP_MIN 900
#define RCP_MAX 2100
#define RCP_START 1100
#define RCP_FULL 1900
#define RCP_DEADBAND 5
(tested with a Hitec HFP-10)
Further change what I made for the Qynx controller:
in M8.h :
Code: Select all
#if (BOARD == _QYNX_)
#warning "INT1 for Qynx target"
ISR(INT1_vect) {
uint16_t time = TCNT1;
uint8_t state = (PIND & _BV(3));
rx_ppm_callback(time, state);
}
inline void AttachPPM() {
PORTD |= _BV(3); // activeer pullup
MCUCR = (MCUCR & ~((1 << ISC10) | (1 << ISC11))) | (1 << ISC10);
GICR |= (1 << INT1);
}
#else
ISR(INT0_vect) {
uint16_t time = TCNT1;
uint8_t state = (PIND & _BV(2));
rx_ppm_callback(time, state);
}
inline void AttachPPM() {
PORTD |= _BV(2);
MCUCR = (MCUCR & ~((1 << ISC00) | (1 << ISC01))) | (1 << ISC00);
GICR |= (1 << INT0);
}
#endif
in core.h :
Code: Select all
#if (BOARD == _QYNX_)
#include "hal/m8.h"
#include "hal/qynx.h"
#endif
and the qynx.h :
Code: Select all
#ifndef _QYNX_H_
#define _QYNX_H_
//*********************
// PORT B definitions *
//*********************
#define CpFET 1
#define BpFET 2
#define ApFET 3
#define PORTB_INIT (1<<ApFET) + (1<<BpFET) + (1<<CpFET)
#define PORTB_DD (1<<ApFET) + (1<<BpFET) + (1<<CpFET)
#define BRAKE_PB 0
//*********************
// PORT C definitions *
//*********************
#define AnFET 0
#define BnFET 1
#define CnFET 2
#define PORTC_INIT 0
#define PORTC_DD (1<<AnFET) + (1<<BnFET) + (1<<CnFET)
#define BRAKE_PC (1<<AnFET) + (1<<BnFET) + (1<<CnFET)
//*********************
// PORT D definitions *
//*********************
#define DbgLED 2
#define rcp_in 3
#define DbgStr 4
#define c_comp 6
#define PORTD_INIT (1<<DbgLED) + (0<<rcp_in) + (1<<DbgStr) + (0<<c_comp)
#define PORTD_DD (1<<DbgLED) + (1<<DbgStr)
#define BRAKE_PD 0
inline void DebugLEDOn() {PORTD |= _BV(DbgLED);}
inline void DebugLEDOff() {PORTD &=~_BV(DbgLED);}
inline void DebugLEDToggle() {PORTD ^= _BV(DbgLED);}
inline void DebugStrOn() {PORTB |= _BV(DbgStr);}
inline void DebugStrOff() {PORTB &=~_BV(DbgStr);}
inline void DebugStrToggle() {PORTB ^= _BV(DbgStr);}
//*********************
// FET Control *
//*********************
inline void ApFETOn() {PORTB &= ~_BV(ApFET);}
inline void ApFETOff() {PORTB |= _BV(ApFET);}
inline void AnFETOn() {PORTC |= _BV(AnFET);}
inline void AnFETOff() {PORTC &= ~_BV(AnFET);}
inline void BpFETOn() {PORTB &= ~_BV(BpFET);}
inline void BpFETOff() {PORTB |= _BV(BpFET);}
inline void BnFETOn() {PORTC |= _BV(BnFET);}
inline void BnFETOff() {PORTC &= ~_BV(BnFET);}
inline void CpFETOn() {PORTB &= ~_BV(CpFET);}
inline void CpFETOff() {PORTB |= _BV(CpFET);}
inline void CnFETOn() {PORTC |= _BV(CnFET);}
inline void CnFETOff() {PORTC &= ~_BV(CnFET);}
//*********************
// ADC definitions *
//*********************
#define mux_a 3
#define mux_b 4
#define mux_c 5
inline void ACInit() {
ACMultiplexed();
ACSR |= _BV(ACIC);
}
inline void ACPhaseA() {
ACChannel(mux_a);
}
inline void ACPhaseB() {
ACChannel(mux_b);
}
inline void ACPhaseC() {
ACChannel(mux_c);
};
//#define BEMF_FILTER_DELAY_US 22
void Board_Idle() {
};
inline void Board_Init() {
TIMSK = 0;
// Timer1
TCCR1A = 0;
TCCR1B = _BV(CS11); /* div 8 clock prescaler */
PORTB = PORTB_INIT; DDRB = PORTB_DD;
PORTC = PORTC_INIT; DDRC = PORTC_DD;
PORTD = PORTD_INIT; DDRD = PORTD_DD;
ACInit();
}
#endif // _QYNX_H_
And I have set the necessary settings in codeblocks
Very clean and readable code
Rob