Der Editor in der gcs macht nur Text. Syntaxhighlighting u.ä. erfordert mehr Programmieraufwand. Unter Mac empfehle ich sublime für sowas.
Aber ob das nötig ist?
Schöner wäre zu wissen, in welcher Zeile, der Code abgekackt ist.
/* Beleuchtungssteuerung:
/* Steuert die Beleuchtung des Quadrocopters
/*Pinbelegung Quanton: */
/*RS232 Schnittstelle = WS2812 LEDs */
/*PWM Out 10 = LEDs
/*PWM Out 11 = Summer */
#include "system.h"
#include "flightbatterystate.h"
// Variablen Deklarieren:
short LEDupdate=1;
short TMPArmed=2;
short r=0,g=0,b=0;
int Summervar=0;
short LEDblOn=0;
Short WS2812On=0;
/* WS2812 library */
#define nLED 10
unsigned char bufLED[nLED*3];
void setLED(unsigned short n, unsigned char r, unsigned char g, unsigned char b)
{
if (n < nLED)
{
unsigned short offset = 3*n;
bufLED[offset++] = r;
bufLED[offset++] = g;
bufLED[offset++] = b;
}
}
void sendLED() {
ChangeBaud(9600);
SendBuffer(bufLED, sizeof(bufLED));
}
/* end of RGB-LED library */
/*Batteriestatus: */
FlightBatteryStateData BatteryData;
short TMPBattery=4;
void batterystatus()
{
FlightBatteryStateGet(&BatteryData);
if ((BatteryData.Voltage < 10.4) && (TMPBattery != 1))
{
TMPBattery = 1;
Summervar=2000;
}
if ((BatteryData.Voltage < 10.8) && (BatteryData.Voltage > 10.4) && (TMPBattery != 2))
{
TMPBattery = 2;
Summervar=1000;
}
if ((10.8 > BatteryData.Voltage) && (TMPBattery != 3))
{
TMPBattery = 3;
Summervar=0;
}
PWMOutSet(11,Summervar);
}
/*WS2812 LEDs schalten (Farben definieren): setLED(n,r,g,b); */
void PosLEDs()
{
int n=1
while(n<3)
{
setLED(n,255,0,0);
n=n+1;
}
while(n<5)
{
setLED(n,0,255,0);
n=n+1;
}
while(n<7)
{
setLED(n,0,0,255);
n=n+1;
}
while(n<10)
{
setLED(n,0,255,255);
n=n+1;
}
}
void PosLEDsAus()
{
int n=1
while(n<3)
{
setLED(n,0,0,0);
n=n+1;
}
while(n<5)
{
setLED(n,0,0,0);
n=n+1;
}
while(n<7)
{
setLED(n,0,0,0);
n=n+1;
}
while(n<10)
{
setLED(n,0,255,0);
n=n+1;
}
}
TestValSet(1);
TestValSet(2);
while(TestValGet() > 0)
{
batterystatus();
printf("Summerstatus: ");
printf(Summervar);
printf(" \n");
if (armed() && (TMPArmed != 1))
{
PosLEDs();
LEDblOn = 1;
TMPArmed = 1;
LEDupdate=1;
}
else if (!armed() && (TMPArmed != 0))
{
PosLEDsAus();
LEDblOn = 0;
TMPArmed = 0;
LEDupdate=1;
}
/* BlinkLEDs ein-/ausschalten */
if (LEDblOn == 1)
{
PWMOutSet(10,2000);
}
else
{
PWMOutSet(10,0);
}
if (LEDupdate == 1)
{
sendLED();
LEDupdate = 0;
}
delay(500);
}
TestValSet(99);
if (armed() && (TMPArmed != 1))
{
PosLEDs();
LEDblOn = 1;
TMPArmed = 1;
LEDupdate=1;
}
else if (!armed() && (TMPArmed != 0))
{
PosLEDsAus();
LEDblOn = 0;
TMPArmed = 0;
LEDupdate=1;
}
printf(Summervar);
int Summervar=0;
/*
int i2c_read(port,device,buffer,length);
int i2c_write(port,device,buffer,length);
*/
#include "system.h"
int test=0;
TestValSet(i2c_read(0,30,&test,1));
TestValSet(test);