1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-18 05:45:21 +03:00

Merge branch 'master' into kilrah/ar9x

This commit is contained in:
Andre Bernet 2015-09-06 14:47:26 +02:00
commit 45801a89ea
160 changed files with 20171 additions and 19093 deletions

View file

@ -1,3 +0,0 @@
<a href="http://3drobotics.com">3D Robotics</a>
They sell the Iris+ with a modified version of OpenTX which doesn't fullfil the GPL requirements.
No donations, no thanks, we are just free staff for them...

View file

@ -8,6 +8,7 @@
<a href="http://litepilots.com">LitePilots</a>
<a href="http://openpilot.com">David Ankers (OpenPilot)</a>
<a href="http://3drobotics.com">3D Robotics</a>
<a href="http://rcstudio.cz">RC Studio (monthly)</a>
Mario Sette
Felice Baratto
@ -401,7 +402,6 @@ Colin Rycroft
Emanuel Stassar
Michael Gregory
Robert Russell
Gordon Stahl
Felix Kaiser
Joshua Bardwell
Davd Goodall
@ -599,7 +599,6 @@ Julien Gérard
Alexandre d'Alton
Peter Mergaerts
Jan Houwers
Gordon Stahl
Christian Grandjean
Roger Bergevin
NorthSide
@ -802,4 +801,12 @@ Roger Keatley
Sherman Lovell
Hugh Caldwell
JB Fisher Company
Michels Bernhard
Pietro Rossin
Carsten Wache
Brock White
Steven Poretz
David Huelster
Gordon Stahl (monthly)
John Mathison
Richard Duczmal

View file

@ -1,5 +1,5 @@
##OpenTX 2.1 Branch
The ongoing development is not done in this branch. It is performed in the branch called next.
The ongoing development on 2.1.x is done in this branch.
Refer to the opentx.wiki for information about setting up the tool chains for building OpenTX and OpenTX Companion as well as other development related issues.

View file

@ -1,4 +1,5 @@
<h2>Version 2.1.2 / <set date></h2>
<ul>
<li>Fixed: Lua model scripts outputs not working in a simulator (<a href=https://github.com/opentx/opentx/issues/2684>#2684</a>)</li>
<li>Fixed a problem of Companion 2.1 trying to install into 2.0 path.
@ -6,6 +7,10 @@
(<a href=https://github.com/opentx/opentx/issues/2645>#2645</a>)</li>
<li>Added missing SDL libraries to MAC package (<a href=https://github.com/opentx/opentx/issues/2678>#2678</a>)</li>
<li>Added used channels check/warning in Wizard (<a href=https://github.com/opentx/opentx/issues/2091>#2091</a>)</li>
<li>Model Print and Model Compare improvements and fixes (<a href=https://github.com/opentx/opentx/issues/2734>#2734</a>, <a href=https://github.com/opentx/opentx/issues/2737>#2737</a>, <a href=https://github.com/opentx/opentx/issues/2576>#2576</a>)</li>
<li>Negative telemetry offset value was reset when writing back to radio (<a href=https://github.com/opentx/opentx/issues/2738>#2738</a>)</li>
<li>Telemetry sensor names were not displayed (<a href=https://github.com/opentx/opentx/issues/2807>#2807</a>)</li>
<li>Mixes multiplex representation now the same as on the radio (<a href=https://github.com/opentx/opentx/issues/2808>#2808</a>)</li>
</ul>

View file

@ -6,7 +6,7 @@ SET(C9X_VERSION_REVISION "2")
SET(C9X_VERSION_SUFFIX $ENV{OPENTX_VERSION_SUFFIX})
SET(C9X_VERSION ${C9X_VERSION_MAJOR}.${C9X_VERSION_MINOR}.${C9X_VERSION_REVISION}${C9X_VERSION_SUFFIX})
MESSAGE(STATUS OpenTX Companion ${C9X_VERSION})
MESSAGE(STATUS "OpenTX Companion ${C9X_VERSION}")
CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )

View file

@ -312,10 +312,10 @@ QString Profile::speaker() const { return _speaker; }
QString Profile::stickPotCalib() const { return _stickPotCalib; }
QString Profile::timeStamp() const { return _timeStamp; }
QString Profile::trainerCalib() const { return _trainerCalib; }
int Profile::currentCalib() const { return _currentCalib; }
int Profile::txCurrentCalibration() const { return _txCurrentCalibration; }
int Profile::gsStickMode() const { return _gsStickMode; }
int Profile::ppmMultiplier() const { return _ppmMultiplier; }
int Profile::vBatCalib() const { return _vBatCalib; }
int Profile::txVoltageCalibration() const { return _txVoltageCalibration; }
int Profile::vBatWarn() const { return _vBatWarn; }
int Profile::vBatMin() const { return _vBatMin; }
int Profile::vBatMax() const { return _vBatMax; }
@ -342,10 +342,10 @@ void Profile::speaker (const QString x) { store(x, _speaker, "Speake
void Profile::stickPotCalib (const QString x) { store(x, _stickPotCalib, "StickPotCalib" ,"Profiles", QString("profile%1").arg(index));}
void Profile::timeStamp (const QString x) { store(x, _timeStamp, "TimeStamp" ,"Profiles", QString("profile%1").arg(index));}
void Profile::trainerCalib (const QString x) { store(x, _trainerCalib, "TrainerCalib" ,"Profiles", QString("profile%1").arg(index));}
void Profile::currentCalib (const int x) { store(x, _currentCalib, "currentCalib" ,"Profiles", QString("profile%1").arg(index));}
void Profile::txCurrentCalibration (const int x) { store(x, _txCurrentCalibration, "currentCalib","Profiles", QString("profile%1").arg(index));}
void Profile::gsStickMode (const int x) { store(x, _gsStickMode, "GSStickMode" ,"Profiles", QString("profile%1").arg(index));}
void Profile::ppmMultiplier (const int x) { store(x, _ppmMultiplier, "PPM_Multiplier" ,"Profiles", QString("profile%1").arg(index));}
void Profile::vBatCalib (const int x) { store(x, _vBatCalib, "VbatCalib" ,"Profiles", QString("profile%1").arg(index));}
void Profile::txVoltageCalibration (const int x) { store(x, _txVoltageCalibration, "VbatCalib","Profiles", QString("profile%1").arg(index));}
void Profile::vBatWarn (const int x) { store(x, _vBatWarn, "vBatWarn" ,"Profiles", QString("profile%1").arg(index));}
void Profile::vBatMin (const int x) { store(x, _vBatMin, "VbatMin" ,"Profiles", QString("profile%1").arg(index));}
void Profile::vBatMax (const int x) { store(x, _vBatMax, "VbatMax" ,"Profiles", QString("profile%1").arg(index));}
@ -378,10 +378,10 @@ Profile& Profile::operator=(const Profile& rhs)
speaker ( rhs.speaker() );
stickPotCalib( rhs.stickPotCalib() );
trainerCalib ( rhs.trainerCalib() );
currentCalib ( rhs.currentCalib() );
txCurrentCalibration ( rhs.txCurrentCalibration() );
gsStickMode ( rhs.gsStickMode() );
ppmMultiplier( rhs.ppmMultiplier() );
vBatCalib ( rhs.vBatCalib() );
txVoltageCalibration ( rhs.txVoltageCalibration() );
vBatWarn ( rhs.vBatWarn() );
vBatMin ( rhs.vBatMin() );
vBatMax ( rhs.vBatMax() );
@ -424,10 +424,10 @@ void Profile::initFwVariables()
_timeStamp = "";
_trainerCalib = "";
_currentCalib = 0;
_txCurrentCalibration = 0;
_gsStickMode = 0;
_ppmMultiplier = 0;
_vBatCalib = 0;
_txVoltageCalibration = 0;
_vBatWarn = 0;
_vBatMin = 0;
_vBatMax = 0;
@ -483,10 +483,10 @@ void Profile::flush()
getset( _stickPotCalib, "StickPotCalib" ,"" ,"Profiles", QString("profile%1").arg(index));
getset( _timeStamp, "TimeStamp" ,"" ,"Profiles", QString("profile%1").arg(index));
getset( _trainerCalib, "TrainerCalib" ,"" ,"Profiles", QString("profile%1").arg(index));
getset( _currentCalib, "currentCalib" ,0 ,"Profiles", QString("profile%1").arg(index));
getset( _txCurrentCalibration, "currentCalib" ,0 ,"Profiles", QString("profile%1").arg(index));
getset( _gsStickMode, "GSStickMode" ,0 ,"Profiles", QString("profile%1").arg(index));
getset( _ppmMultiplier, "PPM_Multiplier" ,0 ,"Profiles", QString("profile%1").arg(index));
getset( _vBatCalib, "VbatCalib" ,0 ,"Profiles", QString("profile%1").arg(index));
getset( _txVoltageCalibration, "VbatCalib" ,0 ,"Profiles", QString("profile%1").arg(index));
getset( _vBatWarn, "vBatWarn" ,0 ,"Profiles", QString("profile%1").arg(index));
getset( _vBatMin, "VbatMin" ,0 ,"Profiles", QString("profile%1").arg(index));
getset( _vBatMax, "VbatMax" ,0 ,"Profiles", QString("profile%1").arg(index));

View file

@ -125,10 +125,10 @@ class Profile: protected CompStoreObj
QString _stickPotCalib;
QString _timeStamp;
QString _trainerCalib;
int _currentCalib;
int _txCurrentCalibration;
int _gsStickMode;
int _ppmMultiplier;
int _vBatCalib;
int _txVoltageCalibration;
int _vBatWarn;
int _vBatMin;
int _vBatMax;
@ -156,10 +156,10 @@ class Profile: protected CompStoreObj
QString stickPotCalib() const;
QString timeStamp() const;
QString trainerCalib() const;
int currentCalib() const;
int txCurrentCalibration() const;
int gsStickMode() const;
int ppmMultiplier() const;
int vBatCalib() const;
int txVoltageCalibration() const;
int vBatWarn() const;
int vBatMin() const;
int vBatMax() const;
@ -186,10 +186,10 @@ class Profile: protected CompStoreObj
void stickPotCalib (const QString);
void timeStamp (const QString);
void trainerCalib (const QString);
void currentCalib (const int);
void txCurrentCalibration (const int);
void gsStickMode (const int);
void ppmMultiplier (const int);
void vBatCalib (const int);
void txVoltageCalibration (const int);
void vBatWarn (const int);
void vBatMin (const int);
void vBatMax (const int);

View file

@ -4,7 +4,6 @@
<file>icon.png</file>
<file>../../CREDITS.txt</file>
<file>../../DONATIONS.txt</file>
<file>../../BLACKLIST.txt</file>
<file>../releasenotes.txt</file>
<file>images/9xdb.png</file>
<file>images/9xdl.png</file>

View file

@ -63,12 +63,15 @@ ContributorsDialog::ContributorsDialog(QWidget * parent):
" <tr><td class=\"normal\">" + tr("Honors go to Rafal Tomczak (RadioClone), Thomas Husterer (th9x) and Erez Raviv (er9x and eePe)") + "<br/></td></tr>" \
"</table>");
#if 0
QFile blacklist(":/BLACKLIST.txt");
if (blacklist.open(QIODevice::ReadOnly | QIODevice::Text)) {
QStringList names;
names << blacklist.readAll();
str.append(formatTable(tr("OpenTX Blacklist"), names, 1));
}
#endif
str.append("</body></html>");
ui->textEditor->setHtml(str);
ui->textEditor->scroll(0, 0);

View file

@ -897,7 +897,7 @@ QString CustomFunctionData::paramToString(const ModelData * model) const
}
else if ((func==FuncVolume)|| (func==FuncPlayValue)) {
RawSource item(param);
return item.toString();
return item.toString(model);
}
else if ((func==FuncPlayPrompt) || (func==FuncPlayBoth)) {
if ( GetCurrentFirmware()->getCapability(VoicesAsNumbers)) {
@ -1083,8 +1083,8 @@ GeneralSettings::GeneralSettings()
}
else {
QString t_trainercalib=g.profile[g.id()].trainerCalib();
int8_t t_vBatCalib=(int8_t)g.profile[g.id()].vBatCalib();
int8_t t_currentCalib=(int8_t)g.profile[g.id()].currentCalib();
int8_t t_txVoltageCalibration=(int8_t)g.profile[g.id()].txVoltageCalibration();
int8_t t_txCurrentCalibration=(int8_t)g.profile[g.id()].txCurrentCalibration();
int8_t t_PPM_Multiplier=(int8_t)g.profile[g.id()].ppmMultiplier();
uint8_t t_stickMode=(uint8_t)g.profile[g.id()].gsStickMode();
uint8_t t_vBatWarn=(uint8_t)g.profile[g.id()].vBatWarn();
@ -1118,8 +1118,8 @@ GeneralSettings::GeneralSettings()
if (ok)
trainer.calib[i]=byte16;
}
currentCalib=t_currentCalib;
vBatCalib=t_vBatCalib;
txCurrentCalibration=t_txCurrentCalibration;
txVoltageCalibration=t_txVoltageCalibration;
vBatWarn=t_vBatWarn;
PPM_Multiplier=t_PPM_Multiplier;
stickMode = t_stickMode;
@ -1383,16 +1383,16 @@ void ModelData::clear()
moduleData[2].ppmDelay = 300;
int board = GetEepromInterface()->getBoard();
if (IS_TARANIS(board)) {
moduleData[0].protocol=PXX_XJT_X16;
moduleData[1].protocol=OFF;
moduleData[0].protocol = PULSES_PXX_XJT_X16;
moduleData[1].protocol = PULSES_OFF;
}
else if (IS_SKY9X(board)) {
moduleData[0].protocol=PPM;
moduleData[1].protocol=PPM;
moduleData[0].protocol = PULSES_PPM;
moduleData[1].protocol = PULSES_PPM;
}
else {
moduleData[0].protocol=PPM;
moduleData[1].protocol=OFF;
moduleData[0].protocol = PULSES_PPM;
moduleData[1].protocol = PULSES_OFF;
}
for (int i=0; i<C9X_MAX_FLIGHT_MODES; i++) {
flightModeData[i].clear();

View file

@ -815,31 +815,31 @@ class TimerData {
void clear() { memset(this, 0, sizeof(TimerData)); mode = RawSwitch(SWITCH_TYPE_TIMER_MODE, 0); }
};
enum Protocol {
OFF,
PPM,
SILV_A,
SILV_B,
SILV_C,
CTP1009,
LP45,
DSM2,
DSMX,
PPM16,
PPMSIM,
PXX_XJT_X16,
PXX_XJT_D8,
PXX_XJT_LR12,
PXX_DJT,
PROTO_LAST
enum PulsesProtocol {
PULSES_OFF,
PULSES_PPM,
PULSES_SILV_A,
PULSES_SILV_B,
PULSES_SILV_C,
PULSES_CTP1009,
PULSES_LP45,
PULSES_DSM2,
PULSES_DSMX,
PULSES_PPM16,
PULSES_PPMSIM,
PULSES_PXX_XJT_X16,
PULSES_PXX_XJT_D8,
PULSES_PXX_XJT_LR12,
PULSES_PXX_DJT,
PULSES_PROTOCOL_LAST
};
enum TrainerProtocol {
MASTER_JACK,
SLAVE_JACK,
MASTER_SBUS_MODULE,
MASTER_CPPM_MODULE,
MASTER_SBUS_BATT_COMPARTMENT
TRAINER_MASTER_JACK,
TRAINER_SLAVE_JACK,
TRAINER_MASTER_SBUS_MODULE,
TRAINER_MASTER_CPPM_MODULE,
TRAINER_MASTER_SBUS_BATT_COMPARTMENT
};
class ModuleData {
@ -1139,7 +1139,8 @@ class GeneralSettings {
unsigned int currModel; // 0..15
unsigned int contrast;
unsigned int vBatWarn;
int vBatCalib;
int txVoltageCalibration;
int txCurrentCalibration;
int vBatMin;
int vBatMax;
int backlightMode;
@ -1187,7 +1188,6 @@ class GeneralSettings {
int speakerVolume;
unsigned int backlightBright;
int switchesDelay;
int currentCalib;
int temperatureCalib;
int temperatureWarn;
unsigned int mAhWarn;
@ -1318,7 +1318,7 @@ enum Capability {
PPMCenter,
PPMUnitMicroseconds,
SYMLimits,
HasCurrentCalibration,
HastxCurrentCalibration,
HasVolume,
HasBrightness,
PerModelTimers,
@ -1378,7 +1378,7 @@ class EEPROMInterface
virtual int getSize(const GeneralSettings &) = 0;
virtual int isAvailable(Protocol proto, int port=0) = 0;
virtual int isAvailable(PulsesProtocol proto, int port=0) = 0;
virtual const int getEEpromSize() = 0;

View file

@ -70,7 +70,7 @@ Er9xGeneral::operator GeneralSettings ()
result.currModel = currModel;
result.contrast = contrast;
result.vBatWarn = vBatWarn;
result.vBatCalib = vBatCalib;
result.txVoltageCalibration = txVoltageCalibration;
result.trainer = trainer;
result.blightinv=blightinv;
result.stickScroll=stickScroll;
@ -361,16 +361,16 @@ t_Er9xModelData::operator ModelData ()
c9x.timers[0].val = tmrVal;
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 2:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
case 3:
c9x.moduleData[0].protocol = PPM16;
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].ppmFrameLength=ppmFrameLength;

View file

@ -61,7 +61,7 @@ PACK(typedef struct t_Er9xGeneral {
uint8_t currModel; //0..15
uint8_t contrast;
uint8_t vBatWarn;
int8_t vBatCalib;
int8_t txVoltageCalibration;
int8_t lightSw;
Er9xTrainerData trainer;
uint8_t view;

View file

@ -200,13 +200,13 @@ int Er9xInterface::getSize(const GeneralSettings &settings)
return 0;
}
int Er9xInterface::isAvailable(Protocol prot, int port)
int Er9xInterface::isAvailable(PulsesProtocol prot, int port)
{
switch (prot) {
case PPM:
case DSM2:
case PXX_DJT:
case PPM16:
case PULSES_PPM:
case PULSES_DSM2:
case PULSES_PXX_DJT:
case PULSES_PPM16:
return 1;
default:
return 0;

View file

@ -46,7 +46,7 @@ class Er9xInterface : public EEPROMInterface
virtual int getSize(const GeneralSettings &settings);
virtual int isAvailable(Protocol proto, int port=0);
virtual int isAvailable(PulsesProtocol proto, int port=0);
protected:

View file

@ -82,7 +82,7 @@ Ersky9xGeneral::operator GeneralSettings ()
result.currModel = currModel;
result.contrast = contrast;
result.vBatWarn = vBatWarn;
result.vBatCalib = vBatCalib;
result.txVoltageCalibration = txVoltageCalibration;
result.backlightMode = 0;
if (lightSw == 22) {
@ -135,7 +135,7 @@ Ersky9xGeneral::operator GeneralSettings ()
result.switchWarningStates = switchWarningStates;
result.speakerVolume = volume;
result.backlightBright = bright ;
result.currentCalib = current_calib;
result.txCurrentCalibration = current_calib;
return result;
}
@ -493,16 +493,16 @@ t_Ersky9xModelData_v10::operator ModelData ()
}
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 2:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
case 3:
c9x.moduleData[0].protocol = PPM16;
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].ppmFrameLength=ppmFrameLength;
@ -608,16 +608,16 @@ t_Ersky9xModelData_v11::operator ModelData ()
}
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 2:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
case 3:
c9x.moduleData[0].protocol = PPM16;
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].ppmFrameLength=ppmFrameLength;

View file

@ -69,7 +69,7 @@ PACK(typedef struct t_Ersky9xGeneral {
uint8_t currModel; //0..15
uint8_t contrast;
uint8_t vBatWarn;
int8_t vBatCalib;
int8_t txVoltageCalibration;
int8_t lightSw;
Ersky9xTrainerData trainer;
uint8_t view;

View file

@ -244,13 +244,13 @@ int Ersky9xInterface::getSize(const GeneralSettings & settings)
return 0;
}
int Ersky9xInterface::isAvailable(Protocol prot, int port)
int Ersky9xInterface::isAvailable(PulsesProtocol prot, int port)
{
switch (prot) {
case PPM:
case DSM2:
case PXX_DJT:
case PPM16:
case PULSES_PPM:
case PULSES_DSM2:
case PULSES_PXX_DJT:
case PULSES_PPM16:
return 1;
default:
return 0;

View file

@ -46,7 +46,7 @@ class Ersky9xInterface : public EEPROMInterface
virtual int getSize(const GeneralSettings & settings);
virtual int isAvailable(Protocol proto, int port=0);
virtual int isAvailable(PulsesProtocol proto, int port=0);
protected:

View file

@ -70,7 +70,7 @@ Gruvin9xGeneral_v103::operator GeneralSettings ()
result.currModel = currModel;
result.contrast = contrast;
result.vBatWarn = vBatWarn;
result.vBatCalib = vBatCalib;
result.txVoltageCalibration = txVoltageCalibration;
result.backlightMode = 0;
if (lightSw == 22) {
@ -127,7 +127,7 @@ Gruvin9xGeneral_v104::operator GeneralSettings ()
result.currModel = currModel;
result.contrast = contrast;
result.vBatWarn = vBatWarn;
result.vBatCalib = vBatCalib;
result.txVoltageCalibration = txVoltageCalibration;
result.backlightMode = 0;
if (lightSw == 22) {
@ -423,25 +423,25 @@ t_Gruvin9xModelData_v102::operator ModelData ()
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 2:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
case 3:
c9x.moduleData[0].protocol = SILV_A;
c9x.moduleData[0].protocol = PULSES_SILV_A;
break;
case 4:
c9x.moduleData[0].protocol = SILV_B;
c9x.moduleData[0].protocol = PULSES_SILV_B;
break;
case 5:
c9x.moduleData[0].protocol = SILV_C;
c9x.moduleData[0].protocol = PULSES_SILV_C;
break;
case 6:
c9x.moduleData[0].protocol = CTP1009;
c9x.moduleData[0].protocol = PULSES_CTP1009;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@ -493,25 +493,25 @@ t_Gruvin9xModelData_v103::operator ModelData ()
c9x.timers[1] = timer2;
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 2:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
case 3:
c9x.moduleData[0].protocol = SILV_A;
c9x.moduleData[0].protocol = PULSES_SILV_A;
break;
case 4:
c9x.moduleData[0].protocol = SILV_B;
c9x.moduleData[0].protocol = PULSES_SILV_B;
break;
case 5:
c9x.moduleData[0].protocol = SILV_C;
c9x.moduleData[0].protocol = PULSES_SILV_C;
break;
case 6:
c9x.moduleData[0].protocol = CTP1009;
c9x.moduleData[0].protocol = PULSES_CTP1009;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@ -563,25 +563,25 @@ t_Gruvin9xModelData_v105::operator ModelData ()
c9x.timers[1] = timer2;
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 2:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
case 3:
c9x.moduleData[0].protocol = SILV_A;
c9x.moduleData[0].protocol = PULSES_SILV_A;
break;
case 4:
c9x.moduleData[0].protocol = SILV_B;
c9x.moduleData[0].protocol = PULSES_SILV_B;
break;
case 5:
c9x.moduleData[0].protocol = SILV_C;
c9x.moduleData[0].protocol = PULSES_SILV_C;
break;
case 6:
c9x.moduleData[0].protocol = CTP1009;
c9x.moduleData[0].protocol = PULSES_CTP1009;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@ -653,25 +653,25 @@ t_Gruvin9xModelData_v106::operator ModelData ()
c9x.timers[1] = timer2;
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 2:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
case 3:
c9x.moduleData[0].protocol = SILV_A;
c9x.moduleData[0].protocol = PULSES_SILV_A;
break;
case 4:
c9x.moduleData[0].protocol = SILV_B;
c9x.moduleData[0].protocol = PULSES_SILV_B;
break;
case 5:
c9x.moduleData[0].protocol = SILV_C;
c9x.moduleData[0].protocol = PULSES_SILV_C;
break;
case 6:
c9x.moduleData[0].protocol = CTP1009;
c9x.moduleData[0].protocol = PULSES_CTP1009;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);

View file

@ -69,7 +69,7 @@ PACK(typedef struct t_Gruvin9xGeneral_v103 {
uint8_t currModel; //0..15
uint8_t contrast;
uint8_t vBatWarn;
int8_t vBatCalib;
int8_t txVoltageCalibration;
int8_t lightSw;
Gruvin9xTrainerData_v103 trainer;
uint8_t view; //index of subview in main scrren
@ -106,7 +106,7 @@ PACK(typedef struct t_Gruvin9xGeneral_v104 {
uint8_t currModel; //0..15
uint8_t contrast;
uint8_t vBatWarn;
int8_t vBatCalib;
int8_t txVoltageCalibration;
int8_t lightSw;
Gruvin9xTrainerData_v104 trainer;
uint8_t view; //index of subview in main scrren

View file

@ -216,15 +216,15 @@ int Gruvin9xInterface::getSize(const GeneralSettings & settings)
return 0;
}
int Gruvin9xInterface::isAvailable(Protocol proto, int port)
int Gruvin9xInterface::isAvailable(PulsesProtocol proto, int port)
{
switch (proto) {
case PPM:
case SILV_A:
case SILV_B:
case SILV_C:
case CTP1009:
case DSM2:
case PULSES_PPM:
case PULSES_SILV_A:
case PULSES_SILV_B:
case PULSES_SILV_C:
case PULSES_CTP1009:
case PULSES_DSM2:
return 1;
default:
return 0;

View file

@ -47,7 +47,7 @@ class Gruvin9xInterface : public EEPROMInterface
virtual int getSize(const GeneralSettings & settings);
virtual int isAvailable(Protocol proto, int port=0);
virtual int isAvailable(PulsesProtocol proto, int port=0);
protected:

View file

@ -440,16 +440,16 @@ t_Open9xGruvin9xModelData_v207::operator ModelData ()
c9x.timers[i] = timers[i];
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 2:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
case 3:
c9x.moduleData[0].protocol = PPM16;
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@ -514,19 +514,19 @@ t_Open9xGruvin9xModelData_v208::operator ModelData ()
c9x.timers[i] = timers[i];
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PPM16;
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
case 2:
c9x.moduleData[0].protocol = PPMSIM;
c9x.moduleData[0].protocol = PULSES_PPMSIM;
break;
case 3:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 4:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@ -596,19 +596,19 @@ t_Open9xGruvin9xModelData_v209::operator ModelData ()
c9x.timers[i] = timers[i];
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PPM16;
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
case 2:
c9x.moduleData[0].protocol = PPMSIM;
c9x.moduleData[0].protocol = PULSES_PPMSIM;
break;
case 3:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 4:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@ -679,19 +679,19 @@ t_Open9xGruvin9xModelData_v210::operator ModelData ()
c9x.timers[i] = timers[i];
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PPM16;
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
case 2:
c9x.moduleData[0].protocol = PPMSIM;
c9x.moduleData[0].protocol = PULSES_PPMSIM;
break;
case 3:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 4:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@ -766,19 +766,19 @@ t_Open9xGruvin9xModelData_v211::operator ModelData ()
}
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PPM16;
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
case 2:
c9x.moduleData[0].protocol = PPMSIM;
c9x.moduleData[0].protocol = PULSES_PPMSIM;
break;
case 3:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 4:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);

View file

@ -716,19 +716,19 @@ t_Open9xArmModelData_v208::operator ModelData ()
c9x.timers[i] = timers[i];
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PPM16;
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
case 2:
c9x.moduleData[0].protocol = PPMSIM;
c9x.moduleData[0].protocol = PULSES_PPMSIM;
break;
case 3:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 4:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@ -799,19 +799,19 @@ t_Open9xArmModelData_v209::operator ModelData ()
c9x.timers[i] = timers[i];
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PPM16;
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
case 2:
c9x.moduleData[0].protocol = PPMSIM;
c9x.moduleData[0].protocol = PULSES_PPMSIM;
break;
case 3:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 4:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@ -883,19 +883,19 @@ t_Open9xArmModelData_v210::operator ModelData ()
c9x.timers[i] = timers[i];
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PPM16;
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
case 2:
c9x.moduleData[0].protocol = PPMSIM;
c9x.moduleData[0].protocol = PULSES_PPMSIM;
break;
case 3:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 4:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@ -967,19 +967,19 @@ t_Open9xArmModelData_v211::operator ModelData ()
c9x.timers[i] = timers[i];
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PPM16;
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
case 2:
c9x.moduleData[0].protocol = PPMSIM;
c9x.moduleData[0].protocol = PULSES_PPMSIM;
break;
case 3:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 4:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@ -1054,19 +1054,19 @@ t_Open9xArmModelData_v212::operator ModelData ()
}
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PPM16;
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
case 2:
c9x.moduleData[0].protocol = PPMSIM;
c9x.moduleData[0].protocol = PULSES_PPMSIM;
break;
case 3:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 4:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);

View file

@ -917,16 +917,16 @@ t_Open9xModelData_v201::operator ModelData ()
c9x.timers[1] = timer2;
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 2:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
case 3:
c9x.moduleData[0].protocol = PPM16;
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@ -991,16 +991,16 @@ t_Open9xModelData_v202::operator ModelData ()
c9x.timers[1] = timer2;
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 2:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
case 3:
c9x.moduleData[0].protocol = PPM16;
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@ -1067,16 +1067,16 @@ t_Open9xModelData_v203::operator ModelData ()
c9x.timers[1] = timer2;
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 2:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
case 3:
c9x.moduleData[0].protocol = PPM16;
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@ -1141,16 +1141,16 @@ t_Open9xModelData_v204::operator ModelData ()
c9x.timers[1] = timer2;
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 2:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
case 3:
c9x.moduleData[0].protocol = PPM16;
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@ -1217,19 +1217,19 @@ t_Open9xModelData_v205::operator ModelData ()
c9x.timers[i] = timers[i];
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 2:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
case 3:
c9x.moduleData[0].protocol = PPM16;
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
case 4:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@ -1295,19 +1295,19 @@ t_Open9xModelData_v208::operator ModelData ()
c9x.timers[i] = timers[i];
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PPM16;
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
case 2:
c9x.moduleData[0].protocol = PPMSIM;
c9x.moduleData[0].protocol = PULSES_PPMSIM;
break;
case 3:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 4:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@ -1381,19 +1381,19 @@ t_Open9xModelData_v209::operator ModelData ()
c9x.timers[i] = timers[i];
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PPM16;
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
case 2:
c9x.moduleData[0].protocol = PPMSIM;
c9x.moduleData[0].protocol = PULSES_PPMSIM;
break;
case 3:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 4:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@ -1468,19 +1468,19 @@ t_Open9xModelData_v210::operator ModelData ()
c9x.timers[i] = timers[i];
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PPM16;
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
case 2:
c9x.moduleData[0].protocol = PPMSIM;
c9x.moduleData[0].protocol = PULSES_PPMSIM;
break;
case 3:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 4:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@ -1556,19 +1556,19 @@ t_Open9xModelData_v211::operator ModelData ()
c9x.timers[i] = timers[i];
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PPM16;
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
case 2:
c9x.moduleData[0].protocol = PPMSIM;
c9x.moduleData[0].protocol = PULSES_PPMSIM;
break;
case 3:
c9x.moduleData[0].protocol = PXX_DJT;
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 4:
c9x.moduleData[0].protocol = DSM2;
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
default:
c9x.moduleData[0].protocol = PPM;
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);

View file

@ -12,7 +12,7 @@
#define HAS_PERSISTENT_TIMERS(board) (IS_ARM(board) || IS_2560(board))
#define HAS_LARGE_LCD(board) IS_TARANIS(board)
#define MAX_VIEWS(board) (HAS_LARGE_LCD(board) ? 2 : 256)
#define MAX_POTS(board) (IS_TARANIS(board) ? (IS_TARANIS_X9E(board) ? 4 : 3) : 3)
#define MAX_POTS(board, version) (IS_TARANIS(board) ? (IS_TARANIS_X9E(board) ? 4 : (version >= 216 ? 3 : 2)) : 3)
#define MAX_SLIDERS(board) (IS_TARANIS(board) ? (IS_TARANIS_X9E(board) ? 4 : 2) : 0)
#define MAX_SWITCHES(board, version) (IS_TARANIS(board) ? (IS_TARANIS_X9E(board) ? 18 : 8) : 7)
#define MAX_SWITCHES_POSITION(board, version) (IS_TARANIS_X9E(board) ? 18*3 : (IS_TARANIS(board) ? 8*3 : 9))
@ -80,7 +80,7 @@ class SwitchesConversionTable: public ConversionTable {
}
if (IS_TARANIS(board) && version >= 216) {
for (int i=1; i<=MAX_POTS(board)*6; i++) {
for (int i=1; i<=MAX_POTS(board, version)*6; i++) {
addConversion(RawSwitch(SWITCH_TYPE_MULTIPOS_POT, -i), -val+offset);
addConversion(RawSwitch(SWITCH_TYPE_MULTIPOS_POT, i), val++);
}
@ -212,8 +212,9 @@ class SourcesConversionTable: public ConversionTable {
}
if (IS_TARANIS(board) && version >= 216) {
for (int i=0; i<32; i++)
for (int i=0; i<32; i++) {
addConversion(RawSource(SOURCE_TYPE_VIRTUAL_INPUT, i), val++);
}
for (int i=0; i<7; i++) {
for (int j=0; j<6; j++) {
addConversion(RawSource(SOURCE_TYPE_LUA_OUTPUT, i*16+j), val++);
@ -221,16 +222,18 @@ class SourcesConversionTable: public ConversionTable {
}
}
for (int i=0; i<NUM_STICKS+MAX_POTS(board)+MAX_SLIDERS(board); i++) {
for (int i=0; i<NUM_STICKS+MAX_POTS(board, version)+MAX_SLIDERS(board); i++) {
addConversion(RawSource(SOURCE_TYPE_STICK, i), val++);
}
for (int i=0; i<MAX_ROTARY_ENCODERS(board); i++)
for (int i=0; i<MAX_ROTARY_ENCODERS(board); i++) {
addConversion(RawSource(SOURCE_TYPE_ROTARY_ENCODER, 0), val++);
}
if (!afterrelease21March2013) {
for (int i=0; i<NUM_STICKS; i++)
for (int i=0; i<NUM_STICKS; i++) {
addConversion(RawSource(SOURCE_TYPE_TRIM, i), val++);
}
}
addConversion(RawSource(SOURCE_TYPE_MAX), val++);
@ -1746,6 +1749,7 @@ class LogicalSwitchField: public TransformedField {
{
delete andswitchesConversionTable;
}
virtual void beforeExport()
{
if (csw.func == LS_FN_TIMER) {
@ -1787,8 +1791,14 @@ class LogicalSwitchField: public TransformedField {
switchesConversionTable->importValue(v2, csw.val2);
}
else if (csw.func >= LS_FN_EQUAL && csw.func <= LS_FN_ELESS) {
sourcesConversionTable->importValue((uint8_t)v1, csw.val1);
sourcesConversionTable->importValue((uint8_t)v2, csw.val2);
if (IS_ARM(board)) {
sourcesConversionTable->importValue((uint32_t)v1, csw.val1);
sourcesConversionTable->importValue((uint32_t)v2, csw.val2);
}
else {
sourcesConversionTable->importValue((uint8_t)v1, csw.val1);
sourcesConversionTable->importValue((uint8_t)v2, csw.val2);
}
if (IS_TARANIS(board) && version < 216) {
RawSource val1(csw.val1);
if (val1.type == SOURCE_TYPE_STICK && val1.index < NUM_STICKS) {
@ -1801,7 +1811,12 @@ class LogicalSwitchField: public TransformedField {
}
}
else if (csw.func != LS_FN_OFF) {
sourcesConversionTable->importValue((uint8_t)v1, csw.val1);
if (IS_ARM(board)) {
sourcesConversionTable->importValue((uint32_t)v1, csw.val1);
}
else {
sourcesConversionTable->importValue((uint8_t)v1, csw.val1);
}
if (IS_TARANIS(board) && version < 216) {
RawSource val1(csw.val1);
if (val1.type == SOURCE_TYPE_STICK && val1.index < NUM_STICKS) {
@ -2809,7 +2824,8 @@ class SensorField: public TransformedField {
if (sensor.type == SensorData::TELEM_TYPE_CUSTOM) {
_id = sensor.id;
_instance = sensor.instance;
_param = (sensor.ratio) + ((unsigned int)sensor.offset << 16);
_ratio = sensor.ratio;
_offset = sensor.offset;
}
else {
_id = sensor.persistentValue;
@ -2820,7 +2836,7 @@ class SensorField: public TransformedField {
_param = ((uint8_t)sensor.sources[0]) + ((uint8_t)sensor.sources[1] << 8) + ((uint8_t)sensor.sources[2] << 16) + ((uint8_t)sensor.sources[3] << 24);
else if (sensor.formula == SensorData::TELEM_FORMULA_DIST)
_param = (sensor.gps) + (sensor.alt << 8);
else if (sensor.formula == SensorData::TELEM_FORMULA_CONSUMPTION)
else if (sensor.formula == SensorData::TELEM_FORMULA_CONSUMPTION || sensor.formula == SensorData::TELEM_FORMULA_TOTALIZE)
_param = (sensor.amps);
}
}
@ -2830,8 +2846,8 @@ class SensorField: public TransformedField {
if (sensor.type == SensorData::TELEM_TYPE_CUSTOM) {
sensor.id = _id;
sensor.instance = _instance;
sensor.ratio = _param & 0xFFFF;
sensor.offset = (_param >> 16) & 0xFFFF;
sensor.ratio = _ratio;
sensor.offset = _offset;
}
else {
sensor.persistentValue = _id;
@ -2843,7 +2859,7 @@ class SensorField: public TransformedField {
sensor.sources[i] = _sources[i];
else if (sensor.formula == SensorData::TELEM_FORMULA_DIST)
(sensor.gps = _sources[0], sensor.alt = _sources[1]);
else if (sensor.formula == SensorData::TELEM_FORMULA_CONSUMPTION)
else if (sensor.formula == SensorData::TELEM_FORMULA_CONSUMPTION || sensor.formula == SensorData::TELEM_FORMULA_TOTALIZE)
sensor.amps = _sources[0];
}
eepromImportDebug() << QString("imported %1").arg(internalField.getName());
@ -2857,6 +2873,10 @@ class SensorField: public TransformedField {
union {
unsigned int _param;
uint8_t _sources[4];
struct {
uint16_t _ratio;
int16_t _offset;
};
};
};
@ -3148,7 +3168,7 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
if (IS_ARM(board) && version >= 217) {
for (int i=0; i<8; i++) {
if (i < MAX_POTS(board)+MAX_SLIDERS(board))
if (i < MAX_POTS(board, version)+MAX_SLIDERS(board))
internalField.Append(new BoolField<1>(modelData.potsWarningEnabled[i]));
else
internalField.Append(new SpareBitsField<1>());
@ -3156,7 +3176,7 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
}
else if (IS_ARM(board) && version >= 216) {
for (int i=0; i<6; i++) {
if (i < MAX_POTS(board)+MAX_SLIDERS(board))
if (i < MAX_POTS(board, version)+MAX_SLIDERS(board))
internalField.Append(new BoolField<1>(modelData.potsWarningEnabled[i]));
else
internalField.Append(new SpareBitsField<1>());
@ -3165,7 +3185,7 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
}
if (IS_ARM(board) && version >= 216) {
for (int i=0; i < MAX_POTS(board)+MAX_SLIDERS(board); i++) {
for (int i=0; i < MAX_POTS(board, version)+MAX_SLIDERS(board); i++) {
internalField.Append(new SignedField<8>(modelData.potPosition[i]));
}
}
@ -3191,10 +3211,10 @@ void OpenTxModelData::beforeExport()
// qDebug() << QString("before export model") << modelData.name;
for (int module=0; module<3; module++) {
if (modelData.moduleData[module].protocol >= PXX_XJT_X16 && modelData.moduleData[module].protocol <= PXX_XJT_LR12)
subprotocols[module] = modelData.moduleData[module].protocol - PXX_XJT_X16;
else if (modelData.moduleData[module].protocol >= LP45 && modelData.moduleData[module].protocol <= DSMX)
subprotocols[module] = modelData.moduleData[module].protocol - LP45;
if (modelData.moduleData[module].protocol >= PULSES_PXX_XJT_X16 && modelData.moduleData[module].protocol <= PULSES_PXX_XJT_LR12)
subprotocols[module] = modelData.moduleData[module].protocol - PULSES_PXX_XJT_X16;
else if (modelData.moduleData[module].protocol >= PULSES_LP45 && modelData.moduleData[module].protocol <= PULSES_DSMX)
subprotocols[module] = modelData.moduleData[module].protocol - PULSES_LP45;
else
subprotocols[module] = (module==0 ? -1 : 0);
}
@ -3224,15 +3244,15 @@ void OpenTxModelData::afterImport()
}
for (int module=0; module<3; module++) {
if (modelData.moduleData[module].protocol == PXX_XJT_X16 || modelData.moduleData[module].protocol == LP45) {
if (modelData.moduleData[module].protocol == PULSES_PXX_XJT_X16 || modelData.moduleData[module].protocol == PULSES_LP45) {
if (subprotocols[module] >= 0)
modelData.moduleData[module].protocol += subprotocols[module];
else
modelData.moduleData[module].protocol = OFF;
modelData.moduleData[module].protocol = PULSES_OFF;
}
}
if (IS_TARANIS(board) && version < 217 && modelData.moduleData[1].protocol != OFF) {
if (IS_TARANIS(board) && version < 217 && modelData.moduleData[1].protocol != PULSES_OFF) {
modelData.moduleData[1].modelId = modelData.moduleData[0].modelId;
}
}
@ -3243,7 +3263,7 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
generalData(generalData),
board(board),
version(version),
inputsCount(NUM_STICKS+MAX_POTS(board)+MAX_SLIDERS(board))
inputsCount(NUM_STICKS+MAX_POTS(board, version)+MAX_SLIDERS(board))
{
eepromImportDebug() << QString("OpenTxGeneralData::OpenTxGeneralData(board: %1, version:%2, variant:%3)").arg(board).arg(version).arg(variant);
@ -3280,7 +3300,7 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
internalField.Append(new UnsignedField<8>(generalData.currModel));
internalField.Append(new UnsignedField<8>(generalData.contrast));
internalField.Append(new UnsignedField<8>(generalData.vBatWarn));
internalField.Append(new SignedField<8>(generalData.vBatCalib));
internalField.Append(new SignedField<8>(generalData.txVoltageCalibration));
internalField.Append(new SignedField<8>(generalData.backlightMode));
for (int i=0; i<NUM_STICKS; i++)
@ -3364,7 +3384,7 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
if (IS_ARM(board)) {
internalField.Append(new UnsignedField<8>(generalData.backlightBright));
internalField.Append(new SignedField<8>(generalData.currentCalib));
internalField.Append(new SignedField<8>(generalData.txCurrentCalibration));
if (version >= 213) {
internalField.Append(new SignedField<8>(generalData.temperatureWarn)); // TODO
internalField.Append(new UnsignedField<8>(generalData.mAhWarn));
@ -3407,7 +3427,7 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
internalField.Append(new UnsignedField<8>(generalData.hw_uartMode));
}
for (int i=0; i<4; i++) {
if (i < MAX_POTS(board))
if (i < MAX_POTS(board, version))
internalField.Append(new UnsignedField<2>(generalData.potConfig[i]));
else
internalField.Append(new SpareBitsField<2>());
@ -3439,7 +3459,7 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
for (int i=0; i<NUM_STICKS; ++i) {
internalField.Append(new ZCharField<3>(generalData.stickName[i]));
}
for (int i=0; i<MAX_POTS(board); ++i) {
for (int i=0; i<MAX_POTS(board, version); ++i) {
internalField.Append(new ZCharField<3>(generalData.potName[i]));
}
for (int i=0; i<MAX_SLIDERS(board); ++i) {

View file

@ -56,30 +56,30 @@ class ProtocolsConversionTable: public ConversionTable
{
int val = 0;
if (IS_ARM(board)) {
addConversion(OFF, val++);
addConversion(PULSES_OFF, val++);
}
addConversion(PPM, val++);
addConversion(PULSES_PPM, val++);
if (!IS_ARM(board)) {
addConversion(PPM16, val++);
addConversion(PPMSIM, val++);
addConversion(PULSES_PPM16, val++);
addConversion(PULSES_PPMSIM, val++);
}
if (IS_ARM(board)) {
addConversion(PXX_XJT_X16, val);
addConversion(PXX_XJT_D8, val);
addConversion(PXX_XJT_LR12, val++);
addConversion(PULSES_PXX_XJT_X16, val);
addConversion(PULSES_PXX_XJT_D8, val);
addConversion(PULSES_PXX_XJT_LR12, val++);
}
else {
addConversion(PXX_DJT, val++);
addConversion(PULSES_PXX_DJT, val++);
}
if (IS_ARM(board)) {
addConversion(LP45, val);
addConversion(DSM2, val);
addConversion(DSMX, val++);
addConversion(PULSES_LP45, val);
addConversion(PULSES_DSM2, val);
addConversion(PULSES_DSMX, val++);
}
else {
addConversion(LP45, val++);
addConversion(DSM2, val++);
addConversion(DSMX, val++);
addConversion(PULSES_LP45, val++);
addConversion(PULSES_DSM2, val++);
addConversion(PULSES_DSMX, val++);
}
}
};

View file

@ -714,7 +714,7 @@ int OpenTxFirmware::getCapability(const Capability capability)
return (IS_ARM(board) && !IS_9XRPRO(board)) ? 2 : 1;
case HasPPMStart:
return (IS_ARM(board) ? true : false);
case HasCurrentCalibration:
case HastxCurrentCalibration:
return (IS_SKY9X(board) ? true : false);
case HasVolume:
return (IS_ARM(board) ? true : false);
@ -797,16 +797,16 @@ bool OpenTxFirmware::isTelemetrySourceAvailable(int source)
return true;
}
int OpenTxEepromInterface::isAvailable(Protocol proto, int port)
int OpenTxEepromInterface::isAvailable(PulsesProtocol proto, int port)
{
if (IS_TARANIS(board)) {
switch (port) {
case 0:
switch (proto) {
case OFF:
case PXX_XJT_X16:
case PXX_XJT_D8:
case PXX_XJT_LR12:
case PULSES_OFF:
case PULSES_PXX_XJT_X16:
case PULSES_PXX_XJT_D8:
case PULSES_PXX_XJT_LR12:
return 1;
default:
return 0;
@ -814,15 +814,15 @@ int OpenTxEepromInterface::isAvailable(Protocol proto, int port)
break;
case 1:
switch (proto) {
case OFF:
case PPM:
case PXX_XJT_X16:
case PXX_XJT_D8:
case PXX_XJT_LR12:
//case PXX_DJT: // Unavailable for now
case LP45:
case DSM2:
case DSMX:
case PULSES_OFF:
case PULSES_PPM:
case PULSES_PXX_XJT_X16:
case PULSES_PXX_XJT_D8:
case PULSES_PXX_XJT_LR12:
//case PULSES_PXX_DJT: // Unavailable for now
case PULSES_LP45:
case PULSES_DSM2:
case PULSES_DSMX:
return 1;
default:
return 0;
@ -830,7 +830,7 @@ int OpenTxEepromInterface::isAvailable(Protocol proto, int port)
break;
case -1:
switch (proto) {
case PPM:
case PULSES_PPM:
return 1;
default:
return 0;
@ -844,13 +844,13 @@ int OpenTxEepromInterface::isAvailable(Protocol proto, int port)
switch (port) {
case 0:
switch (proto) {
case PPM:
case PXX_XJT_X16:
case PXX_XJT_D8:
case PXX_XJT_LR12:
case LP45:
case DSM2:
case DSMX:
case PULSES_PPM:
case PULSES_PXX_XJT_X16:
case PULSES_PXX_XJT_D8:
case PULSES_PXX_XJT_LR12:
case PULSES_LP45:
case PULSES_DSM2:
case PULSES_DSMX:
return 1;
default:
return 0;
@ -858,7 +858,7 @@ int OpenTxEepromInterface::isAvailable(Protocol proto, int port)
break;
case 1:
switch (proto) {
case PPM:
case PULSES_PPM:
return 1;
default:
return 0;
@ -870,13 +870,13 @@ int OpenTxEepromInterface::isAvailable(Protocol proto, int port)
}
else {
switch (proto) {
case PPM:
case DSMX:
case LP45:
case DSM2:
case PXX_DJT:
case PPM16:
case PPMSIM:
case PULSES_PPM:
case PULSES_DSMX:
case PULSES_LP45:
case PULSES_DSM2:
case PULSES_PXX_DJT:
case PULSES_PPM16:
case PULSES_PPMSIM:
return 1;
default:
return 0;

View file

@ -45,7 +45,7 @@ class OpenTxEepromInterface : public EEPROMInterface
virtual int getSize(const GeneralSettings &);
virtual int isAvailable(Protocol proto, int port=0);
virtual int isAvailable(PulsesProtocol proto, int port=0);
protected:

View file

@ -233,7 +233,7 @@ namespace NAMESPACE {
#include "radio/src/targets/taranis/pulses_driver.cpp"
#include "radio/src/targets/taranis/rtc_driver.cpp"
#include "radio/src/targets/taranis/trainer_driver.cpp"
#include "radio/src/targets/taranis/uart3_driver.cpp"
#include "radio/src/targets/taranis/serial2_driver.cpp"
#elif defined(PCBSKY9X)
#include "radio/src/targets/sky9x/board_sky9x.cpp"
#include "radio/src/targets/sky9x/telemetry_driver.cpp"
@ -244,7 +244,7 @@ namespace NAMESPACE {
#include "radio/src/targets/sky9x/sdcard_driver.cpp"
#include "radio/src/targets/sky9x/coproc_driver.cpp"
#include "radio/src/targets/sky9x/haptic_driver.cpp"
#include "radio/src/targets/sky9x/second_serial_driver.cpp"
#include "radio/src/targets/sky9x/serial2_driver.cpp"
#include "radio/src/targets/sky9x/pulses_driver.cpp"
#elif defined(PCBGRUVIN9X)
#include "radio/src/targets/gruvin9x/board_gruvin9x.cpp"

View file

@ -62,7 +62,7 @@ Th9xGeneral::operator GeneralSettings ()
result.currModel = currModel;
result.contrast = contrast;
result.vBatWarn = vBatWarn;
result.vBatCalib = vBatCalib;
result.txVoltageCalibration = txVoltageCalibration;
// result.lightSw = th9xToSwitch(lightSw);
result.trainer = trainer;
result.view = view;

View file

@ -64,7 +64,7 @@ PACK(typedef struct t_Th9xGeneral {
uint8_t currModel; //0..15
uint8_t contrast;
uint8_t vBatWarn;
int8_t vBatCalib;
int8_t txVoltageCalibration;
int8_t lightSw;
Th9xTrainerData trainer;
uint8_t adcFilt:2;

View file

@ -140,14 +140,14 @@ int Th9xInterface::getSize(const GeneralSettings & settings)
return 0;
}
int Th9xInterface::isAvailable(Protocol proto, int port)
int Th9xInterface::isAvailable(PulsesProtocol proto, int port)
{
switch (proto) {
case PPM:
case SILV_A:
case SILV_B:
case SILV_C:
case CTP1009:
case PULSES_PPM:
case PULSES_SILV_A:
case PULSES_SILV_B:
case PULSES_SILV_C:
case PULSES_CTP1009:
return 1;
default:
return 0;

View file

@ -46,7 +46,7 @@ class Th9xInterface : public EEPROMInterface
virtual int getSize(const GeneralSettings &);
virtual int isAvailable(Protocol proto, int port=0);
virtual int isAvailable(PulsesProtocol proto, int port=0);
protected:

View file

@ -175,8 +175,8 @@ bool FlashEEpromDialog::patchCalibration()
QString calib = g.profile[g.id()].stickPotCalib();
QString trainercalib = g.profile[g.id()].trainerCalib();
int potsnum=GetCurrentFirmware()->getCapability(Pots);
int8_t vBatCalib=(int8_t) g.profile[g.id()].vBatCalib();
int8_t currentCalib=(int8_t) g.profile[g.id()].currentCalib();
int8_t txVoltageCalibration=(int8_t) g.profile[g.id()].txVoltageCalibration();
int8_t txCurrentCalibration=(int8_t) g.profile[g.id()].txCurrentCalibration();
int8_t PPM_Multiplier=(int8_t) g.profile[g.id()].ppmMultiplier();
if ((calib.length()==(NUM_STICKS+potsnum)*12) && (trainercalib.length()==16)) {
@ -204,8 +204,8 @@ bool FlashEEpromDialog::patchCalibration()
radioData->generalSettings.trainer.calib[i] = byte16;
}
}
radioData->generalSettings.currentCalib = currentCalib;
radioData->generalSettings.vBatCalib = vBatCalib;
radioData->generalSettings.txCurrentCalibration = txCurrentCalibration;
radioData->generalSettings.txVoltageCalibration = txVoltageCalibration;
radioData->generalSettings.PPM_Multiplier = PPM_Multiplier;
return true;
}

View file

@ -159,6 +159,11 @@ CalibrationPanel::CalibrationPanel(QWidget * parent, GeneralSettings & generalSe
ui->serialPortLabel->hide();
}
if (!IS_SKY9X(firmware->getBoard())) {
ui->txCurrentCalibration->hide();
ui->txCurrentCalibrationLabel->hide();
}
if (IS_TARANIS_X9E(firmware->getBoard())) {
ui->bluetoothEnable->setChecked(generalSettings.bluetoothEnable);
ui->bluetoothName->setField(generalSettings.bluetoothName, 10, this);
@ -214,9 +219,9 @@ void CalibrationPanel::on_PPM4_editingFinished()
}
void CalibrationPanel::on_CurrentCalib_SB_editingFinished()
void CalibrationPanel::on_txCurrentCalibration_editingFinished()
{
generalSettings.currentCalib = ui->CurrentCalib_SB->value();
generalSettings.txCurrentCalibration = ui->txCurrentCalibration->value();
emit modified();
}
@ -228,8 +233,8 @@ void CalibrationPanel::on_bluetoothEnable_stateChanged(int)
void CalibrationPanel::setValues()
{
ui->battCalibDSB->setValue((double)generalSettings.vBatCalib/10);
ui->CurrentCalib_SB->setValue((double)generalSettings.currentCalib);
ui->txVoltageCalibration->setValue((double)generalSettings.txVoltageCalibration/10);
ui->txCurrentCalibration->setValue((double)generalSettings.txCurrentCalibration);
ui->ana1Neg->setValue(generalSettings.calibSpanNeg[0]);
ui->ana2Neg->setValue(generalSettings.calibSpanNeg[1]);
@ -265,9 +270,9 @@ void CalibrationPanel::setValues()
ui->PPM_MultiplierDSB->setValue((qreal)(generalSettings.PPM_Multiplier+10)/10);
}
void CalibrationPanel::on_battCalibDSB_editingFinished()
void CalibrationPanel::on_txVoltageCalibration_editingFinished()
{
generalSettings.vBatCalib = ui->battCalibDSB->value()*10;
generalSettings.txVoltageCalibration = ui->txVoltageCalibration->value()*10;
emit modified();
}

View file

@ -21,14 +21,14 @@ class CalibrationPanel : public GeneralPanel
// virtual void update();
private slots:
void on_battCalibDSB_editingFinished();
void on_txVoltageCalibration_editingFinished();
void on_PPM1_editingFinished();
void on_PPM2_editingFinished();
void on_PPM3_editingFinished();
void on_PPM4_editingFinished();
void on_PPM_MultiplierDSB_editingFinished();
void on_CurrentCalib_SB_editingFinished();
void on_txCurrentCalibration_editingFinished();
void on_bluetoothEnable_stateChanged(int);
void on_ana1Neg_editingFinished();

View file

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>805</width>
<height>1269</height>
<height>1313</height>
</rect>
</property>
<property name="windowTitle">
@ -562,14 +562,14 @@
</widget>
</item>
<item row="42" column="0">
<widget class="QLabel" name="label_22">
<widget class="QLabel" name="txVoltageCalibrationLabel">
<property name="text">
<string>Battery</string>
<string>Battery Offset</string>
</property>
</widget>
</item>
<item row="42" column="1">
<widget class="QDoubleSpinBox" name="battCalibDSB">
<widget class="QDoubleSpinBox" name="txVoltageCalibration">
<property name="statusTip">
<string/>
</property>
@ -674,7 +674,7 @@
</widget>
</item>
<item row="43" column="1">
<widget class="QSpinBox" name="CurrentCalib_SB">
<widget class="QSpinBox" name="txCurrentCalibration">
<property name="minimum">
<number>-49</number>
</property>
@ -698,9 +698,9 @@
</widget>
</item>
<item row="43" column="0">
<widget class="QLabel" name="label_CurrentCalib">
<widget class="QLabel" name="txCurrentCalibrationLabel">
<property name="text">
<string>Current</string>
<string>Current Offset</string>
</property>
</widget>
</item>

View file

@ -88,8 +88,8 @@ void GeneralEdit::on_calretrieve_PB_clicked()
}
else {
QString trainercalib = g.profile[profile_id].trainerCalib();
int8_t vBatCalib = (int8_t)g.profile[profile_id].vBatCalib();
int8_t currentCalib = (int8_t)g.profile[profile_id].currentCalib();
int8_t txVoltageCalibration = (int8_t)g.profile[profile_id].txVoltageCalibration();
int8_t txCurrentCalibration = (int8_t)g.profile[profile_id].txCurrentCalibration();
int8_t PPM_Multiplier = (int8_t)g.profile[profile_id].ppmMultiplier();
uint8_t GSStickMode = (uint8_t)g.profile[profile_id].gsStickMode();
uint8_t vBatWarn = (uint8_t)g.profile[profile_id].vBatWarn();
@ -123,8 +123,8 @@ void GeneralEdit::on_calretrieve_PB_clicked()
if (ok)
generalSettings.trainer.calib[i]=byte16;
}
generalSettings.currentCalib=currentCalib;
generalSettings.vBatCalib=vBatCalib;
generalSettings.txCurrentCalibration=txCurrentCalibration;
generalSettings.txVoltageCalibration=txVoltageCalibration;
generalSettings.vBatWarn=vBatWarn;
if (GetCurrentFirmware()->getCapability(HasBatMeterRange)) {
generalSettings.vBatMin = (int8_t) g.profile[profile_id].vBatMin();
@ -225,8 +225,8 @@ void GeneralEdit::on_calstore_PB_clicked()
calib.append(QString("%1").arg((uint16_t)generalSettings.trainer.calib[i], 4, 16, QChar('0')));
}
g.profile[profile_id].trainerCalib( calib );
g.profile[profile_id].vBatCalib( generalSettings.vBatCalib );
g.profile[profile_id].currentCalib( generalSettings.currentCalib );
g.profile[profile_id].txVoltageCalibration( generalSettings.txVoltageCalibration );
g.profile[profile_id].txCurrentCalibration( generalSettings.txCurrentCalibration );
g.profile[profile_id].vBatWarn( generalSettings.vBatWarn );
if (GetCurrentFirmware()->getCapability(HasBatMeterRange)) {
g.profile[profile_id].vBatMin( generalSettings.vBatMin );

View file

@ -1118,8 +1118,8 @@ void MainWindow::createMenus()
languageMenu->addAction(germanLangAct);
languageMenu->addAction(finnishLangAct);
languageMenu->addAction(frenchLangAct);
// languageMenu->addAction(hebrewLangAct);
languageMenu->addAction(italianLangAct);
// languageMenu->addAction(hebrewLangAct);
languageMenu->addAction(polishLangAct);
// languageMenu->addAction(portugueseLangAct);
languageMenu->addAction(spanishLangAct);
@ -1366,20 +1366,20 @@ void MainWindow::updateLanguageActions()
frenchLangAct->setChecked(true);
else if (langId=="it_IT")
italianLangAct->setChecked(true);
else if (langId=="he_IL")
hebrewLangAct->setChecked(true);
// else if (langId=="he_IL")
// hebrewLangAct->setChecked(true);
else if (langId=="pl_PL")
polishLangAct->setChecked(true);
else if (langId=="pt_PT")
portugueseLangAct->setChecked(true);
else if (langId=="ru_RU")
russianLangAct->setChecked(true);
// else if (langId=="pt_PT")
// portugueseLangAct->setChecked(true);
else if (langId=="es_ES")
spanishLangAct->setChecked(true);
else if (langId=="sv_SE")
swedishLangAct->setChecked(true);
else if (langId=="nl_NL")
dutchLangAct->setChecked(true);
// else if (langId=="ru_RU")
// russianLangAct->setChecked(true);
// else if (langId=="nl_NL")
// dutchLangAct->setChecked(true);
}
void MainWindow::updateIconThemeActions()

View file

@ -262,20 +262,22 @@ class MainWindow : public QMainWindow
QAction *normalIconAct;
QAction *bigIconAct;
QAction *hugeIconAct;
QAction *sysLangAct;
QAction *englishLangAct;
QAction *czechLangAct;
QAction *germanLangAct;
QAction *frenchLangAct;
QAction *englishLangAct;
QAction *finnishLangAct;
QAction *frenchLangAct;
QAction *italianLangAct;
QAction *hebrewLangAct;
// QAction *hebrewLangAct;
QAction *polishLangAct;
// QAction *portugueseLangAct;
QAction *spanishLangAct;
QAction *portugueseLangAct;
QAction *swedishLangAct;
QAction *russianLangAct;
QAction *dutchLangAct;
// QAction *russianLangAct;
// QAction *dutchLangAct;
QAction *openDocURLAct;
};

View file

@ -121,14 +121,14 @@ bool MixesPanel::AddMixerLine(int dest)
QString MixesPanel::getMixerText(int dest, bool * new_ch)
{
QString str;
if (new_ch) *new_ch = 0;
bool newChannel = false;
if (dest < 0) {
str = modelPrinter.printMixerName(-dest);
//highlight channel if needed
if (-dest == (int)highlightedSource) {
str = "<b>" + str + "</b>";
}
if (new_ch) *new_ch = 1;
newChannel = true;
}
else {
MixData & mix = model->mixData[dest];
@ -136,7 +136,7 @@ QString MixesPanel::getMixerText(int dest, bool * new_ch)
str = modelPrinter.printMixerName(mix.destCh);
if ((dest == 0) || (model->mixData[dest-1].destCh != mix.destCh)) {
if (new_ch) *new_ch = 1;
newChannel = true;
//highlight channel if needed
if (mix.destCh == highlightedSource) {
str = "<b>" + str + "</b>";
@ -146,8 +146,9 @@ QString MixesPanel::getMixerText(int dest, bool * new_ch)
str.fill(' ');
}
str += modelPrinter.printMixerLine(mix, highlightedSource);
str += modelPrinter.printMixerLine(mix, !newChannel, highlightedSource);
}
if (new_ch) *new_ch = newChannel;
return str.replace(" ", "&nbsp;");
}

View file

@ -167,8 +167,8 @@ ModulePanel::ModulePanel(QWidget *parent, ModelData & model, ModuleData & module
ui->label_module->setText(label);
// The protocols available on this board
for (int i=0; i<PROTO_LAST; i++) {
if (GetEepromInterface()->isAvailable((Protocol)i, moduleIdx)) {
for (int i=0; i<PULSES_PROTOCOL_LAST; i++) {
if (GetEepromInterface()->isAvailable((PulsesProtocol)i, moduleIdx)) {
ui->protocol->addItem(ModelPrinter::printModuleProtocol(i), (QVariant)i);
if (i == module.protocol) ui->protocol->setCurrentIndex(ui->protocol->count()-1);
}
@ -223,42 +223,42 @@ ModulePanel::~ModulePanel()
void ModulePanel::update()
{
unsigned int mask = 0;
Protocol protocol = (Protocol)module.protocol;
PulsesProtocol protocol = (PulsesProtocol)module.protocol;
unsigned int max_rx_num = 63;
if (moduleIdx >= 0) {
mask |= MASK_PROTOCOL;
switch (protocol) {
case PXX_XJT_X16:
case PXX_XJT_D8:
case PXX_XJT_LR12:
case PXX_DJT:
case PULSES_PXX_XJT_X16:
case PULSES_PXX_XJT_D8:
case PULSES_PXX_XJT_LR12:
case PULSES_PXX_DJT:
mask |= MASK_CHANNELS_RANGE | MASK_CHANNELS_COUNT;
if ((protocol==PXX_XJT_X16) || (protocol==PXX_XJT_LR12)) mask |= MASK_FAILSAFES | MASK_RX_NUMBER;
if ((protocol==PULSES_PXX_XJT_X16) || (protocol==PULSES_PXX_XJT_LR12)) mask |= MASK_FAILSAFES | MASK_RX_NUMBER;
break;
case LP45:
case DSM2:
case DSMX:
case PULSES_LP45:
case PULSES_DSM2:
case PULSES_DSMX:
mask |= MASK_CHANNELS_RANGE | MASK_RX_NUMBER;
module.channelsCount = 6;
max_rx_num = 20;
break;
case PPM:
case PULSES_PPM:
mask |= MASK_PPM_FIELDS | MASK_CHANNELS_RANGE| MASK_CHANNELS_COUNT;
if (IS_9XRPRO(firmware->getBoard())) {
mask |= MASK_OPEN_DRAIN;
}
break;
case OFF:
case PULSES_OFF:
default:
break;
}
}
else if (IS_TARANIS(firmware->getBoard())) {
switch(model->trainerMode) {
case MASTER_JACK:
case TRAINER_MASTER_JACK:
break;
case SLAVE_JACK:
case TRAINER_SLAVE_JACK:
mask |= MASK_PPM_FIELDS | MASK_CHANNELS_RANGE | MASK_CHANNELS_COUNT;
break;
default:
@ -266,7 +266,7 @@ void ModulePanel::update()
break;
}
}
else if (model->trainerMode != MASTER_JACK) {
else if (model->trainerMode != TRAINER_MASTER_JACK) {
mask |= MASK_PPM_FIELDS | MASK_CHANNELS_RANGE | MASK_CHANNELS_COUNT;
}

View file

@ -533,6 +533,7 @@ void TelemetrySensorPanel::update()
bool cellsFieldsDisplayed = false;
bool consFieldsDisplayed = false;
bool ratioFieldsDisplayed = false;
bool totalizeFieldsDisplayed = false;
bool sources12FieldsDisplayed = false;
bool sources34FieldsDisplayed = false;
@ -556,6 +557,7 @@ void TelemetrySensorPanel::update()
consFieldsDisplayed = (sensor.formula == SensorData::TELEM_FORMULA_CONSUMPTION);
sources12FieldsDisplayed = (sensor.formula <= SensorData::TELEM_FORMULA_MULTIPLY);
sources34FieldsDisplayed = (sensor.formula < SensorData::TELEM_FORMULA_MULTIPLY);
totalizeFieldsDisplayed = (sensor.formula == SensorData::TELEM_FORMULA_TOTALIZE);
updateSourcesComboBox(ui->source1, true);
updateSourcesComboBox(ui->source2, true);
updateSourcesComboBox(ui->source3, true);
@ -595,15 +597,15 @@ void TelemetrySensorPanel::update()
ui->offsetLabel->setVisible(ratioFieldsDisplayed && sensor.unit != SensorData::UNIT_RPMS);
ui->multiplierLabel->setVisible(sensor.unit == SensorData::UNIT_RPMS);
ui->offset->setVisible(ratioFieldsDisplayed);
ui->precLabel->setVisible(isConfigurable);
ui->precLabel->setVisible(isConfigurable && sensor.unit != SensorData::UNIT_FAHRENHEIT);
ui->prec->setVisible(isConfigurable && sensor.unit != SensorData::UNIT_FAHRENHEIT);
ui->unit->setVisible((sensor.type == SensorData::TELEM_TYPE_CALCULATED && (sensor.formula == SensorData::TELEM_FORMULA_DIST)) || isConfigurable);
ui->gpsSensorLabel->setVisible(gpsFieldsDisplayed);
ui->gpsSensor->setVisible(gpsFieldsDisplayed);
ui->altSensorLabel->setVisible(gpsFieldsDisplayed);
ui->altSensor->setVisible(gpsFieldsDisplayed);
ui->ampsSensorLabel->setVisible(consFieldsDisplayed);
ui->ampsSensor->setVisible(consFieldsDisplayed);
ui->ampsSensorLabel->setVisible(consFieldsDisplayed || totalizeFieldsDisplayed);
ui->ampsSensor->setVisible(consFieldsDisplayed || totalizeFieldsDisplayed);
ui->cellsSensorLabel->setVisible(cellsFieldsDisplayed);
ui->cellsSensor->setVisible(cellsFieldsDisplayed);
ui->cellsIndex->setVisible(cellsFieldsDisplayed);
@ -749,7 +751,7 @@ TelemetryPanel::~TelemetryPanel()
void TelemetryPanel::update()
{
if (IS_TARANIS(firmware->getBoard())) {
if (model->moduleData[0].protocol == OFF && model->moduleData[1].protocol == PPM) {
if (model->moduleData[0].protocol == PULSES_OFF && model->moduleData[1].protocol == PULSES_PPM) {
ui->telemetryProtocol->setEnabled(true);
}
else {

View file

@ -62,7 +62,16 @@
<bool>false</bool>
</property>
<layout class="QGridLayout" name="rssiLayout" columnstretch="0,0,1">
<property name="margin">
<property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<item row="2" column="0">
@ -269,7 +278,16 @@
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="A1Layout">
<property name="margin">
<property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<item>
@ -294,7 +312,16 @@
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="A2Layout">
<property name="margin">
<property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<item>
@ -322,7 +349,16 @@
</sizepolicy>
</property>
<layout class="QGridLayout" name="gridLayout_39">
<property name="margin">
<property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<property name="spacing">
@ -571,7 +607,16 @@
</sizepolicy>
</property>
<layout class="QGridLayout" name="gridLayout_40">
<property name="margin">
<property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<property name="spacing">
@ -642,7 +687,16 @@
</sizepolicy>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<property name="margin">
<property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<property name="spacing">
@ -893,7 +947,16 @@
<bool>false</bool>
</property>
<layout class="QGridLayout" name="sensorsLayout" columnstretch="0">
<property name="margin">
<property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<item row="1" column="0">

View file

@ -272,7 +272,7 @@
</sizepolicy>
</property>
<property name="text">
<string>Amps Sensor :</string>
<string>Sensor :</string>
</property>
</widget>
</item>
@ -366,82 +366,82 @@
</item>
<item>
<property name="text">
<string>Voltage (V)</string>
<string>V</string>
</property>
</item>
<item>
<property name="text">
<string>Current (A)</string>
<string>A</string>
</property>
</item>
<item>
<property name="text">
<string>Current (mA)</string>
<string>mA</string>
</property>
</item>
<item>
<property name="text">
<string>Speed (kts)</string>
<string>kt</string>
</property>
</item>
<item>
<property name="text">
<string>Speed (m/s)</string>
<string>m/s</string>
</property>
</item>
<item>
<property name="text">
<string>Speed (ft/s)</string>
<string>ft/s</string>
</property>
</item>
<item>
<property name="text">
<string>Speed (km/h)</string>
<string>km/h</string>
</property>
</item>
<item>
<property name="text">
<string>Speed (miles/h)</string>
<string>mph</string>
</property>
</item>
<item>
<property name="text">
<string>Meters (m)</string>
<string>m</string>
</property>
</item>
<item>
<property name="text">
<string>Feet (ft)</string>
<string>ft</string>
</property>
</item>
<item>
<property name="text">
<string>Temp (°C)</string>
<string>°C</string>
</property>
</item>
<item>
<property name="text">
<string>Temp (°F)</string>
<string>°F</string>
</property>
</item>
<item>
<property name="text">
<string>Percentage (%)</string>
<string>%</string>
</property>
</item>
<item>
<property name="text">
<string>Energy (mAh)</string>
<string>mAh</string>
</property>
</item>
<item>
<property name="text">
<string>Power (W)</string>
<string>W</string>
</property>
</item>
<item>
<property name="text">
<string>RF Power (dBm)</string>
<string>dBm</string>
</property>
</item>
<item>
@ -451,22 +451,22 @@
</item>
<item>
<property name="text">
<string>Acceleration (g)</string>
<string>g</string>
</property>
</item>
<item>
<property name="text">
<string>Heading (°)</string>
<string>°</string>
</property>
</item>
<item>
<property name="text">
<string>Volume (mL)</string>
<string>mL</string>
</property>
</item>
<item>
<property name="text">
<string>Volume (US fl.Oz.)</string>
<string>US fl.Oz.</string>
</property>
</item>
</widget>

View file

@ -108,13 +108,13 @@ QString ModelPrinter::printModuleProtocol(unsigned int protocol)
QString ModelPrinter::printModule(int idx)
{
const ModuleData & module = model.moduleData[idx];
if (module.protocol == OFF)
if (module.protocol == PULSES_OFF)
return printModuleProtocol(module.protocol);
else if (module.protocol == PPM)
else if (module.protocol == PULSES_PPM)
return tr("%1, Channels(%2-%3), PPM delay(%4usec), Pulse polarity(%5)").arg(printModuleProtocol(module.protocol)).arg(module.channelsStart+1).arg(module.channelsStart+module.channelsCount).arg(module.ppmDelay).arg(module.polarityToString());
else {
QString result = tr("%1, Channels(%2-%3)").arg(printModuleProtocol(module.protocol)).arg(module.channelsStart+1).arg(module.channelsStart+module.channelsCount);
if (module.protocol != PXX_XJT_D8) {
if (module.protocol != PULSES_PXX_XJT_D8) {
result += " " + tr("Receiver number(%1)").arg(module.modelId);
}
return result;
@ -327,21 +327,25 @@ QString ModelPrinter::printMixerName(int curDest)
return Qt::escape(str);
}
QString ModelPrinter::printMixerLine(int idx, int highlightedSource)
QString ModelPrinter::printMixerLine(int idx, bool showMultiplex, int highlightedSource)
{
return printMixerLine(model.mixData[idx], highlightedSource);
return printMixerLine(model.mixData[idx], highlightedSource, showMultiplex);
}
QString ModelPrinter::printMixerLine(const MixData & mix, int highlightedSource)
QString ModelPrinter::printMixerLine(const MixData & mix, bool showMultiplex, int highlightedSource)
{
QString str = "&nbsp;";
switch(mix.mltpx) {
case (1): str += "*"; break;
case (2): str += "R"; break;
default: str += "&nbsp;"; break;
};
if (showMultiplex) {
switch(mix.mltpx) {
case (1): str += "*="; break;
case (2): str += ":="; break;
default: str += "+="; break;
}
}
else {
str += "&nbsp;&nbsp;";
}
// highlight source if needed
QString source = Qt::escape(mix.srcRaw.toString(&model));
if ( (mix.srcRaw.type == SOURCE_TYPE_CH) && (mix.srcRaw.index+1 == (int)highlightedSource) ) {

View file

@ -50,8 +50,8 @@ class ModelPrinter: public QObject
QString printInputLine(int idx);
QString printInputLine(const ExpoData & ed);
QString printMixerName(int curDest);
QString printMixerLine(int idx, int highlightedSource = 0);
QString printMixerLine(const MixData & md, int highlightedSource = 0);
QString printMixerLine(int idx, bool showMultiplex, int highlightedSource = 0);
QString printMixerLine(const MixData & md, bool showMultiplex, int highlightedSource = 0);
QString printLogicalSwitchLine(int idx);
QString printCustomFunctionLine(int idx);
static QString printChannelName(int idx);

View file

@ -357,7 +357,7 @@ QString MultiModelPrinter::printMixers()
for (int j=0; j<count; j++) {
if (j > 0)
columns.append("<br/>");
COMPARE((j < model->mixes(i).size()) ? modelPrinter->printMixerLine(*model->mixes(i)[j]) : "&nbsp;");
COMPARE((j < model->mixes(i).size()) ? modelPrinter->printMixerLine(*model->mixes(i)[j], (j>0)) : "&nbsp;");
}
columns.append("</td></tr>");
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -69,7 +69,7 @@ void saveGeneralSettings(GeneralSettings & settings, global_settings & gs)
// TODO BSS settings.currModel;
gs.contrast(settings.contrast);
gs.battery(battery(settings.vBatCalib, settings.vBatWarn));
gs.battery(battery(settings.txVoltageCalibration, settings.vBatWarn));
gs.ppm_input_calibration(ppm_input_calibration(settings.PPM_Multiplier,
PPMCalibration(settings.trainer.calib[0]),
@ -124,7 +124,7 @@ void saveModel(ModelData & m, model & xm)
}
}
*/
if (m.moduleData[0].protocol != PPM || m.moduleData[0].channelsCount != 8 || m.moduleData[0].ppmDelay != 300 || m.moduleData[0].ppmPulsePol != 0) {
if (m.moduleData[0].protocol != PULSES_PPM || m.moduleData[0].channelsCount != 8 || m.moduleData[0].ppmDelay != 300 || m.moduleData[0].ppmPulsePol != 0) {
modulation mod;
mod.type(modulation::type_type::value(m.moduleData[0].protocol));
mod.channels(m.moduleData[0].channelsCount);

View file

@ -4,18 +4,35 @@
<ul>
<li>Fixed several issues with D series altimeter/vario (negative values, hi/lo precision vario) (<a href=https://github.com/opentx/opentx/issues/2685>#2685</a>)</li>
<li>Auto-offset for Frsky variometer on per default (<a href=https://github.com/opentx/opentx/issues/2693>#2693</a>)</li>
<li>9XE top LDC fixes: added TX battery blinking on battery warning, fixed display problem when battery voltage lower than batlow value. (<a href=https://github.com/opentx/opentx/issues/2671>#2671</a>)</li>
<li>X9E top LDC fixes: added TX battery blinking on battery warning, fixed display problem when battery voltage lower than batlow value. (<a href=https://github.com/opentx/opentx/issues/2671>#2671</a>)</li>
<li>Timers range extended (it was limited to around 9 hours before) (<a href=https://github.com/opentx/opentx/issues/2702>#2702</a>)</li>
<li>Fixed: Playing two background sounds at once causes sound to stop (<a href=https://github.com/opentx/opentx/issues/2704>#2704</a>)</li>
<li>Several fixes to the SD card manager menu (<a href=https://github.com/opentx/opentx/issues/2623>#2623</a>)</li>
<li>Fixed the difference between top and main LCD TX battery bars on 9Xe (<a href=https://github.com/opentx/opentx/issues/2671>#2671</a>)</li>
<li>Several Lua getValue() fields were not exported correctly (tx-voltage, clock and timers1-3)</li>
<li>Fixed: Edge Logical Switch could trigger right after the model was loaded or the radio turned on (<a href=https://github.com/opentx/opentx/issues/2728>#2728</a>)</li>
<li>Fixed output channel jitter if trim was used (<a href=https://github.com/opentx/opentx/issues/2774>#2774</a>)</li>
<li>Some telemetry sensors did not work in logical switches if there were more than 16 sensors (<a href=https://github.com/opentx/opentx/issues/2787>#2787</a>)</li>
<li>Improved mixer screen layout (<a href=https://github.com/opentx/opentx/issues/2785>#2785</a>)</li>
</ul>
[X9E]
<ul>
<li>Unwanted radio turning off on watchdog reset fixed (<a href=https://github.com/opentx/opentx/issues/2681>#2681</a>, <a href=https://github.com/opentx/opentx/issues/2790>#2790</a>)</li>
<li>Added code to help mitigate the issue of RTC loosing its time when radio was turned off (<a href=https://github.com/opentx/opentx/issues/2626>#2626</a>)</li>
</ul>
[Sky9x / 9XR-PRO]
<ul>
<li>Sound was unintelligible (<a href=https://github.com/opentx/opentx/issues/2665>#2665</a>)</li>
<li>PXX wasn't enabled</li>
</ul>
[All]
<ul>
<li>Various texts and translations corrections</li>
<li>Various small bug-fixes</li>
</ul>

View file

@ -273,6 +273,10 @@ SHUTDOWN_CONFIRMATION = NO
# Values = YES, NO
DEBUG = NO
# Activate Command Line Interpreter
# Values = NO, YES
CLI = NO
# Activate writing of SPORT telemetry received data to sport.log file
# Values = YES, NO
SPORT_FILE_LOG = NO
@ -306,9 +310,10 @@ LUA = NO
MENUS_LOCK = NO
# USB options in the main image
# Values = JOYSTICK, MASSSTORAGE
# Values = JOYSTICK, MASSSTORAGE, SERIAL
# JOYSTICK: The TX will appear as a joystick
# MASSSTORAGE: The TX will appear as a drive
# SERIAL: The TX will appear as a serial port
USB = JOYSTICK
# Mixers monitor view added to Channels monitor one
@ -366,6 +371,10 @@ SIMU_DISKIO = NO
# Values = NO, YES
SIMU_AUDIO = NO
# Enable Watchdog test (DANGEROUS)
# Values = NO, YES
WATCHDOG_TEST = NO
#------- END BUILD OPTIONS ---------------------------
# Define programs and commands.
@ -811,7 +820,7 @@ ifeq ($(PCB), $(filter $(PCB), SKY9X 9XRPRO AR9X))
EEPROMSRC = eeprom_common.cpp eeprom_raw.cpp eeprom_conversions.cpp
PULSESSRC = pulses/pulses_arm.cpp pulses/ppm_arm.cpp pulses/pxx_arm.cpp pulses/dsm2_arm.cpp
CPPSRC += tasks_arm.cpp audio_arm.cpp haptic.cpp gui/$(GUIDIRECTORY)/view_about.cpp gui/$(GUIDIRECTORY)/view_text.cpp telemetry/telemetry.cpp
CPPSRC += targets/sky9x/telemetry_driver.cpp targets/sky9x/second_serial_driver.cpp targets/sky9x/pwr_driver.cpp targets/sky9x/adc_driver.cpp targets/sky9x/eeprom_driver.cpp targets/sky9x/pulses_driver.cpp targets/sky9x/keys_driver.cpp targets/sky9x/audio_driver.cpp targets/sky9x/buzzer_driver.cpp targets/sky9x/haptic_driver.cpp targets/sky9x/sdcard_driver.cpp targets/sky9x/massstorage.cpp
CPPSRC += targets/sky9x/telemetry_driver.cpp targets/sky9x/serial2_driver.cpp targets/sky9x/pwr_driver.cpp targets/sky9x/adc_driver.cpp targets/sky9x/eeprom_driver.cpp targets/sky9x/pulses_driver.cpp targets/sky9x/keys_driver.cpp targets/sky9x/audio_driver.cpp targets/sky9x/buzzer_driver.cpp targets/sky9x/haptic_driver.cpp targets/sky9x/sdcard_driver.cpp targets/sky9x/massstorage.cpp
CPPSRC += loadboot.cpp debug.cpp
BITMAPS += bitmaps/9X/splash.lbm bitmaps/9X/asterisk.lbm bitmaps/9X/about.lbm
ifeq ($(SDCARD), YES)
@ -928,17 +937,20 @@ ifeq ($(PCB), TARANIS)
LDSCRIPT = targets/taranis/stm32f2_flash.ld
endif
STM32USBPATH = $(THIRDPARTY)/STM32_USB-Host-Device_Lib_V2.1.0/Libraries
INCDIRS += $(STM32USBPATH)/STM32_USB_OTG_Driver/inc $(STM32USBPATH)/STM32_USB_Device_Library/Core/inc
INCDIRS += $(STM32USBPATH)/STM32_USB_Device_Library/Class/msc/inc $(STM32USBPATH)/STM32_USB_Device_Library/Class/hid/inc
INCDIRS += $(STM32USBPATH)/STM32_USB_OTG_Driver/inc
INCDIRS += $(STM32USBPATH)/STM32_USB_Device_Library/Core/inc
INCDIRS += $(STM32USBPATH)/STM32_USB_Device_Library/Class/msc/inc
INCDIRS += $(STM32USBPATH)/STM32_USB_Device_Library/Class/hid/inc
INCDIRS += $(STM32USBPATH)/STM32_USB_Device_Library/Class/cdc/inc
GUIGENERALSRC += gui/$(GUIDIRECTORY)/menu_general_hardware.cpp
BOARDSRC = main_arm.cpp targets/taranis/board_taranis.cpp
EXTRABOARDSRC += targets/taranis/configure_pins.cpp targets/taranis/lcd_driver.cpp targets/taranis/flash_driver.cpp targets/taranis/i2c_driver.cpp targets/taranis/aspi.c targets/taranis/delays.c
EXTRABOARDSRC += targets/taranis/configure_pins.cpp targets/taranis/lcd_driver.cpp targets/taranis/flash_driver.cpp targets/taranis/i2c_driver.cpp targets/taranis/aspi.c targets/taranis/delays.c serial.cpp
SRC += $(COOSDIR)/kernel/core.c $(COOSDIR)/kernel/hook.c $(COOSDIR)/kernel/task.c $(COOSDIR)/kernel/event.c $(COOSDIR)/kernel/time.c $(COOSDIR)/kernel/timer.c $(COOSDIR)/kernel/flag.c $(COOSDIR)/kernel/mutex.c $(COOSDIR)/kernel/serviceReq.c $(COOSDIR)/portable/GCC/port.c $(COOSDIR)/portable/arch.c
SRC += targets/taranis/pwr_driver.c targets/taranis/usb_driver.c
EEPROMSRC = eeprom_common.cpp eeprom_rlc.cpp eeprom_conversions.cpp
PULSESSRC = pulses/pulses_arm.cpp pulses/ppm_arm.cpp pulses/pxx_arm.cpp
CPPSRC += tasks_arm.cpp audio_arm.cpp sbus.cpp telemetry/telemetry.cpp
CPPSRC += targets/taranis/pulses_driver.cpp targets/taranis/keys_driver.cpp targets/taranis/adc_driver.cpp targets/taranis/trainer_driver.cpp targets/taranis/audio_driver.cpp targets/taranis/uart3_driver.cpp targets/taranis/telemetry_driver.cpp
CPPSRC += targets/taranis/pulses_driver.cpp targets/taranis/keys_driver.cpp targets/taranis/adc_driver.cpp targets/taranis/trainer_driver.cpp targets/taranis/audio_driver.cpp targets/taranis/serial2_driver.cpp targets/taranis/telemetry_driver.cpp
CPPSRC += bmp.cpp gui/$(GUIDIRECTORY)/view_channels.cpp gui/$(GUIDIRECTORY)/view_about.cpp gui/$(GUIDIRECTORY)/view_text.cpp debug.cpp
CPPSRC += loadboot.cpp
ifeq ($(PCBREV), REV9E)
@ -981,6 +993,10 @@ ifeq ($(PCB), TARANIS)
ifeq ($(USB), JOYSTICK)
CPPDEFS += -DUSB_JOYSTICK
SRC += targets/taranis/usbd_hid_joystick.c
else ifeq ($(USB), SERIAL)
CPPDEFS += -DUSB_SERIAL
SRC += $(STM32USBPATH)/STM32_USB_Device_Library/Class/cdc/src/usbd_cdc_core.c
EXTRABOARDSRC += targets/taranis/usbd_cdc.cpp
else
CPPDEFS += -DUSB_MASS_STORAGE
SRC += $(STM32USBPATH)/STM32_USB_Device_Library/Class/msc/src/usbd_msc_data.c
@ -1036,6 +1052,9 @@ ifeq ($(PCB), TARANIS)
ifeq ($(MIXERS_MONITOR), YES)
CPPDEFS += -DMIXERS_MONITOR
endif
ifeq ($(WATCHDOG_TEST), YES)
CPPDEFS += -DWATCHDOG_TEST
endif
endif
CC = $(TRGT)gcc
@ -1253,10 +1272,10 @@ ifeq ($(EXT), JETI)
endif
ifeq ($(EXT), MAVLINK)
CPPDEFS += -DMAVLINK
INCDIRS += thirdparty
CPPSRC += telemetry/mavlink.cpp gui/$(GUIDIRECTORY)/view_mavlink.cpp serial.cpp
EEPROM_VARIANT += ${MAVLINK_VARIANT}
CPPDEFS += -DMAVLINK
INCDIRS += thirdparty
CPPSRC += telemetry/mavlink.cpp gui/$(GUIDIRECTORY)/view_mavlink.cpp targets/common_avr/serial_driver.cpp
EEPROM_VARIANT += ${MAVLINK_VARIANT}
endif
ifeq ($(EXT), TELEMETREZ)
@ -1297,8 +1316,15 @@ ifeq ($(EXT), $(filter $(EXT), FRSKY FRSKY_SPORT TELEMETREZ))
EEPROM_VARIANT += ${FRSKY_VARIANT}
endif
ifeq ($(DEBUG), YES)
ifeq ($(SIMU), YES)
CPPDEFS += -DDEBUG
CPPSRC += dump.cpp
else ifeq ($(CLI), YES)
CPPDEFS += -DCLI -DDEBUG
CPPSRC += cli.cpp dump.cpp
else ifeq ($(DEBUG), YES)
CPPDEFS += -DDEBUG
CPPSRC += dump.cpp
endif
ifeq ($(EEPROM_PROGRESS_BAR), YES)

View file

@ -305,24 +305,28 @@ void getPhaseAudioFile(char * filename, int index, unsigned int event)
void getSwitchAudioFile(char * filename, int index)
{
char * str = getModelAudioPath(filename);
int len = STR_VSWITCHES[0];
strncpy(str, &STR_VSWITCHES[1+len*(index+1)], len);
str += len-1;
if (*str == '\300') {
strcpy(str, "-up");
str += 3;
}
else if (*str == '-') {
strcpy(str, "-mid");
str += 4;
}
else if (*str == '\301') {
strcpy(str, "-down");
str += 5;
#if defined(PCBTARANIS)
if (index <= SWSRC_LAST_SWITCH) {
div_t swinfo = switchInfo(index);
*str++ = 'S';
*str++ = 'A' + swinfo.quot;
const char * positions[] = { "-up", "-mid", "-down" };
strcpy(str, positions[swinfo.rem]);
}
else {
*(str+1) = 0;
div_t swinfo = div(index - SWSRC_FIRST_MULTIPOS_SWITCH, XPOTS_MULTIPOS_COUNT);
*str++ = 'S';
*str++ = '1' + swinfo.quot;
*str++ = '1' + swinfo.rem;
*str = '\0';
}
#else
int len = STR_VSWITCHES[0];
strncpy(str, &STR_VSWITCHES[1+(len*index)], len);
str += len;
*str = '\0';
#endif
strcat(str, SOUNDS_EXT);
}
@ -381,7 +385,7 @@ void referenceModelAudioFiles()
}
// Switches Audio Files <switchname>-[up|mid|down].wav
for (int i=0; i<SWSRC_LAST_SWITCH+NUM_XPOTS*XPOTS_MULTIPOS_COUNT && !found; i++) {
for (int i=SWSRC_FIRST_SWITCH; i<=SWSRC_LAST_SWITCH+NUM_XPOTS*XPOTS_MULTIPOS_COUNT && !found; i++) {
getSwitchAudioFile(path, i);
// TRACE("referenceModelAudioFiles(): searching for %s in %s", filename, fn);
if (!strcasecmp(filename, fn)) {

View file

@ -306,8 +306,15 @@ void audioStart();
#define AUDIO_ERROR() AUDIO_BUZZER(audioEvent(AU_ERROR), beep(4))
#define AUDIO_TIMER_30() AUDIO_BUZZER(audioEvent(AU_TIMER_30), { beepAgain=2; beep(2); })
#define AUDIO_TIMER_20() AUDIO_BUZZER(audioEvent(AU_TIMER_20), { beepAgain=1; beep(2); })
#if defined(HAPTIC)
#define AUDIO_TIMER_LT10(m, x) do { if (m==COUNTDOWN_VOICE) playNumber(x, 0, 0, 0); else if (m==COUNTDOWN_HAPTIC) haptic.event(AU_TIMER_LT10); else AUDIO_BUZZER(audioEvent(AU_TIMER_LT10), beep(2)); } while(0)
#define AUDIO_TIMER_00(m) do { if (m==COUNTDOWN_VOICE) playNumber(0, 0, 0, 0); else if (m==COUNTDOWN_HAPTIC) haptic.event(AU_TIMER_00); else AUDIO_BUZZER(audioEvent(AU_TIMER_00), beep(3)); } while(0)
#else
#define AUDIO_TIMER_LT10(m, x) do { if (m==COUNTDOWN_VOICE) playNumber(x, 0, 0, 0); else AUDIO_BUZZER(audioEvent(AU_TIMER_LT10), beep(2)); } while(0)
#define AUDIO_TIMER_00(m) do { if (m==COUNTDOWN_VOICE) playNumber(0, 0, 0, 0); else AUDIO_BUZZER(audioEvent(AU_TIMER_00), beep(3)); } while(0)
#endif
#define AUDIO_INACTIVITY() AUDIO_BUZZER(audioEvent(AU_INACTIVITY), beep(3))
#define AUDIO_MIX_WARNING(x) AUDIO_BUZZER(audioEvent(AU_MIX_WARNING_1+x-1), beep(1))
#define AUDIO_POT_MIDDLE(x) AUDIO_BUZZER(audioEvent(AU_STICK1_MIDDLE+x), beep(2))

View file

@ -62,7 +62,7 @@ void audioQueue::heartbeat()
else {
#if defined(CPUM2560)
if (toneFreq) {
OCR0A = (5000 / toneFreq); // sticking with old values approx 20(abs. min) to 90, 60 being the default tone(?).
OCR4A = (5000 / toneFreq); // sticking with old values approx 20(abs. min) to 90, 60 being the default tone(?).
speakerOn();
}
#endif
@ -88,7 +88,7 @@ void audioQueue::heartbeat()
if (tone2TimeLeft > 0) {
#if defined(CPUM2560)
if (tone2Freq) {
OCR0A = (5000 / tone2Freq); // sticking with old values approx 20(abs. min) to 90, 60 being the default tone(?).
OCR4A = (5000 / tone2Freq); // sticking with old values approx 20(abs. min) to 90, 60 being the default tone(?).
speakerOn();
}
#else

View file

@ -39,11 +39,11 @@ void * bin_realloc(void * ptr, size_t size)
// if it fits in current slot, return it
// TODO if new size is smaller, try to relocate in smaller slot
if ( slots1.can_fit(ptr, size) ) {
// TRACE("OUR realloc %p[%lu] fits in slot1", ptr, size); FLUSH();
// TRACE("OUR realloc %p[%lu] fits in slot1", ptr, size);
return ptr;
}
if ( slots2.can_fit(ptr, size) ) {
// TRACE("OUR realloc %p[%lu] fits in slot2", ptr, size); FLUSH();
// TRACE("OUR realloc %p[%lu] fits in slot2", ptr, size);
return ptr;
}
@ -51,10 +51,10 @@ void * bin_realloc(void * ptr, size_t size)
void * res = bin_malloc(size);
if (res == 0) {
// we don't have the space, use libc malloc
// TRACE("bin_malloc [%lu] FAILURE", size); FLUSH();
// TRACE("bin_malloc [%lu] FAILURE", size);
res = malloc(size);
if (res == 0) {
TRACE("libc malloc [%lu] FAILURE", size); FLUSH();
TRACE("libc malloc [%lu] FAILURE", size);
return 0;
}
}
@ -73,7 +73,7 @@ void *bin_l_alloc (void *ud, void *ptr, size_t osize, size_t nsize)
if (ptr) { // avoid a bunch of NULL pointer free calls
if (!bin_free(ptr)) {
// not our range, use libc allocator
// TRACE("libc free %p", ptr); FLUSH();
// TRACE("libc free %p", ptr);
free(ptr);
}
}
@ -89,18 +89,18 @@ void *bin_l_alloc (void *ud, void *ptr, size_t osize, size_t nsize)
}
if ( SimulateMallocFailure > 0) {
// simulate one malloc failure
TRACE("bin_l_alloc(): simulating malloc failure at %p[%lu]", ptr, nsize); FLUSH();
TRACE("bin_l_alloc(): simulating malloc failure at %p[%lu]", ptr, nsize);
return 0;
}
#endif // #if defined(DEBUG)
// try our allocator, if it fails use libc allocator
void * res = bin_realloc(ptr, nsize);
if (res && ptr) {
// TRACE("OUR realloc %p[%lu] -> %p[%lu]", ptr, osize, res, nsize); FLUSH();
// TRACE("OUR realloc %p[%lu] -> %p[%lu]", ptr, osize, res, nsize);
}
if (res == 0) {
res = realloc(ptr, nsize);
// TRACE("libc realloc %p[%lu] -> %p[%lu]", ptr, osize, res, nsize); FLUSH();
// TRACE("libc realloc %p[%lu] -> %p[%lu]", ptr, osize, res, nsize);
// if (res == 0 ){
// TRACE("realloc FAILURE %lu", nsize);
// dumpFreeMemory();

View file

@ -20,7 +20,7 @@ public:
if (ptr == Bins[n].data) {
Bins[n].Used = false;
--NoUsedBins;
// TRACE("\tBinAllocator<%d> free %lu ------", SIZE_SLOT, n); FLUSH();
// TRACE("\tBinAllocator<%d> free %lu ------", SIZE_SLOT, n);
return true;
}
}
@ -31,22 +31,22 @@ public:
}
void * malloc(size_t size) {
if (size > SIZE_SLOT) {
// TRACE("BinAllocator<%d> malloc [%lu] size > SIZE_SLOT", SIZE_SLOT, size); FLUSH();
// TRACE("BinAllocator<%d> malloc [%lu] size > SIZE_SLOT", SIZE_SLOT, size);
return 0;
}
if (NoUsedBins >= NUM_BINS) {
// TRACE("BinAllocator<%d> malloc [%lu] no free slots", SIZE_SLOT, size); FLUSH();
// TRACE("BinAllocator<%d> malloc [%lu] no free slots", SIZE_SLOT, size);
return 0;
}
for (size_t n = 0; n < NUM_BINS; ++n) {
if (!Bins[n].Used) {
Bins[n].Used = true;
++NoUsedBins;
// TRACE("\tBinAllocator<%d> malloc %lu[%lu]", SIZE_SLOT, n, size); FLUSH();
// TRACE("\tBinAllocator<%d> malloc %lu[%lu]", SIZE_SLOT, n, size);
return Bins[n].data;
}
}
// TRACE("BinAllocator<%d> malloc [%lu] no free slots", SIZE_SLOT , size); FLUSH();
// TRACE("BinAllocator<%d> malloc [%lu] no free slots", SIZE_SLOT , size);
return 0;
}
size_t size(void * ptr) {

353
radio/src/cli.cpp Normal file
View file

@ -0,0 +1,353 @@
/*
* Authors (alphabetical order)
* - Andre Bernet <bernet.andre@gmail.com>
* - Andreas Weitl
* - Bertrand Songis <bsongis@gmail.com>
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
* - Cameron Weeks <th9xer@gmail.com>
* - Erez Raviv
* - Gabriel Birkus
* - Jean-Pierre Parisy
* - Karl Szmutny
* - Michael Blandford
* - Michal Hlavinka
* - Pat Mackenzie
* - Philip Moss
* - Rob Thomson
* - Romolo Manfredini <romolo.manfredini@gmail.com>
* - Thomas Husterer
*
* opentx is based on code named
* gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/,
* er9x by Erez Raviv: http://code.google.com/p/er9x/,
* and the original (and ongoing) project by
* Thomas Husterer, th9x: http://code.google.com/p/th9x/
*
* 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"
#include <ctype.h>
#define CLI_COMMAND_MAX_ARGS 8
#define CLI_COMMAND_MAX_LEN 256
OS_TID cliTaskId;
TaskStack<CLI_STACK_SIZE> cliStack;
Fifo<256> cliRxFifo;
uint8_t cliTracesEnabled = false;
typedef int (* CliFunction) (const char ** args);
struct CliCommand
{
const char * name;
CliFunction func;
const char * args;
};
struct MemArea
{
const char * name;
void * start;
int size;
};
void cliPrompt()
{
serialPutc('>');
}
int toInt(const char ** argv, int index, int * val)
{
if (*argv[index] == '\0') {
return 0;
}
else {
int base = 10;
const char * s = argv[index];
if (strlen(s) > 2 && s[0] == '0' && s[1] == 'x') {
base = 16;
s = &argv[index][2];
}
char * endptr = NULL;
*val = strtol(s, &endptr, base);
if (*endptr == '\0')
return 1;
else {
serialPrint("%s: Invalid argument \"%s\"", argv[0], argv[index]);
return -1;
}
}
}
int cliBeep(const char ** argv)
{
int freq = BEEP_DEFAULT_FREQ;
int duration = 100;
if (toInt(argv, 1, &freq) >= 0 && toInt(argv, 2, &duration) >= 0) {
audioQueue.playTone(freq, duration, 20, PLAY_NOW);
}
return 0;
}
int cliPlay(const char ** argv)
{
audioQueue.playFile(argv[1], PLAY_NOW);
return 0;
}
int cliLs(const char ** argv)
{
FILINFO fno;
DIR dir;
char *fn; /* This function is assuming non-Unicode cfg. */
#if _USE_LFN
TCHAR lfn[_MAX_LFN + 1];
fno.lfname = lfn;
fno.lfsize = sizeof(lfn);
#endif
FRESULT res = f_opendir(&dir, argv[1]); /* Open the directory */
if (res == FR_OK) {
for (;;) {
res = f_readdir(&dir, &fno); /* Read a directory item */
if (res != FR_OK || fno.fname[0] == 0) break; /* Break on error or end of dir */
#if _USE_LFN
fn = *fno.lfname ? fno.lfname : fno.fname;
#else
fn = fno.fname;
#endif
serialPrint(fn);
}
}
else {
serialPrint("%s: Invalid directory \"%s\"", argv[0], argv[1]);
}
return 0;
}
int cliTrace(const char ** argv)
{
if (!strcmp(argv[1], "on")) {
cliTracesEnabled = true;
}
else if (!strcmp(argv[1], "off")) {
cliTracesEnabled = false;
}
else {
serialPrint("%s: Invalid argument \"%s\"", argv[0], argv[1]);
}
return 0;
}
int cliStackInfo(const char ** argv)
{
int tid = 0;
if (toInt(argv, 1, &tid) > 0) {
int available = 0;
int total = 0;
switch(tid) {
case MENU_TASK_INDEX:
total = menusStack.size();
available = menusStack.available();
break;
case MIXER_TASK_INDEX:
total = mixerStack.size();
available = mixerStack.available();
break;
case AUDIO_TASK_INDEX:
total = audioStack.size();
available = audioStack.available();
break;
case CLI_TASK_INDEX:
total = cliStack.size();
available = cliStack.available();
break;
case MAIN_TASK_INDEX:
total = stackAvailable();
available = stackSize();
break;
default:
break;
}
serialPrint("%d available (%d total)", available, total);
}
else {
serialPrint("%s: Invalid argument \"%s\"", argv[0], argv[1]);
}
return 0;
}
int cliVolume(const char ** argv)
{
int level = 0;
if (toInt(argv, 1, &level) > 0) {
setVolume(level);
}
else {
serialPrint("%s: Invalid argument \"%s\"", argv[0], argv[1]);
}
return 0;
}
const MemArea memAreas[] = {
{ "RCC", RCC, sizeof(RCC_TypeDef) },
{ "GPIOA", GPIOA, sizeof(GPIO_TypeDef) },
{ "GPIOB", GPIOB, sizeof(GPIO_TypeDef) },
{ "GPIOC", GPIOC, sizeof(GPIO_TypeDef) },
{ "GPIOD", GPIOD, sizeof(GPIO_TypeDef) },
{ "GPIOE", GPIOE, sizeof(GPIO_TypeDef) },
{ "GPIOF", GPIOF, sizeof(GPIO_TypeDef) },
{ "GPIOG", GPIOG, sizeof(GPIO_TypeDef) },
{ "USART1", USART1, sizeof(USART_TypeDef) },
{ "USART3", USART3, sizeof(USART_TypeDef) },
{ NULL, NULL, 0 },
};
int cliDisplay(const char ** argv)
{
int address = 0;
for (const MemArea * area = memAreas; area->name != NULL; area++) {
if (!strcmp(area->name, argv[1])) {
dump((uint8_t *)area->start, area->size);
return 0;
}
}
if (!strcmp(argv[1], "adc")) {
for (int i=0; i<NUMBER_ANALOG; i++) {
serialPrint("adc[%d] = %04X", i, Analog_values[i]);
}
}
else if (!strcmp(argv[1], "outputs")) {
for (int i=0; i<NUM_CHNOUT; i++) {
serialPrint("outputs[%d] = %04X", i, channelOutputs[i]);
}
}
else if (toInt(argv, 1, &address) > 0) {
int size = 256;
if (toInt(argv, 2, &size) >= 0) {
dump((uint8_t *)address, size);
}
}
return 0;
}
int cliHelp(const char ** argv);
const CliCommand cliCommands[] = {
{ "beep", cliBeep, "[<frequency>] [<duration>]" },
{ "ls", cliLs, "<directory>" },
{ "play", cliPlay, "<filename>" },
{ "print", cliDisplay, "<address> [<size>] | <what>" },
{ "stackinfo", cliStackInfo, "<tid>" },
{ "trace", cliTrace, "on | off" },
{ "volume", cliVolume, "<level>" },
{ "help", cliHelp, "[<command>]" },
{ NULL, NULL, NULL } /* sentinel */
};
int cliHelp(const char ** argv)
{
for (const CliCommand * command = cliCommands; command->name != NULL; command++) {
if (argv[1][0] == '\0' || !strcmp(command->name, argv[0])) {
serialPrint("%s %s", command->name, command->args);
if (argv[1][0] != '\0') {
return 0;
}
}
}
if (argv[1][0] != '\0') {
serialPrint("Invalid command \"%s\"", argv[0]);
}
return -1;
}
int cliExecCommand(const char ** argv)
{
if (argv[0][0] == '\0')
return 0;
for (const CliCommand * command = cliCommands; command->name != NULL; command++) {
if (!strcmp(command->name, argv[0])) {
return command->func(argv);
}
}
serialPrint("Invalid command \"%s\"", argv[0]);
return -1;
}
int cliExecLine(char * line)
{
int len = strlen(line);
const char * argv[CLI_COMMAND_MAX_ARGS];
memset(argv, 0, sizeof(argv));
int argc = 1;
argv[0] = line;
for (int i=0; i<len; i++) {
if (line[i] == ' ') {
line[i] = '\0';
if (argc < CLI_COMMAND_MAX_ARGS) {
argv[argc++] = &line[i+1];
}
}
}
return cliExecCommand(argv);
}
void cliTask(void * pdata)
{
char line[CLI_COMMAND_MAX_LEN+1];
int pos = 0;
cliPrompt();
for (;;) {
uint8_t c;
while (!cliRxFifo.pop(c)) {
CoTickDelay(10); // 20ms
}
if (c == 12) {
// clear screen
serialPrint("\033[2J\033[1;1H");
cliPrompt();
}
else if (c == 127) {
// backspace
if (pos) {
line[--pos] = '\0';
serialPutc(c);
}
}
else if (c == '\r' || c == '\n') {
// enter
serialCrlf();
line[pos] = '\0';
cliExecLine(line);
pos = 0;
cliPrompt();
}
else if (isascii(c) && pos < CLI_COMMAND_MAX_LEN) {
line[pos++] = c;
serialPutc(c);
}
}
}
void cliStart()
{
cliTaskId = CoCreateTaskEx(cliTask, NULL, 10, &cliStack.stack[CLI_STACK_SIZE-1], CLI_STACK_SIZE, 1, false);
}

54
radio/src/cli.h Normal file
View file

@ -0,0 +1,54 @@
/*
* Authors (alphabetical order)
* - Andre Bernet <bernet.andre@gmail.com>
* - Andreas Weitl
* - Bertrand Songis <bsongis@gmail.com>
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
* - Cameron Weeks <th9xer@gmail.com>
* - Erez Raviv
* - Gabriel Birkus
* - Jean-Pierre Parisy
* - Karl Szmutny
* - Michael Blandford
* - Michal Hlavinka
* - Pat Mackenzie
* - Philip Moss
* - Rob Thomson
* - Romolo Manfredini <romolo.manfredini@gmail.com>
* - Thomas Husterer
*
* opentx is based on code named
* gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/,
* er9x by Erez Raviv: http://code.google.com/p/er9x/,
* and the original (and ongoing) project by
* Thomas Husterer, th9x: http://code.google.com/p/th9x/
*
* 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.
*
*/
#ifndef _CLI_H_
#define _CLI_H_
#include "serial.h"
extern uint8_t cliTracesEnabled;
#ifdef __cplusplus
#include "fifo.h"
extern Fifo<256> cliRxFifo;
#include "tasks_arm.h"
#define CLI_STACK_SIZE 1000
extern TaskStack<CLI_STACK_SIZE> cliStack;
#endif
void cliStart();
#endif // _CLI_H_

View file

@ -34,225 +34,34 @@
*
*/
extern "C" {
#include <stdio.h>
#include <stdarg.h>
}
#include "opentx.h"
#if (defined(DEBUG) && defined(CPUARM)) || defined(SIMU)
#include <stdarg.h>
#if defined(SIMU)
traceCallbackFunc traceCallback = 0;
#endif
#if defined(SIMU)
#define PRINTF_BUFFER_SIZE 1024
#else
#define PRINTF_BUFFER_SIZE 256
#endif
// Outputs a string to the UART
void debugPuts(const char *format, ...)
#define PRINTF_BUFFER_SIZE 1024
void debugPrintf(const char * format, ...)
{
va_list arglist;
char tmp[PRINTF_BUFFER_SIZE];
va_start(arglist, format);
vsnprintf(tmp, PRINTF_BUFFER_SIZE, format, arglist);
va_end(arglist);
#if defined(SIMU)
fputs(tmp, stdout);
fflush(stdout);
if (traceCallback) {
traceCallback(tmp);
}
#else
const char *t = tmp;
while (*t) {
debugPutc(*t++);
}
}
#endif
}
void dump(unsigned char *data, unsigned int size)
{
debugPuts("DUMP %d bytes ...\n\r", size);
unsigned int i = 0, j=0;
while (i*32+j < size) {
debugPuts("%.2X ", data[i*32+j]);
j++;
if (j==32) {
i++; j=0;
debugPuts("\n\r");
}
}
debugPuts("\n\r");
}
#if !defined(SIMU)
uint32_t Mem_address ;
uint32_t Next_mem_address ;
uint32_t Memaddmode ;
Fifo<512> debugRxFifo;
void crlf()
{
debugPutc( 13 ) ;
debugPutc( 10 ) ;
}
// Send a single 4 bit value to the RS232 port as a hex digit
void hex_digit_send( unsigned char c )
{
c &= 0x0F ;
if ( c > 9 )
{
c += 7 ;
}
c += '0' ;
debugPutc( c ) ;
}
// Send the 8 bit value to the RS232 port as 2 hex digits
void p2hex( unsigned char c )
{
// asm("swap %c") ;
hex_digit_send( c >> 4 ) ;
// asm("swap %c") ;
hex_digit_send( c ) ;
}
// Send the 16 bit value to the RS232 port as 4 hex digits
void p4hex( uint16_t value )
{
p2hex( value >> 8 ) ;
p2hex( value ) ;
}
// Send the 32 bit value to the RS232 port as 8 hex digits
void p8hex( uint32_t value )
{
p4hex( value >> 16 ) ;
p4hex( value ) ;
}
static void dispw_256( register uint32_t address, register uint32_t lines )
{
register uint32_t i ;
register uint32_t j ;
address &= 0xFFFFFFFC ;
for ( i = 0 ; i < lines ; i += 1 )
{
p8hex( address ) ;
for ( j = 0 ; j < 4 ; j += 1 )
{
debugPutc(' ') ;
p8hex( *( (uint32_t *)address ) ) ;
address += 4 ;
}
crlf() ;
}
}
extern Fifo<512> uart3TxFifo;
void debugFlush()
{
uart3TxFifo.flush();
}
void debugTask(void* pdata)
{
uint8_t rxchar ;
TRACE("DEBUG Task started");
crlf() ;
dispw_256( (uint32_t)USART3, 4 ) ;
for (;;) {
while ( (USART3->SR & USART_SR_RXNE) == 0 )
CoTickDelay(5); // 10ms
rxchar = USART3->DR;
if ( Memaddmode )
{
if ( ( rxchar >= 'a' ) && ( rxchar <= 'f' ) )
{
rxchar -= 0x20; // toupper!
}
if ( ( ( rxchar >= '0' ) && ( rxchar <= '9' ) ) || ( ( rxchar >= 'A' ) && ( rxchar <= 'F' ) ) )
{
debugPutc( rxchar );
rxchar -= '0';
if ( rxchar > 9 )
{
rxchar -= 7;
}
Mem_address <<= 4;
Mem_address |= rxchar;
}
else if ( rxchar == 13 )
{
crlf();
if ( Mem_address == 0 )
{
Mem_address = Next_mem_address;
}
dispw_256( Mem_address, 4 );
Next_mem_address = Mem_address + 64;
Memaddmode = 0;
}
else if ( rxchar == 8 )
{
debugPutc( rxchar );
debugPutc( rxchar );
debugPutc( rxchar );
Mem_address >>= 4;
}
else if ( rxchar == 27 )
{
crlf();
Memaddmode = 0;
}
}
if ( rxchar == '?' )
{
Memaddmode = 1;
Mem_address = 0;
debugPutc( '>' );
}
if ( rxchar == 'm' )
{
crlf();
p8hex( (uint32_t) &g_model.moduleData[0] );
debugPutc( ' ' );
p8hex( (uint32_t) &g_model.moduleData[1] );
crlf();
}
}
}
#endif // #if !defined(SIMU)
#endif // #if (defined(DEBUG) && defined(CPUARM)) || defined(SIMU)
#if defined(DEBUG_TRACE_BUFFER)
static struct TraceElement traceBuffer[TRACE_BUFFER_LEN];
static uint8_t traceBufferPos;
extern Fifo<512> uart3TxFifo;
gtime_t filltm(gtime_t *t, struct gtm *tp);
void trace_event(enum TraceEvent event, uint32_t data)
@ -298,13 +107,11 @@ void dumpTraceBuffer()
TRACE(" %03d 0x%08x", traceBuffer[n].event, traceBuffer[n].data);
if (traceBuffer[n].time == 0 && traceBuffer[n].time_ms == 0) break;
if ((n % 5) == 0) {
while (!uart3TxFifo.empty()) {
while (!serial2TxFifo.empty()) {
CoTickDelay(1);
}
}
}
TRACE("End of Trace Buffer dump");
}
#endif

View file

@ -39,58 +39,42 @@
#include <inttypes.h>
#include "rtc.h"
#include "dump.h"
#if defined(CLI)
#include "cli.h"
#endif
#if (defined(DEBUG) && defined(CPUARM)) || defined(SIMU)
#ifdef __cplusplus
#if defined(__cplusplus)
extern "C" {
#endif
uint8_t serial2TracesEnabled();
#if defined(__cplusplus)
}
#endif
#if defined(SIMU)
typedef void (*traceCallbackFunc)(const char * text);
extern traceCallbackFunc traceCallback;
void debugPrintf(const char * format, ...);
#elif defined(DEBUG) && defined(CLI) && defined(USB_SERIAL)
#define debugPrintf(...) do { if (cliTracesEnabled) serialPrintf(__VA_ARGS__); } while(0)
#elif defined(DEBUG) && defined(CLI)
#define debugPrintf(...) do { if (serial2TracesEnabled() && cliTracesEnabled) serialPrintf(__VA_ARGS__); } while(0)
#elif defined(DEBUG) && defined(CPUARM)
#define debugPrintf(...) do { if (serial2TracesEnabled()) serialPrintf(__VA_ARGS__); } while(0)
#else
#define debugPrintf(...)
#endif
void debugPuts(const char *string, ...);
void dump(unsigned char *data, unsigned int size);
void debugFlush();
#ifdef __cplusplus
}
#endif
#define TRACE(...) do { debugPuts(__VA_ARGS__); debugPuts("\r\n"); } while(0)
#define TRACE(...) do { debugPrintf(__VA_ARGS__); debugPrintf("\r\n"); } while(0)
#define DUMP(data, size) dump(data, size)
#define TRACE_DEBUG(...) debugPuts("-D- " __VA_ARGS__)
#define TRACE_DEBUG_WP(...) debugPuts(__VA_ARGS__)
#define TRACE_INFO(...) debugPuts("-I- " __VA_ARGS__)
#define TRACE_INFO_WP(...) debugPuts(__VA_ARGS__)
#define TRACE_WARNING(...) debugPuts("-W- " __VA_ARGS__)
#define TRACE_WARNING_WP(...) debugPuts(__VA_ARGS__)
#define TRACE_ERROR(...) debugPuts("-E- " __VA_ARGS__)
#if !defined(SIMU)
#define FLUSH() debugFlush();
void debugTask(void* pdata);
#else
#define FLUSH()
#endif
#else
#define TRACE(...) { }
#define DUMP(...) { }
#define TRACE_DEBUG(...) { }
#define TRACE_DEBUG_WP(...) { }
#define TRACE_INFO(...) { }
#define TRACE_INFO_WP(...) { }
#define TRACE_WARNING(...) { }
#define TRACE_WARNING_WP(...) { }
#define TRACE_ERROR(...) { }
#define FLUSH()
#endif
#define TRACE_DEBUG(...) debugPrintf("-D- " __VA_ARGS__)
#define TRACE_DEBUG_WP(...) debugPrintf(__VA_ARGS__)
#define TRACE_INFO(...) debugPrintf("-I- " __VA_ARGS__)
#define TRACE_INFO_WP(...) debugPrintf(__VA_ARGS__)
#define TRACE_WARNING(...) debugPrintf("-W- " __VA_ARGS__)
#define TRACE_WARNING_WP(...) debugPrintf(__VA_ARGS__)
#define TRACE_ERROR(...) debugPrintf("-E- " __VA_ARGS__)
#if defined(DEBUG_TRACE_BUFFER)

38
radio/src/dump.cpp Normal file
View file

@ -0,0 +1,38 @@
#include "opentx.h"
#if defined(SIMU)
#define dumpPrintf(...) debugPrintf(__VA_ARGS__)
#else
#define dumpPrintf(...) serialPrintf(__VA_ARGS__)
#endif
uint8_t dumpPosition;
void dumpStart(unsigned int size)
{
dumpPrintf("DUMP %d bytes ...\n\r", size);
dumpPosition = 0;
}
void dumpBody(const uint8_t *data, unsigned int size)
{
for (unsigned int i=0; i<size; i++) {
dumpPrintf("%.2X ", data[i]);
dumpPosition++;
if ((dumpPosition & (32-1)) == 0) {
dumpPrintf("\r\n");
}
}
}
void dumpEnd()
{
dumpPrintf("\r\n");
}
void dump(const uint8_t *data, unsigned int size)
{
dumpStart(size);
dumpBody(data, size);
dumpEnd();
}

13
radio/src/dump.h Normal file
View file

@ -0,0 +1,13 @@
#ifndef _DUMP_H_
#define _DUMP_H_
#if defined(DEBUG) || defined(CLI)
void dumpStart(unsigned int size);
void dumpBody(const uint8_t * data, unsigned int size);
void dumpEnd();
void dump(const uint8_t * data, unsigned int size);
#else
#define dump(data, size)
#endif
#endif // _DUMP_H_

View file

@ -626,7 +626,7 @@ PACK(typedef struct {
int8_t currModel;
uint8_t contrast;
uint8_t vBatWarn;
int8_t vBatCalib;
int8_t txVoltageCalibration;
int8_t backlightMode;
TrainerData trainer;
uint8_t view; // index of view in main screen
@ -659,7 +659,7 @@ PACK(typedef struct {
int8_t vBatMin;
int8_t vBatMax;
uint8_t backlightBright;
int8_t currentCalib;
int8_t txCurrentCalibration;
int8_t temperatureWarn;
uint8_t mAhWarn;
uint16_t mAhUsed;
@ -908,7 +908,7 @@ void ConvertModel_216_to_217(ModelData &model)
if (oldModel.timers[i].mode >= TMRMODE_COUNT)
timer.mode = TMRMODE_COUNT + ConvertSwitch_216_to_217(oldModel.timers[i].mode - TMRMODE_COUNT + 1) - 1;
else
timer.mode = oldModel.timers[i].mode;
timer.mode = ConvertSwitch_216_to_217(oldModel.timers[i].mode);
timer.start = oldModel.timers[i].start;
timer.countdownBeep = oldModel.timers[i].countdownBeep;
timer.minuteBeep = oldModel.timers[i].minuteBeep;

View file

@ -370,6 +370,17 @@ void eeLoadModel(uint8_t id)
restoreTimers();
#if defined(CPUARM)
for (int i=0; i<MAX_SENSORS; i++) {
TelemetrySensor & sensor = g_model.telemetrySensors[i];
if (sensor.type == TELEM_TYPE_CALCULATED && sensor.persistent) {
telemetryItems[i].value = sensor.persistentValue;
}
}
#endif
LOAD_MODEL_CURVES();
resumeMixerCalculations();
// TODO pulses should be started after mixer calculations ...

View file

@ -56,7 +56,7 @@ class Fifo
}
bool pop(uint8_t & byte) {
if (empty()) {
if (isEmpty()) {
return false;
}
else {
@ -66,12 +66,17 @@ class Fifo
}
}
bool empty() {
bool isEmpty() {
return (ridx == widx);
}
bool isFull() {
uint32_t next = (widx+1) & (N-1);
return (next == ridx);
}
void flush() {
while (!empty()) {};
while (!isEmpty()) {};
}
protected:
@ -80,4 +85,4 @@ class Fifo
volatile uint32_t ridx;
};
#endif
#endif // _FIFO_H_

View file

@ -284,10 +284,10 @@ void evalFunctions()
#endif
for (uint8_t i=0; i<NUM_CFN; i++) {
const CustomFunctionData *cfn = &functions[i];
const CustomFunctionData * cfn = &functions[i];
int8_t swtch = CFN_SWITCH(cfn);
if (swtch) {
MASK_CFN_TYPE switch_mask = ((MASK_CFN_TYPE)1 << i);
MASK_CFN_TYPE switch_mask = ((MASK_CFN_TYPE)1 << i);
#if defined(CPUARM)
bool active = getSwitch(swtch, IS_PLAY_FUNC(CFN_FUNC(cfn)) ? GETSWITCH_MIDPOS_DELAY : 0);

View file

@ -140,7 +140,7 @@ enum SwitchContext
bool isSwitchAvailable(int swtch, SwitchContext context)
{
if (swtch < 0) {
if (swtch == -SWSRC_ON || swtch == -SWSRC_One) {
if (swtch == -SWSRC_ON || swtch == -SWSRC_ONE) {
return false;
}
swtch = -swtch;
@ -156,7 +156,7 @@ bool isSwitchAvailable(int swtch, SwitchContext context)
}
}
if (context != ModelCustomFunctionsContext && context != GeneralCustomFunctionsContext && (swtch == SWSRC_ON || swtch == SWSRC_One)) {
if (context != ModelCustomFunctionsContext && context != GeneralCustomFunctionsContext && (swtch == SWSRC_ON || swtch == SWSRC_ONE)) {
return false;
}

View file

@ -77,7 +77,7 @@ void menuGeneralDiagAna(uint8_t event)
lcd_putsLeft(MENU_HEADER_HEIGHT+1+4*FH, STR_BATT_CALIB);
static int32_t adcBatt;
adcBatt = ((adcBatt * 7) + anaIn(TX_VOLTAGE)) / 8;
uint32_t batCalV = (adcBatt + adcBatt*(g_eeGeneral.vBatCalib)/128) * 4191;
uint32_t batCalV = (adcBatt + adcBatt*(g_eeGeneral.txVoltageCalibration)/128) * 4191;
batCalV /= 55296;
putsVolts(LEN_CALIB_FIELDS*FW+4*FW, MENU_HEADER_HEIGHT+1+4*FH, batCalV, (m_posVert==1 ? INVERS : 0));
#elif defined(PCBGRUVIN9X)
@ -85,18 +85,18 @@ void menuGeneralDiagAna(uint8_t event)
// Gruvin wants 2 decimal places and instant update of volts calib field when button pressed
static uint16_t adcBatt;
adcBatt = ((adcBatt * 7) + anaIn(TX_VOLTAGE)) / 8; // running average, sourced directly (to avoid unending debate :P)
uint32_t batCalV = ((uint32_t)adcBatt*1390 + (10*(int32_t)adcBatt*g_eeGeneral.vBatCalib)/8) / BandGap;
uint32_t batCalV = ((uint32_t)adcBatt*1390 + (10*(int32_t)adcBatt*g_eeGeneral.txVoltageCalibration)/8) / BandGap;
lcd_outdezNAtt(LEN_CALIB_FIELDS*FW+4*FW, 6*FH-2, batCalV, PREC2|(m_posVert==1 ? INVERS : 0));
#else
lcd_putsLeft(6*FH-2, STR_BATT_CALIB);
putsVolts(LEN_CALIB_FIELDS*FW+4*FW, 6*FH-2, g_vbat100mV, (m_posVert==1 ? INVERS : 0));
#endif
if (m_posVert==1) CHECK_INCDEC_GENVAR(event, g_eeGeneral.vBatCalib, -127, 127);
if (m_posVert==1) CHECK_INCDEC_GENVAR(event, g_eeGeneral.txVoltageCalibration, -127, 127);
#if defined(PCBSKY9X) && !defined(REVA) && !defined(AR9X)
lcd_putsLeft(6*FH+1, STR_CURRENT_CALIB);
putsValueWithUnit(LEN_CALIB_FIELDS*FW+4*FW, 6*FH+1, getCurrent(), UNIT_MILLIAMPS, (m_posVert==2 ? INVERS : 0)) ;
if (m_posVert==2) CHECK_INCDEC_GENVAR(event, g_eeGeneral.currentCalib, -49, 49);
if (m_posVert==2) CHECK_INCDEC_GENVAR(event, g_eeGeneral.txCurrentCalibration, -49, 49);
#endif
#if defined(PCBSKY9X)

View file

@ -140,8 +140,9 @@ void menuModelLogicalSwitchOne(uint8_t event)
v1_min = SWSRC_OFF+1; v1_max = SWSRC_ON-1;
}
else if (cstate == LS_FAMILY_TIMER) {
lcd_outdezAtt(CSWONE_2ND_COLUMN, y, v1_val+1, LEFT|attr);
v1_max = 99;
lcd_outdezAtt(CSWONE_2ND_COLUMN, y, lswTimerValue(cs->v1), LEFT|PREC1|attr);
v1_min = -128;
v1_max = 122;
}
else {
v1_val = (uint8_t)cs->v1;
@ -163,8 +164,9 @@ void menuModelLogicalSwitchOne(uint8_t event)
v2_min = SWSRC_OFF+1; v2_max = SWSRC_ON-1;
}
else if (cstate == LS_FAMILY_TIMER) {
lcd_outdezAtt(CSWONE_2ND_COLUMN, y, cs->v2+1, LEFT|attr);
v2_max = 99;
lcd_outdezAtt(CSWONE_2ND_COLUMN, y, lswTimerValue(cs->v2), LEFT|PREC1|attr);
v2_min = -128;
v2_max = 122;
}
else if (cstate == LS_FAMILY_EDGE) {
putsEdgeDelayParam(CSWONE_2ND_COLUMN, y, cs, m_posHorz==0 ? attr : 0, m_posHorz==1 ? attr : 0);
@ -286,8 +288,8 @@ void menuModelLogicalSwitches(uint8_t event)
putsEdgeDelayParam(CSW_3RD_COLUMN, y, cs, 0, 0);
}
else if (cstate == LS_FAMILY_TIMER) {
lcd_outdezAtt(CSW_2ND_COLUMN, y, cs->v1+1, LEFT);
lcd_outdezAtt(CSW_3RD_COLUMN, y, cs->v2+1, LEFT);
lcd_outdezAtt(CSW_2ND_COLUMN, y, lswTimerValue(cs->v1), LEFT|PREC1);
lcd_outdezAtt(CSW_3RD_COLUMN, y, lswTimerValue(cs->v2), LEFT|PREC1);
}
else {
uint8_t v1 = cs->v1;

View file

@ -256,7 +256,7 @@ void menuModelSetup(uint8_t event)
case ITEM_MODEL_TIMER3_COUNTDOWN_BEEP:
{
TimerData * timer = &g_model.timers[k>=ITEM_MODEL_TIMER3 ? 2 : (k>=ITEM_MODEL_TIMER2 ? 1 : 0)];
timer->countdownBeep = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_BEEPCOUNTDOWN, STR_VBEEPCOUNTDOWN, timer->countdownBeep, 0, 2, attr, event);
timer->countdownBeep = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_BEEPCOUNTDOWN, STR_VBEEPCOUNTDOWN, timer->countdownBeep, COUNTDOWN_SILENT, COUNTDOWN_COUNT-1, attr, event);
break;
}

View file

@ -86,8 +86,10 @@ enum menuModelTelemetryItems {
ITEM_TELEMETRY_SENSOR30,
ITEM_TELEMETRY_SENSOR31,
ITEM_TELEMETRY_SENSOR32,
ITEM_TELEMETRY_NEWSENSOR,
ITEM_TELEMETRY_IGNORE_SENSORID,
ITEM_TELEMETRY_DISCOVER_SENSORS,
ITEM_TELEMETRY_NEW_SENSOR,
ITEM_TELEMETRY_DELETE_ALL_SENSORS,
ITEM_TELEMETRY_IGNORE_SENSOR_INSTANCE,
#endif
#if !defined(CPUARM)
#if defined(FRSKY_HUB) || defined(WS_HOW_HIGH)
@ -132,30 +134,30 @@ enum menuModelTelemetryItems {
};
#if defined(FRSKY)
#define TELEM_COL1 INDENT_WIDTH
#define TELEM_COL1 INDENT_WIDTH
#if defined(TRANSLATIONS_FR) || defined(TRANSLATIONS_CZ)
#define TELEM_COL2 (9*FW)
#define TELEM_COL2 (9*FW)
#else
#define TELEM_COL2 (8*FW)
#define TELEM_COL2 (8*FW)
#endif
#define TELEM_BARS_COLMIN (56-3*FW)
#define TELEM_BARS_COLMAX (14*FW-3)
#define TELEM_SCRTYPE_COL TELEM_COL2
#define TELEM_BARS_COLMIN (56-3*FW)
#define TELEM_BARS_COLMAX (14*FW-3)
#define TELEM_SCRTYPE_COL TELEM_COL2
#define IS_RANGE_DEFINED(k) (g_model.frsky.channels[k].ratio > 0)
#define IS_RANGE_DEFINED(k) (g_model.frsky.channels[k].ratio > 0)
#if defined(CPUARM)
#define CHANNELS_ROWS
#define SENSOR_ROWS(x) (isTelemetryFieldAvailable(x) ? (uint8_t)0 : HIDDEN_ROW)
#define SENSORS_ROWS LABEL(Sensors), SENSOR_ROWS(0), SENSOR_ROWS(1), SENSOR_ROWS(2), SENSOR_ROWS(3), SENSOR_ROWS(4), SENSOR_ROWS(5), SENSOR_ROWS(6), SENSOR_ROWS(7), SENSOR_ROWS(8), SENSOR_ROWS(9), SENSOR_ROWS(10), SENSOR_ROWS(11), SENSOR_ROWS(12), SENSOR_ROWS(13), SENSOR_ROWS(14), SENSOR_ROWS(15), SENSOR_ROWS(16), SENSOR_ROWS(17), SENSOR_ROWS(18), SENSOR_ROWS(19), SENSOR_ROWS(20), SENSOR_ROWS(21), SENSOR_ROWS(22), SENSOR_ROWS(23), SENSOR_ROWS(24), SENSOR_ROWS(25), SENSOR_ROWS(26), SENSOR_ROWS(27), SENSOR_ROWS(28), SENSOR_ROWS(29), SENSOR_ROWS(30), SENSOR_ROWS(31), 0, 0,
#define SENSOR_ROWS(x) (isTelemetryFieldAvailable(x) ? (uint8_t)0 : HIDDEN_ROW)
#define SENSORS_ROWS LABEL(Sensors), SENSOR_ROWS(0), SENSOR_ROWS(1), SENSOR_ROWS(2), SENSOR_ROWS(3), SENSOR_ROWS(4), SENSOR_ROWS(5), SENSOR_ROWS(6), SENSOR_ROWS(7), SENSOR_ROWS(8), SENSOR_ROWS(9), SENSOR_ROWS(10), SENSOR_ROWS(11), SENSOR_ROWS(12), SENSOR_ROWS(13), SENSOR_ROWS(14), SENSOR_ROWS(15), SENSOR_ROWS(16), SENSOR_ROWS(17), SENSOR_ROWS(18), SENSOR_ROWS(19), SENSOR_ROWS(20), SENSOR_ROWS(21), SENSOR_ROWS(22), SENSOR_ROWS(23), SENSOR_ROWS(24), SENSOR_ROWS(25), SENSOR_ROWS(26), SENSOR_ROWS(27), SENSOR_ROWS(28), SENSOR_ROWS(29), SENSOR_ROWS(30), SENSOR_ROWS(31), 0, 0, 0, 0,
#else
#define CHANNEL_ROWS(x) LABEL(CHANNEL), 1, 0, 2, 2
#define CHANNELS_ROWS CHANNEL_ROWS(0), CHANNEL_ROWS(1),
#define CHANNEL_ROWS(x) LABEL(CHANNEL), 1, 0, 2, 2
#define CHANNELS_ROWS CHANNEL_ROWS(0), CHANNEL_ROWS(1),
#define SENSORS_ROWS
#endif
#if defined(FAS_OFFSET) || !defined(CPUM64)
#define IF_FAS_OFFSET(x) x,
#define IF_FAS_OFFSET(x) x,
#else
#define IF_FAS_OFFSET(x)
#endif
@ -163,38 +165,38 @@ enum menuModelTelemetryItems {
#if defined(CPUARM)
#define USRDATA_ROWS
#elif defined(FRSKY_HUB) || defined(WS_HOW_HIGH)
#define USRDATA_ROWS LABEL(UsrData), 0, 0, 0, 0, IF_FAS_OFFSET(0)
#define USRDATA_ROWS LABEL(UsrData), 0, 0, 0, 0, IF_FAS_OFFSET(0)
#else
#define USRDATA_ROWS 0, 0, IF_FAS_OFFSET(0)
#define USRDATA_ROWS 0, 0, IF_FAS_OFFSET(0)
#endif
#define RSSI_ROWS LABEL(RSSI), 1, 1,
#define RSSI_ROWS LABEL(RSSI), 1, 1,
#if defined(CPUARM) || defined(GAUGES)
#define SCREEN_TYPE_ROWS 0
#define SCREEN_TYPE_ROWS 0
#else
#define SCREEN_TYPE_ROWS LABEL(SCREEN)
#define SCREEN_TYPE_ROWS LABEL(SCREEN)
#endif
#if defined(PCBSTD)
#define VARIO_RANGE_ROWS 1
#define VARIO_RANGE_ROWS 1
#else
#define VARIO_RANGE_ROWS 3
#define VARIO_RANGE_ROWS 3
#endif
#if defined(CPUARM)
#define TELEMETRY_TYPE_ROWS 0,
#define TELEMETRY_TYPE_ROWS 0,
#else
#define TELEMETRY_TYPE_ROWS
#endif
#if defined(CPUARM)
#define TELEMETRY_SCREEN_LINE(x) (TELEMETRY_SCREEN_TYPE(x) == TELEMETRY_SCREEN_TYPE_NONE ? HIDDEN_ROW : (uint8_t)2)
#define TELEMETRY_SCREEN_ROWS(x) SCREEN_TYPE_ROWS, TELEMETRY_SCREEN_LINE(x), TELEMETRY_SCREEN_LINE(x), TELEMETRY_SCREEN_LINE(x), TELEMETRY_SCREEN_LINE(x)
#define TELEMETRY_CURRENT_EDIT_SCREEN(k) (k < ITEM_TELEMETRY_SCREEN_LABEL2 ? 0 : (k < ITEM_TELEMETRY_SCREEN_LABEL3 ? 1 : (k < ITEM_TELEMETRY_SCREEN_LABEL4 ? 2 : 3)))
#define TELEMETRY_SCREEN_LINE(x) (TELEMETRY_SCREEN_TYPE(x) == TELEMETRY_SCREEN_TYPE_NONE ? HIDDEN_ROW : (uint8_t)2)
#define TELEMETRY_SCREEN_ROWS(x) SCREEN_TYPE_ROWS, TELEMETRY_SCREEN_LINE(x), TELEMETRY_SCREEN_LINE(x), TELEMETRY_SCREEN_LINE(x), TELEMETRY_SCREEN_LINE(x)
#define TELEMETRY_CURRENT_SCREEN(k) (k < ITEM_TELEMETRY_SCREEN_LABEL2 ? 0 : (k < ITEM_TELEMETRY_SCREEN_LABEL3 ? 1 : (k < ITEM_TELEMETRY_SCREEN_LABEL4 ? 2 : 3)))
#else
#define TELEMETRY_SCREEN_ROWS(x) SCREEN_TYPE_ROWS, 2, 2, 2, 2
#define TELEMETRY_CURRENT_EDIT_CHANNEL(k) (k >= ITEM_TELEMETRY_A2_LABEL ? TELEM_ANA_A2 : TELEM_ANA_A1)
#define TELEMETRY_SCREEN_ROWS(x) SCREEN_TYPE_ROWS, 2, 2, 2, 2
#define TELEMETRY_CURRENT_CHANNEL(k) (k >= ITEM_TELEMETRY_A2_LABEL ? TELEM_ANA_A2 : TELEM_ANA_A1)
#endif
#if defined(CPUARM)
@ -497,7 +499,7 @@ void onSensorMenu(const char *result)
if (index<MAX_SENSORS && isTelemetryFieldAvailable(index))
m_posVert += 1;
else
m_posVert = 1+ITEM_TELEMETRY_NEWSENSOR;
m_posVert = 1+ITEM_TELEMETRY_NEW_SENSOR;
}
else if (result == STR_COPY) {
int newIndex = availableTelemetryIndex();
@ -521,6 +523,15 @@ void onSensorMenu(const char *result)
void menuModelTelemetry(uint8_t event)
{
#if defined(CPUARM)
if (s_warning_result) {
s_warning_result = 0;
for (int i=0; i<MAX_SENSORS; i++) {
delTelemetryIndex(i);
}
}
#endif
MENU(STR_MENUTELEMETRY, menuTabModel, e_Telemetry, ITEM_TELEMETRY_MAX+1, {0, TELEMETRY_TYPE_ROWS CHANNELS_ROWS RSSI_ROWS SENSORS_ROWS USRDATA_ROWS CASE_VARIO(LABEL(Vario)) CASE_VARIO(0) CASE_VARIO(VARIO_RANGE_ROWS) TELEMETRY_SCREEN_ROWS(0), TELEMETRY_SCREEN_ROWS(1), CASE_CPUARM(TELEMETRY_SCREEN_ROWS(2)) CASE_CPUARM(TELEMETRY_SCREEN_ROWS(3))});
uint8_t sub = m_posVert - 1;
@ -549,7 +560,7 @@ void menuModelTelemetry(uint8_t event)
uint8_t attr = (sub == k ? blink : 0);
#if !defined(CPUARM)
uint8_t ch = TELEMETRY_CURRENT_EDIT_CHANNEL(k);
uint8_t ch = TELEMETRY_CURRENT_CHANNEL(k);
FrSkyChannelData & channel = g_model.frsky.channels[ch];
uint8_t dest = TELEM_A1-1+ch;
#endif
@ -604,7 +615,15 @@ void menuModelTelemetry(uint8_t event)
lcd_putsLeft(y, STR_TELEMETRY_SENSORS);
break;
case ITEM_TELEMETRY_NEWSENSOR:
case ITEM_TELEMETRY_DISCOVER_SENSORS:
lcd_putsAtt(0, y, allowNewSensors ? STR_STOP_DISCOVER_SENSORS : STR_DISCOVER_SENSORS, attr);
if (attr && event==EVT_KEY_BREAK(KEY_ENTER)) {
s_editMode = 0;
allowNewSensors = !allowNewSensors;
}
break;
case ITEM_TELEMETRY_NEW_SENSOR:
lcd_putsAtt(0, y, STR_TELEMETRY_NEWSENSOR, attr);
if (attr && event==EVT_KEY_BREAK(KEY_ENTER)) {
s_editMode = 0;
@ -618,9 +637,18 @@ void menuModelTelemetry(uint8_t event)
}
}
break;
case ITEM_TELEMETRY_IGNORE_SENSORID:
ON_OFF_MENU_ITEM(g_model.ignoreSensorIds, TELEM_COL2, y, STR_IGNOREIDS, attr, event);
case ITEM_TELEMETRY_DELETE_ALL_SENSORS:
lcd_putsAtt(0, y, STR_DELETE_ALL_SENSORS, attr);
s_editMode = 0;
if (attr && event==EVT_KEY_LONG(KEY_ENTER)) {
killEvents(KEY_ENTER);
POPUP_CONFIRMATION(STR_CONFIRMDELETE);
}
break;
case ITEM_TELEMETRY_IGNORE_SENSOR_INSTANCE:
ON_OFF_MENU_ITEM(g_model.ignoreSensorIds, TELEM_COL2, y, STR_IGNORE_INSTANCE, attr, event);
break;
#endif
@ -830,7 +858,7 @@ void menuModelTelemetry(uint8_t event)
case ITEM_TELEMETRY_SCREEN_LABEL3:
case ITEM_TELEMETRY_SCREEN_LABEL4:
{
uint8_t screenIndex = TELEMETRY_CURRENT_EDIT_SCREEN(k);
uint8_t screenIndex = TELEMETRY_CURRENT_SCREEN(k);
putsStrIdx(0*FW, y, STR_SCREEN, screenIndex+1);
TelemetryScreenType oldScreenType = TELEMETRY_SCREEN_TYPE(screenIndex);
TelemetryScreenType newScreenType = (TelemetryScreenType)selectMenuItem(TELEM_SCRTYPE_COL, y, PSTR(""), STR_VTELEMSCREENTYPE, oldScreenType, 0, TELEMETRY_SCREEN_TYPE_MAX, (m_posHorz==0 ? attr : 0), event);
@ -900,8 +928,14 @@ void menuModelTelemetry(uint8_t event)
#if defined(CPUARM)
putsMixerSource(TELEM_COL1, y, barSource, m_posHorz==0 ? attr : 0);
if (barSource) {
putsChannelValue(TELEM_BARS_COLMIN, y, barSource, bar.barMin, (m_posHorz==1 ? attr : 0) | LEFT);
putsChannelValue(TELEM_BARS_COLMAX, y, barSource, bar.barMax, (m_posHorz==2 ? attr : 0) | LEFT);
if (barSource <= MIXSRC_LAST_CH) {
putsChannelValue(TELEM_BARS_COLMIN, y, barSource, calc100toRESX(bar.barMin), (m_posHorz==1 ? attr : 0) | LEFT);
putsChannelValue(TELEM_BARS_COLMAX, y, barSource, calc100toRESX(bar.barMax), (m_posHorz==2 ? attr : 0) | LEFT);
}
else {
putsChannelValue(TELEM_BARS_COLMIN, y, barSource, bar.barMin, (m_posHorz==1 ? attr : 0) | LEFT);
putsChannelValue(TELEM_BARS_COLMAX, y, barSource, bar.barMax, (m_posHorz==2 ? attr : 0) | LEFT);
}
}
#else
lcd_putsiAtt(TELEM_COL1, y, STR_VTELEMCHNS, barSource, m_posHorz==0 ? attr : 0);

View file

@ -629,37 +629,62 @@ void check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
}
#if defined(CPUARM)
if (l_posVert<1) {
s_pgOfs=0;
}
else if (menuTab && horTab) {
vertpos_t realPosVert = l_posVert;
vertpos_t realPgOfs = s_pgOfs;
vertpos_t realMaxrow = maxrow;
for (vertpos_t i=1; i<=maxrow; i++) {
if (MAXCOL(i) == HIDDEN_ROW) {
realMaxrow--;
if (i < l_posVert)
realPosVert--;
if (i < s_pgOfs)
realPgOfs--;
int linesCount = maxrow;
if (l_posVert == 0 || (l_posVert==1 && MAXCOL(vertpos_t(0)) >= HIDDEN_ROW) || (l_posVert==2 && MAXCOL(vertpos_t(0)) >= HIDDEN_ROW && MAXCOL(vertpos_t(1)) >= HIDDEN_ROW)) {
s_pgOfs = 0;
if (horTab) {
linesCount = 0;
for (int i=0; i<maxrow; i++) {
if (i>=horTabMax || horTab[i] != HIDDEN_ROW) {
linesCount++;
}
}
}
}
if (realPosVert>(LCD_LINES-1)+realPgOfs) realPgOfs = realPosVert-(LCD_LINES-1);
else if (realPosVert<1+realPgOfs) realPgOfs = realPosVert-1;
s_pgOfs = realPgOfs;
for (vertpos_t i=1; i<=realPgOfs; i++) {
if (MAXCOL(i) == HIDDEN_ROW) {
s_pgOfs++;
else if (horTab) {
if (maxrow > NUM_BODY_LINES) {
while (1) {
vertpos_t firstLine = 0;
for (int numLines=0; firstLine<maxrow && numLines<s_pgOfs; firstLine++) {
if (firstLine>=horTabMax || horTab[firstLine+1] != HIDDEN_ROW) {
numLines++;
}
}
if (l_posVert <= firstLine) {
s_pgOfs--;
}
else {
vertpos_t lastLine = firstLine;
for (int numLines=0; lastLine<maxrow && numLines<NUM_BODY_LINES; lastLine++) {
if (lastLine>=horTabMax || horTab[lastLine+1] != HIDDEN_ROW) {
numLines++;
}
}
if (l_posVert > lastLine) {
s_pgOfs++;
}
else {
linesCount = s_pgOfs + NUM_BODY_LINES;
for (int i=lastLine; i<maxrow; i++) {
if (i>=horTabMax || horTab[i] != HIDDEN_ROW) {
linesCount++;
}
}
break;
}
}
}
}
}
else {
if (l_posVert>NUM_BODY_LINES+s_pgOfs) {
s_pgOfs = l_posVert-NUM_BODY_LINES;
}
else if (l_posVert<=s_pgOfs) {
s_pgOfs = l_posVert-1;
}
}
maxrow = realMaxrow;
}
else {
uint8_t max = menuTab ? LCD_LINES-1 : LCD_LINES-2;
if (l_posVert>max+s_pgOfs) s_pgOfs = l_posVert-max;
else if (l_posVert<1+s_pgOfs) s_pgOfs = l_posVert-1;
}
#else
uint8_t max = menuTab ? LCD_LINES-1 : LCD_LINES-2;
if (l_posVert<1) s_pgOfs=0;

View file

@ -226,8 +226,8 @@ void displayVoltageOrAlarm()
if (g_eeGeneral.temperatureWarn && getTemperature() >= g_eeGeneral.temperatureWarn) {
putsValueWithUnit(6*FW-1, 2*FH, getTemperature(), UNIT_TEMPERATURE, BLINK|INVERS|DBLSIZE);
}
else if (g_eeGeneral.mAhWarn && (g_eeGeneral.mAhUsed + Current_used * (488 + g_eeGeneral.currentCalib)/8192/36) / 500 >= g_eeGeneral.mAhWarn) {
putsValueWithUnit(7*FW-1, 2*FH, (g_eeGeneral.mAhUsed + Current_used*(488 + g_eeGeneral.currentCalib)/8192/36)/10, UNIT_MAH, BLINK|INVERS|DBLSIZE);
else if (g_eeGeneral.mAhWarn && (g_eeGeneral.mAhUsed + Current_used * (488 + g_eeGeneral.txCurrentCalibration)/8192/36) / 500 >= g_eeGeneral.mAhWarn) {
putsValueWithUnit(7*FW-1, 2*FH, (g_eeGeneral.mAhUsed + Current_used*(488 + g_eeGeneral.txCurrentCalibration)/8192/36)/10, UNIT_MAH, BLINK|INVERS|DBLSIZE);
}
else {
displayBattVoltage();

View file

@ -46,7 +46,7 @@
#include "opentx.h"
#include "telemetry/mavlink.h"
#include "gui/9X/menus.h"
#include "serial.h"
#include "targets/common_avr/serial_driver.h"
#define APSIZE (BSS | DBLSIZE)

View file

@ -155,7 +155,7 @@ void menuStatisticsDebug(uint8_t event)
// current
lcd_putsLeft(MENU_DEBUG_Y_CURRENT, STR_CPU_CURRENT);
putsValueWithUnit(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_CURRENT, getCurrent(), UNIT_MILLIAMPS, LEFT);
uint32_t current_scale = 488 + g_eeGeneral.currentCalib;
uint32_t current_scale = 488 + g_eeGeneral.txCurrentCalibration;
lcd_putc(MENU_DEBUG_COL2_OFS, MENU_DEBUG_Y_CURRENT, '>');
putsValueWithUnit(MENU_DEBUG_COL2_OFS+FW+1, MENU_DEBUG_Y_CURRENT, Current_max*10*current_scale/8192, UNIT_RAW, LEFT);
// consumption
@ -196,11 +196,11 @@ void menuStatisticsDebug(uint8_t event)
#if defined(CPUARM)
lcd_putsLeft(MENU_DEBUG_Y_RTOS, STR_FREESTACKMINB);
lcd_outdezAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_RTOS+2, stack_free(0), UNSIGN|LEFT|TINSIZE);
lcd_outdezAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_RTOS+2, menusStack.available(), UNSIGN|LEFT|TINSIZE);
lcd_puts(lcdLastPos, MENU_DEBUG_Y_RTOS, "/");
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS+2, stack_free(1), UNSIGN|LEFT|TINSIZE);
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS+2, mixerStack.available(), UNSIGN|LEFT|TINSIZE);
lcd_puts(lcdLastPos, MENU_DEBUG_Y_RTOS, "/");
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS+2, stack_free(2), UNSIGN|LEFT|TINSIZE);
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS+2, audioStack.available(), UNSIGN|LEFT|TINSIZE);
#endif
#if !defined(CPUARM)
@ -213,7 +213,7 @@ void menuStatisticsDebug(uint8_t event)
lcd_putsLeft(4*FH, STR_TMIXMAXMS);
lcd_outdezAtt(MENU_DEBUG_COL1_OFS, 4*FH, DURATION_MS_PREC2(maxMixerDuration), PREC2);
lcd_putsLeft(5*FH, STR_FREESTACKMINB);
lcd_outdezAtt(14*FW, 5*FH, stack_free(), UNSIGN) ;
lcd_outdezAtt(14*FW, 5*FH, stackAvailable(), UNSIGN) ;
#endif
lcd_puts(4*FW, 7*FH+1, STR_MENUTORESET);

View file

@ -246,6 +246,10 @@ bool displayGaugesTelemetryScreen(FrSkyScreenData & screen)
#if defined(CPUARM)
getvalue_t barMin = bar.barMin;
getvalue_t barMax = bar.barMax;
if (source <= MIXSRC_LAST_CH) {
barMin = calc100toRESX(barMin);
barMax = calc100toRESX(barMax);
}
#else
getvalue_t barMin = convertBarTelemValue(source, bar.barMin);
getvalue_t barMax = convertBarTelemValue(source, 255-bar.barMax);

View file

@ -203,7 +203,7 @@ bool isSwitchAvailable(int swtch, SwitchContext context)
if (swtch < 0) {
negative = true;
if (swtch == -SWSRC_ON || swtch == -SWSRC_One) {
if (swtch == -SWSRC_ON || swtch == -SWSRC_ONE) {
return false;
}
swtch = -swtch;
@ -245,7 +245,7 @@ bool isSwitchAvailable(int swtch, SwitchContext context)
}
}
if (context != ModelCustomFunctionsContext && context != GeneralCustomFunctionsContext && (swtch == SWSRC_ON || swtch == SWSRC_One)) {
if (context != ModelCustomFunctionsContext && context != GeneralCustomFunctionsContext && (swtch == SWSRC_ON || swtch == SWSRC_ONE)) {
return false;
}

View file

@ -674,7 +674,7 @@ void putsMixerSource(coord_t x, coord_t y, uint32_t idx, LcdFlags att)
else
lcd_putsiAtt(x, y, STR_VSRCRAW, idx+1, att);
}
else if (idx >= MIXSRC_FIRST_SWITCH && idx < MIXSRC_FIRST_LOGICAL_SWITCH) {
else if (idx >= MIXSRC_FIRST_SWITCH && idx <= MIXSRC_LAST_SWITCH) {
idx = idx-MIXSRC_FIRST_SWITCH;
if (ZEXIST(g_eeGeneral.switchNames[idx])) {
lcd_putcAtt(x, y, '\312', att); //switch symbol
@ -692,8 +692,8 @@ void putsMixerSource(coord_t x, coord_t y, uint32_t idx, LcdFlags att)
else if (idx <= MIXSRC_LAST_CH) {
putsStrIdx(x, y, STR_CH, idx-MIXSRC_CH1+1, att);
if (ZEXIST(g_model.limitData[idx-MIXSRC_CH1].name) && (att & STREXPANDED)) {
lcd_putcAtt(lcdLastPos, y, ' ', att);
lcd_putsnAtt(lcdLastPos+3, y, g_model.limitData[idx-MIXSRC_CH1].name, LEN_CHANNEL_NAME, ZCHAR|att);
lcd_putcAtt(lcdLastPos, y, ' ', att|SMLSIZE);
lcd_putsnAtt(lcdLastPos+3, y, g_model.limitData[idx-MIXSRC_CH1].name, LEN_CHANNEL_NAME, ZCHAR|att|SMLSIZE);
}
}
else if (idx <= MIXSRC_LAST_GVAR)
@ -727,29 +727,48 @@ void putsModelName(coord_t x, coord_t y, char *name, uint8_t id, LcdFlags att)
}
}
void putsSwitches(coord_t x, coord_t y, int8_t idx, LcdFlags att)
void putsSwitches(coord_t x, coord_t y, int32_t idx, LcdFlags att)
{
if (idx == SWSRC_OFF)
if (idx == SWSRC_NONE) {
return lcd_putsiAtt(x, y, STR_VSWITCHES, 0, att);
}
else if (idx == SWSRC_OFF) {
return lcd_putsiAtt(x, y, STR_OFFON, 0, att);
}
if (idx < 0) {
lcd_putcAtt(x-2, y, '!', att);
idx = -idx;
}
#if defined(FLIGHT_MODES)
if (idx >= SWSRC_FIRST_FLIGHT_MODE) {
return putsStrIdx(x, y, STR_FP, idx-SWSRC_FIRST_FLIGHT_MODE, att);
}
#endif
if (idx >= SWSRC_FIRST_SWITCH && idx <= SWSRC_LAST_SWITCH) {
if (idx <= SWSRC_LAST_SWITCH) {
div_t swinfo = switchInfo(idx);
if (ZEXIST(g_eeGeneral.switchNames[swinfo.quot])) {
lcd_putsnAtt(x, y, g_eeGeneral.switchNames[swinfo.quot], LEN_SWITCH_NAME, ZCHAR|att);
char c = "\300-\301"[swinfo.rem];
lcd_putcAtt(lcdNextPos, y, c, att);
return;
}
else {
lcd_putcAtt(x, y, 'S', att);
lcd_putcAtt(lcdNextPos, y, 'A'+swinfo.quot, att);
}
char c = "\300-\301"[swinfo.rem];
lcd_putcAtt(lcdNextPos, y, c, att);
}
else if (idx <= SWSRC_LAST_MULTIPOS_SWITCH) {
div_t swinfo = div(idx - SWSRC_FIRST_MULTIPOS_SWITCH, XPOTS_MULTIPOS_COUNT);
putsStrIdx(x, y, "S", swinfo.quot*10+swinfo.rem+11, att);
}
else if (idx <= SWSRC_LAST_TRIM) {
lcd_putsiAtt(x, y, STR_VSWITCHES, idx-SWSRC_FIRST_TRIM+1, att);
}
else if (idx <= SWSRC_LAST_LOGICAL_SWITCH) {
putsStrIdx(x, y, "L", idx-SWSRC_FIRST_LOGICAL_SWITCH+1, att);
}
else if (idx <= SWSRC_ONE) {
lcd_putsiAtt(x, y, STR_VSWITCHES, idx-SWSRC_ON+1+(2*NUM_STICKS), att);
}
else {
putsStrIdx(x, y, STR_FP, idx-SWSRC_FIRST_FLIGHT_MODE, att);
}
return lcd_putsiAtt(x, y, STR_VSWITCHES, idx, att);
}
#if defined(FLIGHT_MODES)
@ -803,7 +822,7 @@ void putsCurve(coord_t x, coord_t y, int8_t idx, LcdFlags att)
putsStrIdx(x, y, STR_CV, idx, att);
}
void putsTimerMode(coord_t x, coord_t y, int8_t mode, LcdFlags att)
void putsTimerMode(coord_t x, coord_t y, int32_t mode, LcdFlags att)
{
if (mode >= 0) {
if (mode < TMRMODE_COUNT)

View file

@ -167,7 +167,7 @@ void lcd_outdez8(coord_t x, coord_t y, int8_t val);
void putsStrIdx(coord_t x, coord_t y, const pm_char *str, uint8_t idx, LcdFlags att=0);
void putsModelName(coord_t x, coord_t y, char *name, uint8_t id, LcdFlags att);
void putsSwitches(coord_t x, coord_t y, int8_t swtch, LcdFlags att=0);
void putsSwitches(coord_t x, coord_t y, int32_t swtch, LcdFlags att=0);
void putsStickName(coord_t x, coord_t y, uint8_t idx, LcdFlags att=0);
void putsMixerSource(coord_t x, coord_t y, uint32_t idx, LcdFlags att=0);
void putsFlightMode(coord_t x, coord_t y, int8_t idx, LcdFlags att=0);
@ -175,7 +175,7 @@ void putsFlightMode(coord_t x, coord_t y, int8_t idx, LcdFlags att=0);
void putsCurveRef(coord_t x, coord_t y, CurveRef &curve, LcdFlags att);
#endif
void putsCurve(coord_t x, coord_t y, int8_t idx, LcdFlags att=0);
void putsTimerMode(coord_t x, coord_t y, int8_t mode, LcdFlags att=0);
void putsTimerMode(coord_t x, coord_t y, int32_t mode, LcdFlags att=0);
void putsTrimMode(coord_t x, coord_t y, uint8_t phase, uint8_t idx, LcdFlags att);
#define putsChn(x, y, idx, att) putsMixerSource(x, y, MIXSRC_CH1+idx-1, att)

View file

@ -62,9 +62,9 @@ void menuGeneralDiagAna(uint8_t event)
lcd_putsLeft(MENU_HEADER_HEIGHT+1+5*FH, STR_BATT_CALIB);
static int32_t adcBatt;
adcBatt = ((adcBatt * 7) + anaIn(TX_VOLTAGE)) / 8;
uint32_t batCalV = (adcBatt + (adcBatt*g_eeGeneral.vBatCalib)/128) * BATT_SCALE;
uint32_t batCalV = (adcBatt + (adcBatt*g_eeGeneral.txVoltageCalibration)/128) * BATT_SCALE;
batCalV >>= 11;
batCalV += 2; // because of the diode
putsVolts(LEN_CALIB_FIELDS*FW+4*FW, MENU_HEADER_HEIGHT+1+5*FH, batCalV, s_editMode > 0 ? BLINK|INVERS : INVERS);
if (s_editMode > 0) CHECK_INCDEC_GENVAR(event, g_eeGeneral.vBatCalib, -127, 127);
if (s_editMode > 0) CHECK_INCDEC_GENVAR(event, g_eeGeneral.txVoltageCalibration, -127, 127);
}

View file

@ -219,9 +219,9 @@ void menuGeneralHardware(uint8_t event)
break;
#endif
case ITEM_SETUP_HW_UART3_MODE:
g_eeGeneral.uart3Mode = selectMenuItem(HW_SETTINGS_COLUMN, y, STR_UART3MODE, STR_UART3MODES, g_eeGeneral.uart3Mode, 0, UART_MODE_MAX, attr, event);
g_eeGeneral.serial2Mode = selectMenuItem(HW_SETTINGS_COLUMN, y, STR_UART3MODE, STR_UART3MODES, g_eeGeneral.serial2Mode, 0, UART_MODE_MAX, attr, event);
if (attr && checkIncDec_Ret) {
uart3Init(g_eeGeneral.uart3Mode, MODEL_TELEMETRY_PROTOCOL());
serial2Init(g_eeGeneral.serial2Mode, MODEL_TELEMETRY_PROTOCOL());
}
break;
}

View file

@ -121,6 +121,35 @@ void onCustomFunctionsMenu(const char *result)
}
}
void onAdjustGvarSourceLongEnterPress(const char * result)
{
CustomFunctionData * cfn = &g_model.customFn[m_posVert];
if (result == STR_CONSTANT) {
CFN_GVAR_MODE(cfn) = FUNC_ADJUST_GVAR_CONSTANT;
CFN_PARAM(cfn) = 0;
eeDirty(EE_MODEL);
}
else if (result == STR_MIXSOURCE) {
CFN_GVAR_MODE(cfn) = FUNC_ADJUST_GVAR_SOURCE;
CFN_PARAM(cfn) = 0;
eeDirty(EE_MODEL);
}
else if (result == STR_GLOBALVAR) {
CFN_GVAR_MODE(cfn) = FUNC_ADJUST_GVAR_GVAR;
CFN_PARAM(cfn) = 0;
eeDirty(EE_MODEL);
}
else if (result == STR_INCDEC) {
CFN_GVAR_MODE(cfn) = FUNC_ADJUST_GVAR_INC;
CFN_PARAM(cfn) = 0;
eeDirty(EE_MODEL);
}
else {
onSourceLongEnterPress(result);
}
}
void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFunctionsContext * functionsContext)
{
int sub = m_posVert;
@ -325,8 +354,7 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
case FUNC_ADJUST_GVAR_SOURCE:
val_max = MIXSRC_LAST_CH;
putsMixerSource(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, val_displayed, attr);
// TODO later, we have a conflict on [Enter Long] here ...
// INCDEC_SET_FLAG(eeFlags | INCDEC_SOURCE);
INCDEC_SET_FLAG(eeFlags | INCDEC_SOURCE);
INCDEC_ENABLE_CHECK(isSourceAvailable);
break;
case FUNC_ADJUST_GVAR_GVAR:
@ -334,27 +362,39 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
putsStrIdx(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, STR_GV, val_displayed+1, attr);
break;
default: // FUNC_ADJUST_GVAR_INC
#if 0 // TODO 2.2.X
val_min = -100; val_max = +100;
if (val_displayed < 0)
lcd_putsAtt(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, "-=", attr);
else
lcd_putsAtt(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, "+=", attr);
lcd_outdezAtt(lcdNextPos, y, abs(val_displayed), attr|LEFT);
#endif
val_max = 1;
lcd_putsiAtt(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, PSTR("\003-=1+=1"), val_displayed, attr);
break;
}
if (attr && event==EVT_KEY_LONG(KEY_ENTER)) {
killEvents(event);
s_editMode = !s_editMode;
active = true;
CFN_GVAR_MODE(cfn) += 1;
CFN_GVAR_MODE(cfn) &= 0x03;
val_displayed = 0;
}
}
#endif
else if (attr) {
REPEAT_LAST_CURSOR_MOVE();
}
if (active) {
if (active || event==EVT_KEY_LONG(KEY_ENTER)) {
CFN_PARAM(cfn) = CHECK_INCDEC_PARAM(event, val_displayed, val_min, val_max);
if (attr && event==EVT_KEY_LONG(KEY_ENTER)) {
killEvents(event);
if (CFN_GVAR_MODE(cfn) != FUNC_ADJUST_GVAR_CONSTANT)
MENU_ADD_ITEM(STR_CONSTANT);
if (CFN_GVAR_MODE(cfn) != FUNC_ADJUST_GVAR_SOURCE)
MENU_ADD_ITEM(STR_MIXSOURCE);
if (CFN_GVAR_MODE(cfn) != FUNC_ADJUST_GVAR_GVAR)
MENU_ADD_ITEM(STR_GLOBALVAR);
if (CFN_GVAR_MODE(cfn) != FUNC_ADJUST_GVAR_INC)
MENU_ADD_ITEM(STR_INCDEC);
menuHandler = onAdjustGvarSourceLongEnterPress;
s_editMode = EDIT_MODIFY_FIELD;
}
}
break;
}

View file

@ -88,7 +88,7 @@ void DrawFunction(FnFuncP fn, uint8_t offset)
coord_t prev_yv = (coord_t)-1;
for (int8_t xv=-WCHART; xv<=WCHART; xv++) {
for (int xv=-WCHART; xv<=WCHART; xv++) {
coord_t yv = (LCD_H-1) - (((uint16_t)RESX + fn(xv * (RESX/WCHART))) / 2 * (LCD_H-1) / RESX);
if (prev_yv != (coord_t)-1) {
if (abs((int8_t)yv-prev_yv) <= 1) {
@ -108,7 +108,7 @@ uint8_t getExpoMixCount(uint8_t expo)
uint8_t count = 0;
uint8_t ch ;
for(int8_t i=(expo ? MAX_EXPOS-1 : MAX_MIXERS-1); i>=0; i--) {
for (int i=(expo ? MAX_EXPOS-1 : MAX_MIXERS-1); i>=0; i--) {
ch = (expo ? EXPO_VALID(expoAddress(i)) : mixAddress(i)->srcRaw);
if (ch != 0) {
count++;
@ -652,7 +652,7 @@ void displayHeaderChannelName(uint8_t ch)
{
uint8_t len = zlen(g_model.limitData[ch].name, sizeof(g_model.limitData[ch].name));
if (len) {
lcd_putsnAtt(70, 1, g_model.limitData[ch].name, len, ZCHAR|SMLSIZE);
lcd_putsnAtt(80, 1, g_model.limitData[ch].name, len, ZCHAR|SMLSIZE);
}
}
@ -837,14 +837,14 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
// Value
uint8_t index = expoAddress(s_currIdx)->chn;
if (!s_currCh) {
lcd_outdezAtt(120, 2, calcRESXto1000(anas[index]), PREC1|TINSIZE);
lcd_outdezAtt(127, 2, calcRESXto1000(anas[index]), PREC1|TINSIZE);
}
SIMPLE_MENU(STR_MENUINPUTS, menuTabModel, e_InputsAll, s_maxLines);
// Gauge
if (!s_currCh) {
drawGauge(120, 1, 58, 6, anas[index], 1024);
drawGauge(127, 1, 58, 6, anas[index], 1024);
}
}
else {
@ -855,14 +855,14 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
uint8_t index = mixAddress(s_currIdx)->destCh;
if (!s_currCh) {
displayHeaderChannelName(index);
lcd_outdezAtt(120, 2, calcRESXto1000(ex_chans[index]), PREC1|TINSIZE);
lcd_outdezAtt(127, 2, calcRESXto1000(ex_chans[index]), PREC1|TINSIZE);
}
SIMPLE_MENU(STR_MIXER, menuTabModel, e_MixAll, s_maxLines);
// Gauge
if (!s_currCh) {
drawGauge(120, 1, 58, 6, ex_chans[index], 1024);
drawGauge(127, 1, 58, 6, ex_chans[index], 1024);
}
}

View file

@ -142,15 +142,15 @@ void editTimerMode(int timerIdx, coord_t y, LcdFlags attr, uint8_t event)
switch (m_posHorz) {
case 0:
{
int8_t timerMode = timer->mode;
swsrc_t timerMode = timer->mode;
if (timerMode < 0) timerMode -= TMRMODE_COUNT-1;
CHECK_INCDEC_MODELVAR_CHECK(event, timerMode, -TMRMODE_COUNT-SWSRC_LAST+1, TMRMODE_COUNT+SWSRC_LAST-1, isSwitchAvailableInTimers);
if (timerMode < 0) timerMode += TMRMODE_COUNT-1;
timer->mode = timerMode;
#if defined(AUTOSWITCH)
if (s_editMode>0) {
int8_t val = timer->mode - (TMRMODE_COUNT-1);
int8_t switchVal = checkIncDecMovedSwitch(val);
swsrc_t val = timer->mode - (TMRMODE_COUNT-1);
swsrc_t switchVal = checkIncDecMovedSwitch(val);
if (val != switchVal) {
timer->mode = switchVal + (TMRMODE_COUNT-1);
eeDirty(EE_MODEL);
@ -321,7 +321,7 @@ void menuModelSetup(uint8_t event)
break;
case ITEM_MODEL_TIMER1_COUNTDOWN_BEEP:
g_model.timers[0].countdownBeep = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_BEEPCOUNTDOWN, STR_VBEEPCOUNTDOWN, g_model.timers[0].countdownBeep, 0, 2, attr, event);
g_model.timers[0].countdownBeep = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_BEEPCOUNTDOWN, STR_VBEEPCOUNTDOWN, g_model.timers[0].countdownBeep, COUNTDOWN_SILENT, COUNTDOWN_COUNT-1, attr, event);
break;
case ITEM_MODEL_TIMER1_PERSISTENT:
@ -342,7 +342,7 @@ void menuModelSetup(uint8_t event)
break;
case ITEM_MODEL_TIMER2_COUNTDOWN_BEEP:
g_model.timers[1].countdownBeep = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_BEEPCOUNTDOWN, STR_VBEEPCOUNTDOWN, g_model.timers[1].countdownBeep, 0, 2, attr, event);
g_model.timers[1].countdownBeep = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_BEEPCOUNTDOWN, STR_VBEEPCOUNTDOWN, g_model.timers[1].countdownBeep, COUNTDOWN_SILENT, COUNTDOWN_COUNT-1, attr, event);
break;
case ITEM_MODEL_TIMER2_PERSISTENT:
@ -364,7 +364,7 @@ void menuModelSetup(uint8_t event)
break;
case ITEM_MODEL_TIMER3_COUNTDOWN_BEEP:
g_model.timers[2].countdownBeep = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_BEEPCOUNTDOWN, STR_VBEEPCOUNTDOWN, g_model.timers[2].countdownBeep, 0, 2, attr, event);
g_model.timers[2].countdownBeep = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_BEEPCOUNTDOWN, STR_VBEEPCOUNTDOWN, g_model.timers[2].countdownBeep, COUNTDOWN_SILENT, COUNTDOWN_COUNT-1, attr, event);
break;
case ITEM_MODEL_TIMER3_PERSISTENT:

View file

@ -73,8 +73,10 @@ enum menuModelTelemetryItems {
ITEM_TELEMETRY_SENSOR30,
ITEM_TELEMETRY_SENSOR31,
ITEM_TELEMETRY_SENSOR32,
ITEM_TELEMETRY_NEWSENSOR,
ITEM_TELEMETRY_IGNORE_SENSORID,
ITEM_TELEMETRY_DISCOVER_SENSORS,
ITEM_TELEMETRY_NEW_SENSOR,
ITEM_TELEMETRY_DELETE_ALL_SENSORS,
ITEM_TELEMETRY_IGNORE_SENSOR_INSTANCE,
#if defined(VARIO)
ITEM_TELEMETRY_VARIO_LABEL,
ITEM_TELEMETRY_VARIO_SOURCE,
@ -110,39 +112,39 @@ enum menuModelTelemetryItems {
ITEM_TELEMETRY_MAX
};
#define TELEM_COL1 (1*FW)
#define TELEM_COL2 (16*FW)
#define TELEM_COL3 (28*FW)
#define TELEM_BARS_COLMIN TELEM_COL2
#define TELEM_BARS_COLMAX TELEM_COL3
#define TELEM_SCRTYPE_COL TELEM_COL2
#define TELEM_COL1 (1*FW)
#define TELEM_COL2 (16*FW)
#define TELEM_COL3 (28*FW)
#define TELEM_BARS_COLMIN TELEM_COL2
#define TELEM_BARS_COLMAX TELEM_COL3
#define TELEM_SCRTYPE_COL TELEM_COL2
#define IF_FAS_OFFSET(x) x,
#define IS_RANGE_DEFINED(k) (g_model.frsky.channels[k].ratio > 0)
#define IF_FAS_OFFSET(x) x,
#define IS_RANGE_DEFINED(k) (g_model.frsky.channels[k].ratio > 0)
#define SENSOR_ROWS(x) (isTelemetryFieldAvailable(x) ? (uint8_t)0 : HIDDEN_ROW)
#define SENSORS_ROWS LABEL(Sensors), SENSOR_ROWS(0), SENSOR_ROWS(1), SENSOR_ROWS(2), SENSOR_ROWS(3), SENSOR_ROWS(4), SENSOR_ROWS(5), SENSOR_ROWS(6), SENSOR_ROWS(7), SENSOR_ROWS(8), SENSOR_ROWS(9), SENSOR_ROWS(10), SENSOR_ROWS(11), SENSOR_ROWS(12), SENSOR_ROWS(13), SENSOR_ROWS(14), SENSOR_ROWS(15), SENSOR_ROWS(16), SENSOR_ROWS(17), SENSOR_ROWS(18), SENSOR_ROWS(19), SENSOR_ROWS(20), SENSOR_ROWS(21), SENSOR_ROWS(22), SENSOR_ROWS(23), SENSOR_ROWS(24), SENSOR_ROWS(25), SENSOR_ROWS(26), SENSOR_ROWS(27), SENSOR_ROWS(28), SENSOR_ROWS(29), SENSOR_ROWS(30), SENSOR_ROWS(31), 0, 0,
#define SENSOR_ROWS(x) (isTelemetryFieldAvailable(x) ? (uint8_t)0 : HIDDEN_ROW)
#define SENSORS_ROWS LABEL(Sensors), SENSOR_ROWS(0), SENSOR_ROWS(1), SENSOR_ROWS(2), SENSOR_ROWS(3), SENSOR_ROWS(4), SENSOR_ROWS(5), SENSOR_ROWS(6), SENSOR_ROWS(7), SENSOR_ROWS(8), SENSOR_ROWS(9), SENSOR_ROWS(10), SENSOR_ROWS(11), SENSOR_ROWS(12), SENSOR_ROWS(13), SENSOR_ROWS(14), SENSOR_ROWS(15), SENSOR_ROWS(16), SENSOR_ROWS(17), SENSOR_ROWS(18), SENSOR_ROWS(19), SENSOR_ROWS(20), SENSOR_ROWS(21), SENSOR_ROWS(22), SENSOR_ROWS(23), SENSOR_ROWS(24), SENSOR_ROWS(25), SENSOR_ROWS(26), SENSOR_ROWS(27), SENSOR_ROWS(28), SENSOR_ROWS(29), SENSOR_ROWS(30), SENSOR_ROWS(31), 0, 0, 0, 0,
#if defined(VARIO)
#define VARIO_ROWS LABEL(Vario), 0, 1, 2,
#define VARIO_ROWS LABEL(Vario), 0, 1, 2,
#else
#define VARIO_ROWS
#endif
#define RSSI_ROWS LABEL(RSSI), 0, 0,
#define RSSI_ROWS LABEL(RSSI), 0, 0,
#if defined(LUA)
#define SCREEN_TYPE_ROWS 1
#define SCREEN_TYPE_ROWS 1
#else
#define SCREEN_TYPE_ROWS 0
#define SCREEN_TYPE_ROWS 0
#endif
#define VARIO_RANGE_ROWS 3
#define TELEMETRY_TYPE_ROWS (g_model.moduleData[INTERNAL_MODULE].rfProtocol == RF_PROTO_OFF && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM) ? (uint8_t)0 : HIDDEN_ROW,
#define VARIO_RANGE_ROWS 3
#define TELEMETRY_TYPE_ROWS (g_model.moduleData[INTERNAL_MODULE].rfProtocol == RF_PROTO_OFF && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM) ? (uint8_t)0 : HIDDEN_ROW,
#if defined(LUA)
#define TELEMETRY_SCREEN_LINE(x) ((TELEMETRY_SCREEN_TYPE(x) == TELEMETRY_SCREEN_TYPE_NONE || TELEMETRY_SCREEN_TYPE(x) == TELEMETRY_SCREEN_TYPE_SCRIPT) ? HIDDEN_ROW : (uint8_t)2)
#define TELEMETRY_SCREEN_LINE(x) ((TELEMETRY_SCREEN_TYPE(x) == TELEMETRY_SCREEN_TYPE_NONE || TELEMETRY_SCREEN_TYPE(x) == TELEMETRY_SCREEN_TYPE_SCRIPT) ? HIDDEN_ROW : (uint8_t)2)
#else
#define TELEMETRY_SCREEN_LINE(x) (TELEMETRY_SCREEN_TYPE(x) == TELEMETRY_SCREEN_TYPE_NONE ? HIDDEN_ROW : (uint8_t)2)
#define TELEMETRY_SCREEN_LINE(x) (TELEMETRY_SCREEN_TYPE(x) == TELEMETRY_SCREEN_TYPE_NONE ? HIDDEN_ROW : (uint8_t)2)
#endif
#define TELEMETRY_SCREEN_ROWS(x) SCREEN_TYPE_ROWS, TELEMETRY_SCREEN_LINE(x), TELEMETRY_SCREEN_LINE(x), TELEMETRY_SCREEN_LINE(x), TELEMETRY_SCREEN_LINE(x)
#define TELEMETRY_CURRENT_EDIT_SCREEN(k) (k < ITEM_TELEMETRY_SCREEN_LABEL2 ? 0 : (k < ITEM_TELEMETRY_SCREEN_LABEL3 ? 1 : (k < ITEM_TELEMETRY_SCREEN_LABEL4 ? 2 : 3)))
#define TELEMETRY_SCREEN_ROWS(x) SCREEN_TYPE_ROWS, TELEMETRY_SCREEN_LINE(x), TELEMETRY_SCREEN_LINE(x), TELEMETRY_SCREEN_LINE(x), TELEMETRY_SCREEN_LINE(x)
#define TELEMETRY_CURRENT_SCREEN(k) (k < ITEM_TELEMETRY_SCREEN_LABEL2 ? 0 : (k < ITEM_TELEMETRY_SCREEN_LABEL3 ? 1 : (k < ITEM_TELEMETRY_SCREEN_LABEL4 ? 2 : 3)))
enum SensorFields {
SENSOR_FIELD_NAME,
@ -344,7 +346,7 @@ void menuModelSensor(uint8_t event)
lcd_putsLeft(y, STR_CURRENTSENSOR);
putsMixerSource(SENSOR_2ND_COLUMN, y, sensor->consumption.source ? MIXSRC_FIRST_TELEM+3*(sensor->consumption.source-1) : 0, attr);
if (attr) {
sensor->consumption.source = checkIncDec(event, sensor->consumption.source, 0, MAX_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isCurrentSensor);
sensor->consumption.source = checkIncDec(event, sensor->consumption.source, 0, MAX_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isTelemetryFieldAvailable);
}
break;
}
@ -467,7 +469,7 @@ void onSensorMenu(const char *result)
if (index<MAX_SENSORS && isTelemetryFieldAvailable(index))
m_posVert += 1;
else
m_posVert = ITEM_TELEMETRY_NEWSENSOR;
m_posVert = ITEM_TELEMETRY_NEW_SENSOR;
}
else if (result == STR_COPY) {
int newIndex = availableTelemetryIndex();
@ -492,7 +494,7 @@ void onSensorMenu(const char *result)
void onTelemetryScriptFileSelectionMenu(const char *result)
{
int sub = m_posVert;
int screenIndex = TELEMETRY_CURRENT_EDIT_SCREEN(sub);
int screenIndex = TELEMETRY_CURRENT_SCREEN(sub);
if (result == STR_UPDATE_LIST) {
if (!listSdFiles(SCRIPTS_TELEM_PATH, SCRIPTS_EXT, sizeof(g_model.frsky.screens[screenIndex].script.file), NULL)) {
@ -517,6 +519,13 @@ void onTelemetryScriptFileSelectionMenu(const char *result)
void menuModelTelemetry(uint8_t event)
{
if (s_warning_result) {
s_warning_result = 0;
for (int i=0; i<MAX_SENSORS; i++) {
delTelemetryIndex(i);
}
}
MENU(STR_MENUTELEMETRY, menuTabModel, e_Telemetry, ITEM_TELEMETRY_MAX, { TELEMETRY_TYPE_ROWS RSSI_ROWS SENSORS_ROWS VARIO_ROWS LABEL(TopBar), 0, 0, TOPLCD_ROWS TELEMETRY_SCREEN_ROWS(0), TELEMETRY_SCREEN_ROWS(1), CASE_CPUARM(TELEMETRY_SCREEN_ROWS(2)) CASE_CPUARM(TELEMETRY_SCREEN_ROWS(3)) });
int sub = m_posVert;
@ -574,7 +583,7 @@ void menuModelTelemetry(uint8_t event)
switch (k) {
case ITEM_TELEMETRY_PROTOCOL_TYPE:
g_model.telemetryProtocol = selectMenuItem(TELEM_COL2, y, STR_TELEMETRY_TYPE, "\017FrSky S.PORT\0 FrSky D\0 FrSky D (cable)", g_model.telemetryProtocol, PROTOCOL_TELEMETRY_FIRST, g_eeGeneral.uart3Mode==UART_MODE_TELEMETRY ? PROTOCOL_FRSKY_D_SECONDARY : PROTOCOL_FRSKY_D, attr, event);
g_model.telemetryProtocol = selectMenuItem(TELEM_COL2, y, STR_TELEMETRY_TYPE, "\017FrSky S.PORT\0 FrSky D\0 FrSky D (cable)", g_model.telemetryProtocol, PROTOCOL_TELEMETRY_FIRST, g_eeGeneral.serial2Mode==UART_MODE_TELEMETRY ? PROTOCOL_FRSKY_D_SECONDARY : PROTOCOL_FRSKY_D, attr, event);
break;
case ITEM_TELEMETRY_SENSORS_LABEL:
@ -585,7 +594,15 @@ void menuModelTelemetry(uint8_t event)
}
break;
case ITEM_TELEMETRY_NEWSENSOR:
case ITEM_TELEMETRY_DISCOVER_SENSORS:
lcd_putsAtt(0, y, allowNewSensors ? STR_STOP_DISCOVER_SENSORS : STR_DISCOVER_SENSORS, attr);
if (attr && event==EVT_KEY_BREAK(KEY_ENTER)) {
s_editMode = 0;
allowNewSensors = !allowNewSensors;
}
break;
case ITEM_TELEMETRY_NEW_SENSOR:
lcd_putsAtt(0, y, STR_TELEMETRY_NEWSENSOR, attr);
if (attr && event==EVT_KEY_BREAK(KEY_ENTER)) {
s_editMode = 0;
@ -600,8 +617,17 @@ void menuModelTelemetry(uint8_t event)
}
break;
case ITEM_TELEMETRY_IGNORE_SENSORID:
ON_OFF_MENU_ITEM(g_model.ignoreSensorIds, TELEM_COL2, y, STR_IGNOREIDS, attr, event);
case ITEM_TELEMETRY_DELETE_ALL_SENSORS:
lcd_putsAtt(0, y, STR_DELETE_ALL_SENSORS, attr);
s_editMode = 0;
if (attr && event==EVT_KEY_LONG(KEY_ENTER)) {
killEvents(KEY_ENTER);
POPUP_CONFIRMATION(STR_CONFIRMDELETE);
}
break;
case ITEM_TELEMETRY_IGNORE_SENSOR_INSTANCE:
ON_OFF_MENU_ITEM(g_model.ignoreSensorIds, TELEM_COL2, y, STR_IGNORE_INSTANCE, attr, event);
break;
case ITEM_TELEMETRY_RSSI_LABEL:
@ -705,7 +731,7 @@ void menuModelTelemetry(uint8_t event)
case ITEM_TELEMETRY_SCREEN_LABEL3:
case ITEM_TELEMETRY_SCREEN_LABEL4:
{
uint8_t screenIndex = TELEMETRY_CURRENT_EDIT_SCREEN(k);
uint8_t screenIndex = TELEMETRY_CURRENT_SCREEN(k);
putsStrIdx(0*FW, y, STR_SCREEN, screenIndex+1);
TelemetryScreenType oldScreenType = TELEMETRY_SCREEN_TYPE(screenIndex);
TelemetryScreenType newScreenType = (TelemetryScreenType)selectMenuItem(TELEM_SCRTYPE_COL, y, PSTR(""), STR_VTELEMSCREENTYPE, oldScreenType, 0, TELEMETRY_SCREEN_TYPE_MAX, (m_posHorz==0 ? attr : 0), event);

View file

@ -176,7 +176,7 @@ extern const CheckIncDecStops &stopsSwitch;
(val), (val+1)
int checkIncDec(unsigned int event, int val, int i_min, int i_max, unsigned int i_flags=0, IsValueAvailable isValueAvailable=NULL, const CheckIncDecStops &stops=stops100);
int8_t checkIncDecMovedSwitch(int8_t val);
swsrc_t checkIncDecMovedSwitch(swsrc_t val);
#define checkIncDecModel(event, i_val, i_min, i_max) checkIncDec(event, i_val, i_min, i_max, EE_MODEL)
#define checkIncDecModelZero(event, i_val, i_max) checkIncDec(event, i_val, 0, i_max, EE_MODEL)
#define checkIncDecGen(event, i_val, i_min, i_max) checkIncDec(event, i_val, i_min, i_max, EE_GENERAL)

Some files were not shown because too many files have changed in this diff Show more