Good afternoon,
I have a CRIUS MultiWii AIO Pro and I want to display the GPS status on another pin so that I can put a series of LEDs to show what fix I have.
I have looked in many different places but have not found the answer I require.
Any help would be appreciated as what little hair I have is being pulled out.
Thanks
JGF
Redirecting GPS status LED
Re: Redirecting GPS status LED
I have described a solution which even exceeds your purpose in
viewtopic.php?f=16&t=4779&p=47933#p47933
You have a ATMega2560-based board with some pins available so the solution fits to your hardware.
Attaching a GPS to your flight controller will cause the related LEDs to blink until the 3d-fix will have been reached.
Afterwards the LEDs will be switched on permanently.
At position hold the LEDs start blinking slowly, at return to home they blink fast.
Beside the indication of the status of the GPS device you get the arming status ans the error status for free.
viewtopic.php?f=16&t=4779&p=47933#p47933
You have a ATMega2560-based board with some pins available so the solution fits to your hardware.
Attaching a GPS to your flight controller will cause the related LEDs to blink until the 3d-fix will have been reached.
Afterwards the LEDs will be switched on permanently.
At position hold the LEDs start blinking slowly, at return to home they blink fast.
Beside the indication of the status of the GPS device you get the arming status ans the error status for free.
- JollyGreyFlyer
- Posts: 10
- Joined: Sun Sep 22, 2013 3:16 pm
Re: Redirecting GPS status LED
Hi QuadBow,
The Yellow GPS led acts differently to how you described it.
No fix flash
Fix of <5
Fix of >5 - 6= 1flash, 7=2flash etc
I had a feeling that a re-designation of a pin might work.
Thanks Dave
The Yellow GPS led acts differently to how you described it.
No fix flash
Fix of <5
Fix of >5 - 6= 1flash, 7=2flash etc
I had a feeling that a re-designation of a pin might work.
Thanks Dave
Re: Redirecting GPS status LED
Hi JollyGreyFlyer,
Have you already tested it? You must be very fast!
Actually I don't have yellow LEDs, but blue LEDs for the GPS device.
The pin layout is as described in the file def.h
#define LED_GREEN_PINMODE pinMode (30, OUTPUT);
#define LED_BLUE_PINMODE pinMode (31, OUTPUT);
#define LED_RED_PINMODE pinMode (33, OUTPUT);
But I've got another board - I hope they do not differ.
But, most likely something went wrong with the adding or replacing of the new code.
The first section of my code has to be added in the funcion alarmPatternComposer (did I write something like alarmHandler? Maybe that is the reason - sorry) like follows
Have you already tested it? You must be very fast!
Actually I don't have yellow LEDs, but blue LEDs for the GPS device.
The pin layout is as described in the file def.h
#define LED_GREEN_PINMODE pinMode (30, OUTPUT);
#define LED_BLUE_PINMODE pinMode (31, OUTPUT);
#define LED_RED_PINMODE pinMode (33, OUTPUT);
But I've got another board - I hope they do not differ.
But, most likely something went wrong with the adding or replacing of the new code.
The first section of my code has to be added in the funcion alarmPatternComposer (did I write something like alarmHandler? Maybe that is the reason - sorry) like follows
Code: Select all
void alarmPatternComposer(){
static char resource = 0;
// patternDecode(length1,length2,length3,beeppause,endpause,loop)
#if defined(BUZZER)
resource = 1; //buzzer selected
if (alarmArray[1] == 2) patternDecode(resource,200,0,0,50,2000); //failsafe "find me" signal
else if (alarmArray[1] == 1 || alarmArray[8] == 1) patternDecode(resource,50,200,200,50,50); //failsafe "panic" or Acc not calibrated
else if (alarmArray[0] == 1) patternDecode(resource,50,0,0,50,0); //toggle 1
else if (alarmArray[0] == 2) patternDecode(resource,50,50,0,50,0); //toggle 2
else if (alarmArray[0] > 2) patternDecode(resource,50,50,50,50,0); //toggle else
else if (alarmArray[2] == 2) patternDecode(resource,50,50,0,50,50); //gps installed but no fix
else if (alarmArray[3] == 1) patternDecode(resource,50,50,50,50,50); //BeeperOn
else if (alarmArray[4] == 1) patternDecode(resource,50,50,0,50,120); //pMeter Warning
else if (alarmArray[5] == 1) patternDecode(resource,50,50,50,50,0); //Runtime warning
else if (alarmArray[6] == 4) patternDecode(resource,50,50,200,50,2000); //vbat critical
else if (alarmArray[6] == 2) patternDecode(resource,50,200,0,50,2000); //vbat warning
else if (alarmArray[6] == 1) patternDecode(resource,200,0,0,50,2000); //vbat info
else if (alarmArray[7] == 1) patternDecode(resource,200,0,0,50,200); //confirmation indicator 1x
else if (alarmArray[7] == 2) patternDecode(resource,200,200,0,50,200); //confirmation indicator 2x
else if (alarmArray[7] > 2) patternDecode(resource,200,200,200,50,200); //confirmation indicator 3x
else if (SequenceActive[(uint8_t)resource] == 1) patternDecode(resource,0,0,0,0,0); // finish last sequence if not finished yet
else turnOff(resource); // turn off the resource
alarmArray[8] = 0; //reset acc not calibrated
#endif
#if defined(PILOTLAMP)
if (alarmArray[9] == 1) PilotLampSequence(100,B000111,2); //I2C Error
else if (alarmArray[3] == 1) PilotLampSequence(100,B0101<<8|B00010001,4); //BeeperOn
else{
resource = 2;
if (f.ARMED && f.ANGLE_MODE) patternDecode(resource,100,100,100,100,1000); //Green Slow Blink-->angle
else if (f.ARMED && f.HORIZON_MODE) patternDecode(resource,200,200,200,100,1000); //Green mid Blink-->horizon
else if (f.ARMED) patternDecode(resource,100,100,0,100,1000); //Green fast Blink-->acro
else turnOff(resource); //switch off
resource = 3;
#if GPS
if (alarmArray[2]==1) patternDecode(resource,100,100,100,100,100); // blue fast blink -->no gps fix
else if (f.GPS_HOME_MODE || f.GPS_HOLD_MODE) patternDecode(resource,100,100,100,100,1000); //blue slow blink --> gps active
else setTiming(resource,100,1000); //blue short blink -->gps fix ok
#else
turnOff(resource);
#endif
resource = 4;
if (alarmArray[1] == 1) setTiming(resource,100,100); //Red fast blink--> failsafe panic
else if (alarmArray[1] == 2) patternDecode(resource,1000,0,0,0,2000); //red slow blink--> failsafe find me
else turnOff(resource);
}
#endif
#if defined(LED_MONITOR)
resource = 5;
if (alarmArray[9] == 1) setTiming(resource,100,100); //all very fast blink -->I2C Error
#if defined(FAILSAFE)
else if (alarmArray[1] == 2) patternDecode(resource,100,100,100,100,1000); //all triple blink --> failsafe level2
else if (alarmArray[1] == 1) patternDecode(resource,100,100,0,100,1000); //all double blink --> failsafe level1
#endif
else {
resource = 2;
if (f.ARMED) {
if (!f.ACC_CALIBRATED) patternDecode(resource,100,100,100,100,1000); //green triple blink --> multiwii not stable or uncalibrated
else if (f.ANGLE_MODE) turnOn(resource); //green static --> angle
else if (f.HORIZON_MODE) patternDecode(resource,200,200,0,100,1000); //green slow blink --> horizon
else patternDecode(resource,100,100,0,100,1000); //green fast blink --> acro
}
else turnOff(resource); //not armed --> switch off
resource = 3;
#if GPS
if (alarmArray[2] == 1) patternDecode(resource,100,100,100,100,1000); //blue triple blink --> no gps fix
else if (f.GPS_HOLD_MODE) patternDecode(resource,200,200,0,100,1000); //blue slow blink --> gps hold position
else if (f.GPS_HOME_MODE) patternDecode(resource,100,100,0,100,1000); //blue fast blink --> gps return to home
else turnOn(resource); //permanent blue --> gps fix ok
#else
turnOn(resource);
#endif
resource = 4;
#if defined(VBAT)
if (alarmArray[6] == 4) setTiming(resource,100,100); //red very fast blink --> low bat warning2
else if (alarmArray[6]==2) patternDecode(resource,100,100,100,100,1000); //red triple blink --> low bat warning1
else
#if defined(POWERMETER)
if (alarmArray[4]==1) patternDecode(resource,200,200,0,100,1000); //red slow blink --> powermeter warning
else turnOn(resource);
#else
turnOn(resource);
#endif
#endif
}
#endif
}