Bsongis/move everything (#3669)

* Directories moved

* Directories moved

* Directories moved

* Directories moved

* Directories moved

* rename horus directories in gui to 480x272

* Directories moved

* Rename taranis to 212x64

* Directories moved - TARANIS target removed, it's now X9E / X9D+ / X9D

* Directories moved - TARANIS target removed, it's now X9E / X9D+ / X9D

* Directories moved - TARANIS target removed, it's now X9E / X9D+ / X9D

* Directories moved - TARANIS target removed, it's now X9E / X9D+ / X9D

* Directories moved - TARANIS target removed, it's now X9E / X9D+ / X9D

* Directories moved - TARANIS target removed, it's now X9E / X9D+ / X9D

* Directories moved - TARANIS target removed, it's now X9E / X9D+ / X9D

* Fix x9e compile

* Directories moved - TARANIS target removed, it's now X9E / X9D+ / X9D

* Directories moved - TARANIS target removed, it's now X9E / X9D+ / X9D

* Directories moved - TARANIS target removed, it's now X9E / X9D+ / X9D

* Directories moved - TARANIS target removed, it's now X9E / X9D+ / X9D

* Directories moved - TARANIS target removed, it's now X9E / X9D+ / X9D

* Minor improvement of path handling

* Another bunch of files renamed :)

* Another bunch of files renamed :)

* Another bunch of files renamed :)

* Another bunch of files renamed :)

* Another bunch of files renamed :)

* Rename 9x to 128x64

* Compilation fixes

* Compilation fixes

* Compilation fixes

* Compilation fixes

* Compilation fixes

* Compilation fixes
This commit is contained in:
Bertrand Songis
2016-07-29 12:47:20 +02:00
committed by GitHub
parent e3e0d970a5
commit 83cdd67e6a
340 changed files with 3035 additions and 5126 deletions
+134
View File
@@ -0,0 +1,134 @@
/*
* Copyright (C) OpenTX
*
* Based on code named
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "opentx.h"
#define XPOT_DELTA 10
#define XPOT_DELAY 10 /* cycles */
enum CalibrationState {
CALIB_START = 0,
CALIB_SET_MIDPOINT,
CALIB_MOVE_STICKS,
CALIB_STORE,
CALIB_FINISHED
};
void menuCommonCalib(uint8_t event)
{
for (uint8_t i=0; i<NUM_STICKS+NUM_POTS; i++) { // get low and high vals for sticks and trims
int16_t vt = anaIn(i);
reusableBuffer.calib.loVals[i] = min(vt, reusableBuffer.calib.loVals[i]);
reusableBuffer.calib.hiVals[i] = max(vt, reusableBuffer.calib.hiVals[i]);
if (i >= POT1 && i <= POT_LAST) {
if (IS_POT_WITHOUT_DETENT(i)) {
reusableBuffer.calib.midVals[i] = (reusableBuffer.calib.hiVals[i] + reusableBuffer.calib.loVals[i]) / 2;
}
}
}
calibrationState = reusableBuffer.calib.state; // make sure we don't scroll while calibrating
switch (event)
{
case EVT_ENTRY:
reusableBuffer.calib.state = CALIB_START;
break;
case EVT_KEY_BREAK(KEY_ENTER):
reusableBuffer.calib.state++;
break;
}
switch (reusableBuffer.calib.state) {
case CALIB_START:
// START CALIBRATION
if (!READ_ONLY()) {
lcd_putsLeft(MENU_HEADER_HEIGHT+2*FH, STR_MENUTOSTART);
}
break;
case CALIB_SET_MIDPOINT:
// SET MIDPOINT
lcdDrawText(0*FW, MENU_HEADER_HEIGHT+FH, STR_SETMIDPOINT, INVERS);
lcd_putsLeft(MENU_HEADER_HEIGHT+2*FH, STR_MENUWHENDONE);
for (uint8_t i=0; i<NUM_STICKS+NUM_POTS; i++) {
reusableBuffer.calib.loVals[i] = 15000;
reusableBuffer.calib.hiVals[i] = -15000;
reusableBuffer.calib.midVals[i] = anaIn(i);
}
break;
case CALIB_MOVE_STICKS:
// MOVE STICKS/POTS
STICK_SCROLL_DISABLE();
lcdDrawText(0*FW, MENU_HEADER_HEIGHT+FH, STR_MOVESTICKSPOTS, INVERS);
lcd_putsLeft(MENU_HEADER_HEIGHT+2*FH, STR_MENUWHENDONE);
for (uint8_t i=0; i<NUM_STICKS+NUM_POTS; i++) {
if (abs(reusableBuffer.calib.loVals[i]-reusableBuffer.calib.hiVals[i]) > 50) {
g_eeGeneral.calib[i].mid = reusableBuffer.calib.midVals[i];
int16_t v = reusableBuffer.calib.midVals[i] - reusableBuffer.calib.loVals[i];
g_eeGeneral.calib[i].spanNeg = v - v/STICK_TOLERANCE;
v = reusableBuffer.calib.hiVals[i] - reusableBuffer.calib.midVals[i];
g_eeGeneral.calib[i].spanPos = v - v/STICK_TOLERANCE;
}
}
break;
case CALIB_STORE:
g_eeGeneral.chkSum = evalChkSum();
storageDirty(EE_GENERAL);
reusableBuffer.calib.state = CALIB_FINISHED;
break;
default:
reusableBuffer.calib.state = CALIB_START;
break;
}
doMainScreenGraphics();
}
void menuGeneralCalib(uint8_t event)
{
check_simple(event, e_Calib, menuTabGeneral, DIM(menuTabGeneral), 0);
if (menuEvent) {
calibrationState = CALIB_START;
}
TITLE(STR_MENUCALIBRATION);
menuCommonCalib(READ_ONLY() ? 0 : event);
}
void menuFirstCalib(uint8_t event)
{
if (event == EVT_KEY_BREAK(KEY_EXIT) || reusableBuffer.calib.state == CALIB_FINISHED) {
calibrationState = CALIB_START;
chainMenu(menuMainView);
}
else {
lcd_putsCenter(0*FH, MENUCALIBRATION);
lcdInvertLine(0);
menuCommonCalib(event);
}
}