Merge pull request #2387 from opentx/projectkk2glider/eeprom_import_debug
Debug output for eeprom import
This commit is contained in:
@@ -9,6 +9,14 @@ CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )
|
|||||||
|
|
||||||
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
||||||
|
|
||||||
|
|
||||||
|
OPTION(DEBUG_IMPORT "Turns on debug output for EEPROM import") # Disabled by default
|
||||||
|
|
||||||
|
IF(DEBUG_IMPORT)
|
||||||
|
ADD_DEFINITIONS( -DDEBUG_MODEL_IMPORT)
|
||||||
|
MESSAGE( STATUS "EEPROM import debugging enabled" )
|
||||||
|
ENDIF(DEBUG_IMPORT)
|
||||||
|
|
||||||
MESSAGE( STATUS "Looking for XercesC " )
|
MESSAGE( STATUS "Looking for XercesC " )
|
||||||
FIND_PACKAGE(XercesC)
|
FIND_PACKAGE(XercesC)
|
||||||
IF ( XERCESC_FOUND )
|
IF ( XERCESC_FOUND )
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
#ifndef customdebug_h
|
||||||
|
#define customdebug_h
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
|
||||||
|
// Controls the generation of debug output for EEPROM import
|
||||||
|
#if defined(DEBUG_MODEL_IMPORT)
|
||||||
|
inline QDebug eepromImportDebug() { return QDebug(QtDebugMsg); }
|
||||||
|
#else
|
||||||
|
#undef eepromImportDebug
|
||||||
|
inline QNoDebug eepromImportDebug() { return QNoDebug(); }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -17,6 +17,8 @@
|
|||||||
#ifndef eeprom_importexport_h
|
#ifndef eeprom_importexport_h
|
||||||
#define eeprom_importexport_h
|
#define eeprom_importexport_h
|
||||||
|
|
||||||
|
#include "customdebug.h"
|
||||||
|
|
||||||
#define DIM(arr) (sizeof((arr))/sizeof((arr)[0]))
|
#define DIM(arr) (sizeof((arr))/sizeof((arr)[0]))
|
||||||
|
|
||||||
class DataField {
|
class DataField {
|
||||||
@@ -151,6 +153,7 @@ class BaseUnsignedField: public DataField {
|
|||||||
if (input[i])
|
if (input[i])
|
||||||
field |= (1<<i);
|
field |= (1<<i);
|
||||||
}
|
}
|
||||||
|
eepromImportDebug() << QString("\timported %1<%2>: 0x%3(%4)").arg(name).arg(N).arg(field, 0, 16).arg(field);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual unsigned int size()
|
virtual unsigned int size()
|
||||||
@@ -207,6 +210,7 @@ class BoolField: public DataField {
|
|||||||
virtual void ImportBits(QBitArray & input)
|
virtual void ImportBits(QBitArray & input)
|
||||||
{
|
{
|
||||||
field = input[0] ? true : false;
|
field = input[0] ? true : false;
|
||||||
|
eepromImportDebug() << QString("\timported %1<%2>: 0x%3(%4)").arg(name).arg(N).arg(field, 0, 16).arg(field);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual unsigned int size()
|
virtual unsigned int size()
|
||||||
@@ -276,6 +280,7 @@ class SignedField: public DataField {
|
|||||||
}
|
}
|
||||||
|
|
||||||
field = (int)value;
|
field = (int)value;
|
||||||
|
eepromImportDebug() << QString("\timported %1<%2>: 0x%3(%4)").arg(name).arg(N).arg(field, 0, 16).arg(field);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual unsigned int size()
|
virtual unsigned int size()
|
||||||
@@ -336,6 +341,7 @@ class CharField: public DataField {
|
|||||||
}
|
}
|
||||||
field[i] = idx;
|
field[i] = idx;
|
||||||
}
|
}
|
||||||
|
eepromImportDebug() << QString("\timported %1<%2>: '%3'").arg(name).arg(N).arg(field);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual unsigned int size()
|
virtual unsigned int size()
|
||||||
@@ -393,6 +399,7 @@ class ZCharField: public DataField {
|
|||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
eepromImportDebug() << QString("\timported %1<%2>: '%3'").arg(name).arg(N).arg(field);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual unsigned int size()
|
virtual unsigned int size()
|
||||||
@@ -418,6 +425,7 @@ class StructField: public DataField {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline void Append(DataField *field) {
|
inline void Append(DataField *field) {
|
||||||
|
//eepromImportDebug() << QString("StructField(%1) appending field: %2").arg(name).arg(field->getName());
|
||||||
fields.append(field);
|
fields.append(field);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -435,6 +443,7 @@ class StructField: public DataField {
|
|||||||
|
|
||||||
virtual void ImportBits(QBitArray & input)
|
virtual void ImportBits(QBitArray & input)
|
||||||
{
|
{
|
||||||
|
eepromImportDebug() << QString("\timporting %1[%2]:").arg(name).arg(fields.size());
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
foreach(DataField *field, fields) {
|
foreach(DataField *field, fields) {
|
||||||
unsigned int size = field->size();
|
unsigned int size = field->size();
|
||||||
@@ -489,6 +498,7 @@ class TransformedField: public DataField {
|
|||||||
|
|
||||||
virtual void ImportBits(QBitArray & input)
|
virtual void ImportBits(QBitArray & input)
|
||||||
{
|
{
|
||||||
|
eepromImportDebug() << QString("\timporting TransformedField %1:").arg(field.getName());
|
||||||
field.ImportBits(input);
|
field.ImportBits(input);
|
||||||
afterImport();
|
afterImport();
|
||||||
}
|
}
|
||||||
@@ -715,6 +725,7 @@ class ConversionField: public TransformedField {
|
|||||||
if (scale) {
|
if (scale) {
|
||||||
field *= scale;
|
field *= scale;
|
||||||
}
|
}
|
||||||
|
eepromImportDebug() << QString("\timported ConversionField<%1>:").arg(internalField.getName()) << QString(" before: %1, after: %2").arg(_field).arg(field);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
#include "opentxeeprom.h"
|
#include "opentxeeprom.h"
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include "customdebug.h"
|
||||||
|
|
||||||
#define IS_DBLEEPROM(board, version) ((IS_2560(board) || board==BOARD_M128) && version >= 213)
|
#define IS_DBLEEPROM(board, version) ((IS_2560(board) || board==BOARD_M128) && version >= 213)
|
||||||
// Macro used for Gruvin9x board and M128 board between versions 213 and 214 (when there were stack overflows!)
|
// Macro used for Gruvin9x board and M128 board between versions 213 and 214 (when there were stack overflows!)
|
||||||
@@ -422,6 +423,7 @@ class SwitchField: public ConversionField< SignedField<N> > {
|
|||||||
{
|
{
|
||||||
ConversionField< SignedField<N> >::afterImport();
|
ConversionField< SignedField<N> >::afterImport();
|
||||||
sw = RawSwitch(_switch);
|
sw = RawSwitch(_switch);
|
||||||
|
eepromImportDebug() << QString("imported %1: %2").arg(ConversionField< SignedField<N> >::internalField.getName()).arg(sw.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -546,6 +548,7 @@ class TelemetrySourceField: public ConversionField< UnsignedField<N> > {
|
|||||||
{
|
{
|
||||||
ConversionField< UnsignedField<N> >::afterImport();
|
ConversionField< UnsignedField<N> >::afterImport();
|
||||||
source = (_source == 0 ? RawSource(0) : RawSource(SOURCE_TYPE_TELEMETRY, _source-1));
|
source = (_source == 0 ? RawSource(0) : RawSource(SOURCE_TYPE_TELEMETRY, _source-1));
|
||||||
|
eepromImportDebug() << QString("imported %1: %2").arg(ConversionField< UnsignedField<N> >::internalField.getName()).arg(source.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -582,6 +585,7 @@ class SourceField: public ConversionField< UnsignedField<N> > {
|
|||||||
{
|
{
|
||||||
ConversionField< UnsignedField<N> >::afterImport();
|
ConversionField< UnsignedField<N> >::afterImport();
|
||||||
source = RawSource(_source);
|
source = RawSource(_source);
|
||||||
|
eepromImportDebug() << QString("imported %1: %2").arg(ConversionField< UnsignedField<N> >::internalField.getName()).arg(source.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -739,6 +743,7 @@ class CurveReferenceField: public TransformedField {
|
|||||||
{
|
{
|
||||||
curve.type = (CurveReference::CurveRefType)_curve_type;
|
curve.type = (CurveReference::CurveRefType)_curve_type;
|
||||||
curve.value = smallGvarToC9x(_curve_value);
|
curve.value = smallGvarToC9x(_curve_value);
|
||||||
|
eepromImportDebug() << QString("imported CurveReference(%1)").arg(curve.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -904,6 +909,7 @@ class FlightModeField: public TransformedField {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
eepromImportDebug() << QString("imported %1: '%2'").arg(internalField.getName()).arg(phase.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -1169,6 +1175,7 @@ class MixField: public TransformedField {
|
|||||||
}
|
}
|
||||||
if (mix.carryTrim < 0) mix.carryTrim = 0;
|
if (mix.carryTrim < 0) mix.carryTrim = 0;
|
||||||
}
|
}
|
||||||
|
eepromImportDebug() << QString("imported %1: ch %2, name '%3'").arg(internalField.getName()).arg(mix.destCh).arg(mix.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -1330,6 +1337,7 @@ class InputField: public TransformedField {
|
|||||||
else
|
else
|
||||||
expo.curve = CurveReference(CurveReference::CURVE_REF_FUNC, _curveParam);
|
expo.curve = CurveReference(CurveReference::CURVE_REF_FUNC, _curveParam);
|
||||||
}
|
}
|
||||||
|
eepromImportDebug() << QString("imported %1: ch %2 name '%3'").arg(internalField.getName()).arg(expo.chn).arg(expo.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -1533,6 +1541,7 @@ class CurvesField: public TransformedField {
|
|||||||
for (int j=0; j<curve->count; j++)
|
for (int j=0; j<curve->count; j++)
|
||||||
curve->points[j].x = -100 + (200*i) / (curve->count-1);
|
curve->points[j].x = -100 + (200*i) / (curve->count-1);
|
||||||
}
|
}
|
||||||
|
eepromImportDebug() << QString("imported curve: %3 points").arg(curve->count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1839,6 +1848,7 @@ class LogicalSwitchField: public TransformedField {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
eepromImportDebug() << QString("imported %1: %2").arg(internalField.getName()).arg(csw.funcToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -1995,6 +2005,7 @@ class SwitchesWarningField: public TransformedField {
|
|||||||
else {
|
else {
|
||||||
sw = _sw;
|
sw = _sw;
|
||||||
}
|
}
|
||||||
|
eepromImportDebug() << QString("imported %1").arg(internalField.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -2203,6 +2214,7 @@ class ArmCustomFunctionField: public TransformedField {
|
|||||||
else {
|
else {
|
||||||
fn.param = value;
|
fn.param = value;
|
||||||
}
|
}
|
||||||
|
eepromImportDebug() << QString("imported %1").arg(internalField.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -2391,6 +2403,7 @@ class AvrCustomFunctionField: public TransformedField {
|
|||||||
else if (version >= 213)
|
else if (version >= 213)
|
||||||
fn.repeatParam = _active * 10;
|
fn.repeatParam = _active * 10;
|
||||||
}
|
}
|
||||||
|
eepromImportDebug() << QString("imported %1").arg(internalField.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -2477,6 +2490,8 @@ class FrskyScreenField: public DataField {
|
|||||||
|
|
||||||
virtual void ImportBits(QBitArray & input)
|
virtual void ImportBits(QBitArray & input)
|
||||||
{
|
{
|
||||||
|
eepromImportDebug() << QString("importing %1: type: %2").arg(name).arg(screen.type);
|
||||||
|
|
||||||
// NOTA: screen.type should have been imported first!
|
// NOTA: screen.type should have been imported first!
|
||||||
if (screen.type == TELEMETRY_SCREEN_SCRIPT)
|
if (screen.type == TELEMETRY_SCREEN_SCRIPT)
|
||||||
script.ImportBits(input);
|
script.ImportBits(input);
|
||||||
@@ -2794,6 +2809,7 @@ class SensorField: public TransformedField {
|
|||||||
else if (sensor.formula == SensorData::TELEM_FORMULA_CONSUMPTION)
|
else if (sensor.formula == SensorData::TELEM_FORMULA_CONSUMPTION)
|
||||||
sensor.amps = _sources[0];
|
sensor.amps = _sources[0];
|
||||||
}
|
}
|
||||||
|
eepromImportDebug() << QString("imported %1").arg(internalField.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -2822,6 +2838,8 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
|
|||||||
{
|
{
|
||||||
sprintf(name, "Model %s", modelData.name);
|
sprintf(name, "Model %s", modelData.name);
|
||||||
|
|
||||||
|
eepromImportDebug() << QString("OpenTxModelData::OpenTxModelData(name: %1, board: %2, ver: %3, var: %4)").arg(name).arg(board).arg(version).arg(variant);
|
||||||
|
|
||||||
if (HAS_LARGE_LCD(board))
|
if (HAS_LARGE_LCD(board))
|
||||||
internalField.Append(new ZCharField<12>(modelData.name));
|
internalField.Append(new ZCharField<12>(modelData.name));
|
||||||
else
|
else
|
||||||
@@ -3147,7 +3165,7 @@ void OpenTxModelData::beforeExport()
|
|||||||
|
|
||||||
void OpenTxModelData::afterImport()
|
void OpenTxModelData::afterImport()
|
||||||
{
|
{
|
||||||
// qDebug() << QString("after import model") << modelData.name ;
|
eepromImportDebug() << QString("OpenTxModelData::afterImport()") << modelData.name;
|
||||||
|
|
||||||
if (IS_TARANIS(board) && version < 216) {
|
if (IS_TARANIS(board) && version < 216) {
|
||||||
for (unsigned int i=0; i<NUM_STICKS; i++) {
|
for (unsigned int i=0; i<NUM_STICKS; i++) {
|
||||||
@@ -3186,6 +3204,8 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
|
|||||||
version(version),
|
version(version),
|
||||||
inputsCount(NUM_STICKS+MAX_POTS(board)+MAX_SLIDERS(board))
|
inputsCount(NUM_STICKS+MAX_POTS(board)+MAX_SLIDERS(board))
|
||||||
{
|
{
|
||||||
|
eepromImportDebug() << QString("OpenTxGeneralData::OpenTxGeneralData(board: %1, version:%2, variant:%3)").arg(board).arg(version).arg(variant);
|
||||||
|
|
||||||
generalData.version = version;
|
generalData.version = version;
|
||||||
generalData.variant = variant;
|
generalData.variant = variant;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user