Skip to content
This repository has been archived by the owner on Apr 24, 2020. It is now read-only.

Commit

Permalink
dirty bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
SAMUD committed Feb 23, 2017
1 parent 575e8f2 commit ea59b96
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 57 deletions.
89 changes: 45 additions & 44 deletions KISS_OSD/Functions_algo.ino
Original file line number Diff line number Diff line change
Expand Up @@ -268,20 +268,21 @@ void DisplayOSD()
{
OSD.setCursor(0, 0);
OSD.print(F("THROT:"));
print_int16(StickChanVals[0] / 10, TempCharConverted, 0, 1);
OSD.print(TempCharConverted);
ClearTempCharConverted();
OSD.print('%');
TempCharPosition = print_int16(StickChanVals[0] / 10, TempCharConverted, 0, 1);
TempCharConverted[TempCharPosition++] = '%';
OSD.print(TempCharConverted);
ESCmarginTop = 1;
}

if (reducedModeDisplay == 0 && Settings.DispCombCurrent1 || reducedModeDisplay == 1 && Settings.DispCombCurrent2 || reducedModeDisplay == 2 && Settings.DispCombCurrent3)
{
ClearTempCharConverted();
TempCharPosition = 2+ print_int16(current, TempCharConverted, 1, 0);
TempCharConverted[TempCharPosition++] = 'A';
TempCharConverted[TempCharPosition++] = 'T';
OSD.setCursor(-TempCharPosition, 0);
OSD.print(TempCharConverted);
OSD.print('AT');
ClearTempCharConverted();
}

if (reducedModeDisplay == 0 && Settings.DispPilotname1 || reducedModeDisplay == 1 && Settings.DispPilotname2 || reducedModeDisplay == 2 && Settings.DispPilotname3)
Expand Down Expand Up @@ -311,20 +312,20 @@ void DisplayOSD()
}
OSD.setCursor(Settings.marginLastRow, -1);
OSD.write(SYM_MAIN_BATT);
ClearTempCharConverted();
print_int16(LipoVoltage, TempCharConverted, 2, 1);
OSD.print(TempCharConverted);
ClearTempCharConverted();
OSD.noBlink();
ESCmarginBot = 1;
}

if (reducedModeDisplay == 0 && Settings.DispTimer1 || reducedModeDisplay == 1 && Settings.DispTimer2 || reducedModeDisplay == 2 && Settings.DispTimer3)
{
OSD.setCursor(12, -1);
ClearTempCharConverted();
print_time(time, TempCharConverted);
OSD.write(SYM_FLY_M);
OSD.print(TempCharConverted);
ClearTempCharConverted();
}

if (reducedModeDisplay == 0 && Settings.DispMaConsumption1 || reducedModeDisplay == 1 && Settings.DispMaConsumption2 || reducedModeDisplay == 2 && Settings.DispMaConsumption3)
Expand All @@ -340,11 +341,15 @@ void DisplayOSD()
OSD.print(F(" CAPACITY "));
}
}
ClearTempCharConverted();
for (uint8_t i = 0; i < 32; i++)
{
TempCharConverted[i] = ' ';
}
TempCharPosition = print_int16(LipoMAH, TempCharConverted, 0, 1);
OSD.setCursor(-(TempCharPosition + 1 + Settings.marginLastRow), -1);
OSD.write(SYM_MAH);
OSD.print(TempCharConverted);
ClearTempCharConverted();
OSD.noBlink();
ESCmarginBot = 1;
}
Expand All @@ -353,31 +358,27 @@ void DisplayOSD()
{

//print motor 1
ClearTempCharConverted();
TempCharPosition = 2 + print_int16(motorKERPM[0], TempCharConverted, 1, 1);
OSD.setCursor(0, ESCmarginTop);
OSD.print(TempCharConverted);
OSD.print('KR');
ClearTempCharConverted();

//print motor 2
ClearTempCharConverted();
TempCharPosition = 2 + print_int16(motorKERPM[1], TempCharConverted, 1, 1);
OSD.setCursor(-TempCharPosition, ESCmarginTop);
OSD.print(TempCharConverted);
OSD.print('KR');

//print motor 4
ClearTempCharConverted();
TempCharPosition = 2 + print_int16(motorKERPM[3], TempCharConverted, 1, 1);
OSD.setCursor(0, -(1 + ESCmarginBot));
OSD.print(TempCharConverted);

//print motor 3
TempCharPosition = 2 + print_int16(motorKERPM[2], TempCharConverted, 1, 1);
OSD.setCursor(-TempCharPosition, -(1 + ESCmarginBot));
OSD.print(TempCharConverted);
OSD.print('KR');
ClearTempCharConverted();

//print motor 4
TempCharPosition = 2 + print_int16(motorKERPM[3], TempCharConverted, 1, 1);
OSD.setCursor(0, -(1 + ESCmarginBot));
OSD.print(TempCharConverted);
OSD.print('KR');
ClearTempCharConverted();

TMPmargin++;
Expand All @@ -387,65 +388,65 @@ void DisplayOSD()
if (reducedModeDisplay == 0 && Settings.DispEscCurrent1 || reducedModeDisplay == 1 && Settings.DispEscCurrent2 || reducedModeDisplay == 2 && Settings.DispEscCurrent3)
{
//current 1
ClearTempCharConverted();
TempCharPosition = 1 + print_int16(motorCurrent[0], TempCharConverted, 2, 1);
TempCharConverted[TempCharPosition++] = 'A';
OSD.setCursor(0, CurrentMargin + ESCmarginTop);
OSD.print(TempCharConverted);
OSD.print('A');
ClearTempCharConverted();

//current 2
ClearTempCharConverted();
TempCharPosition = 1 + print_int16(motorCurrent[1], TempCharConverted, 2, 1);
TempCharConverted[TempCharPosition++] = 'A';
OSD.setCursor(-TempCharPosition, CurrentMargin + ESCmarginTop);
OSD.print(TempCharConverted);
OSD.print('A');
ClearTempCharConverted();

//current3
TempCharPosition = 1 + print_int16(motorCurrent[2], TempCharConverted, 2, 1);
OSD.setCursor(-TempCharPosition, -(1 + CurrentMargin + ESCmarginBot));
OSD.print(TempCharConverted);
OSD.print('A');
ClearTempCharConverted();

//current4
ClearTempCharConverted();
TempCharPosition = 1 + print_int16(motorCurrent[3], TempCharConverted, 2, 1);
TempCharConverted[TempCharPosition++] = 'A';
OSD.setCursor(0, -(1 + CurrentMargin + ESCmarginBot));
OSD.print(TempCharConverted);
OSD.print('A');

//current3
ClearTempCharConverted();
TempCharPosition = 1 + print_int16(motorCurrent[2], TempCharConverted, 2, 1);
TempCharConverted[TempCharPosition++] = 'A';
OSD.setCursor(-TempCharPosition, -(1 + CurrentMargin + ESCmarginBot));
OSD.print(TempCharConverted);

TMPmargin++;
}

if (reducedModeDisplay == 0 && Settings.DispEscTemp1 || reducedModeDisplay == 1 && Settings.DispEscTemp2 || reducedModeDisplay == 2 && Settings.DispEscTemp3)
{
//temp1
ClearTempCharConverted();
TempCharPosition = 1 + print_int16(ESCTemps[0], TempCharConverted, 0, 1);
TempCharConverted[TempCharPosition++] = '°';
OSD.setCursor(0, TMPmargin + ESCmarginTop);
OSD.print(TempCharConverted);
OSD.print('°');
ClearTempCharConverted();

//temp2
ClearTempCharConverted();
TempCharPosition = 1 + print_int16(ESCTemps[1], TempCharConverted, 0, 1);
TempCharConverted[TempCharPosition++] = '°';
OSD.setCursor(-TempCharPosition - 1, TMPmargin + ESCmarginTop);
OSD.print(TempCharConverted);
OSD.print('°');

//temp4
ClearTempCharConverted();
TempCharPosition = 1 + print_int16(ESCTemps[3], TempCharConverted, 0, 1);
TempCharConverted[TempCharPosition++] = '°';
OSD.setCursor(0, -(1 + TMPmargin + ESCmarginBot));
OSD.print(TempCharConverted);

//temp3
TempCharPosition = 1 + print_int16(ESCTemps[2], TempCharConverted, 0, 1);
OSD.setCursor(-TempCharPosition - 1, -(1 + TMPmargin + ESCmarginBot));
OSD.print(TempCharConverted);
OSD.print('°');
ClearTempCharConverted();

//temp4
TempCharPosition = 1 + print_int16(ESCTemps[2], TempCharConverted, 0, 1);
OSD.setCursor(0, -(1 + TMPmargin + ESCmarginBot));
TempCharConverted[TempCharPosition++] = '°';
OSD.setCursor(-TempCharPosition - 1, -(1 + TMPmargin + ESCmarginBot));
OSD.print(TempCharConverted);
OSD.print('°');
ClearTempCharConverted();

}

Expand Down Expand Up @@ -649,7 +650,7 @@ void OSDmakegrey() {

void ClearTempCharConverted()
{
for (uint8_t i; i < 8; i++)
for (uint8_t i=0; i < 32; i++)
{
TempCharConverted[i] = ' ';
}
Expand Down
2 changes: 1 addition & 1 deletion KISS_OSD/GlobalVar.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ static uint8_t lastMode = 0;


static uint8_t TempCharPosition;
static char TempCharConverted[8];
static char TempCharConverted[32];

static char Time[10];

Expand Down
16 changes: 4 additions & 12 deletions KISS_OSD/KISS_OSD.ino
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ KISS FC OSD
by Samuel Daurat ([email protected])
based on the code by Felix Niessen ([email protected])
*/
# define OSDVersion "5.3.4"
# define OSDVersion "5.4"
#define DMemoryVersion 6
/*
*****************************************************************************************************
Expand Down Expand Up @@ -75,15 +75,10 @@ const char Pilotname[] = " SAMU";
//SETUP function
void setup() {

pinMode(13, OUTPUT);

//turn on watchdog timer
wdt_enable(WDTO_8S);
wdt_reset();




SPI.begin();
SPI.setClockDivider(SPI_CLOCK_DIV2);

Expand Down Expand Up @@ -129,18 +124,15 @@ void setup() {
OSD.print(F("SAMUD OSD"));
OSD.setCursor(6, 3);
OSD.print(F("CUSTOM KISS OSD"));
OSD.setCursor(3, 5);
OSD.print(F("WAITING FOR KISS FC... "));
OSD.setCursor(5, 9);
OSD.print(F("ENJOY YOUR FLIGHT"));
OSD.setCursor(3, 14);
OSD.print(F("WAITING FOR KISS FC... "));
OSD.videoBackground();
for (int i = 0; i < 10; i++)
{
wdt_reset();
digitalWrite(13, HIGH);
delay(500);
digitalWrite(13, LOW);
delay(500);
delay(1000);
}
OSD.clear();

Expand Down

0 comments on commit ea59b96

Please sign in to comment.