Compare commits

...

17 Commits

Author SHA1 Message Date
Damjan Adamic 9547ade3d4 Fixes problem with "'timespec': 'struct' type redefinition" on Windows (#3805) 2016-09-14 22:42:54 +02:00
Bertrand Songis 5f5e16dd6a OpenTX 2.0.20 2016-09-14 21:10:32 +02:00
Damjan Adamic a220853a86 Version moved to 2.0.20 2016-05-26 22:44:27 +02:00
Damjan Adamic fdc86aa93d Release notes updated 2016-05-26 22:42:37 +02:00
Damjan Adamic 6a75e40573 Projectkk2glider/branch 2.0 remove obsolete firmwares (#3537)
* Re #3527: removed th9x simulator

* Re #3527: removed er9x simulator

* Re #3527: removed ersky9x simulator
2016-05-26 21:41:51 +02:00
Damjan Adamic 152ba6018c Travis build fix 2016-05-25 22:54:31 +02:00
Damjan Adamic 9d5a74d250 Fixes #3527: location for 9XR-PRO and SKY9X Mike's bootloader has changed (ported from master) 2016-05-25 22:24:15 +02:00
Damjan Adamic b4bbb95a43 Fixes #3347 (backported from next 946c1777) 2016-03-13 18:42:06 +01:00
Damjan Adamic cf0e7c4a44 Release notes updated 2016-01-15 18:42:32 +01:00
Damjan Adamic fd2e0e4994 Fixes #3230: SD manager bug when scrolling up fixed 2016-01-15 18:16:15 +01:00
Damjan Adamic be457b40fc Fixes #3222 : Throttle Source combobox was populated multiple times (ported from master) 2016-01-10 21:52:33 +01:00
Damjan Adamic 41b91d8f5b Re #2939: additional test for EDGE logical switch (ported from next) 2016-01-10 18:59:27 +01:00
Bertrand Songis 4f9576b09d Merge pull request #3212 from opentx/projectkk2glider/issue_2939_edge_problem
Projectkk2glider/issue 2939 edge problem
2016-01-07 19:29:29 +01:00
Damjan Adamic 04f635404a Re #2939: gtests added 2016-01-07 10:35:09 +01:00
Damjan Adamic 64dd923e86 Re #2939: Version moved to 2.0.19 2016-01-06 21:53:44 +01:00
Damjan Adamic 051503e75c Re #2939: Compilation fix 2016-01-06 21:06:43 +01:00
Damjan Adamic 0520127fe6 Fixes #2939: Logical switch internal state was being reset by the AND switch, that affected its function (it looked like AND was applied before the EDGE processing, not after like it is done for other logical switch types). 2016-01-06 15:17:00 +01:00
20 changed files with 242 additions and 936 deletions
+1 -1
View File
@@ -7,7 +7,7 @@ before_install:
- sudo apt-get update
install:
- sudo apt-get install -y lcov cmake cmake-data bc curl gcc-arm-none-eabi gcc-avr avr-libc avrdude libqtcore4 libqt4-dev qt4-qmake g++ libxerces-c-dev xsdcxx libsdl1.2-dev libusb-1.0-0 libphonon-dev phonon libqtwebkit-dev python-qt4 python-qt4-dev libfox-1.6-dev libgtest-dev
- sudo apt-get install --yes --force-yes lcov cmake cmake-data bc curl gcc-arm-none-eabi gcc-avr avr-libc avrdude libqtcore4 libqt4-dev qt4-qmake g++ libxerces-c-dev xsdcxx libsdl1.2-dev libusb-1.0-0 libphonon-dev phonon libqtwebkit-dev python-qt4 python-qt4-dev libfox-1.6-dev libgtest-dev
script:
- radio/util/commit-tests.sh
+13
View File
@@ -1,3 +1,16 @@
<h2>Version 2.0.20 / 2016-09-14</h2>
<ul>
<li>Fixed data overflow in Special Functions Override Channel (<a href=https://github.com/opentx/opentx/issues/3347>#3347</a>)</li>
<li>Removed dependencies on th9x, er9x and ersky9x source code (<a href=https://github.com/opentx/opentx/issues/3537>#3537</a>)</li>
</ul>
<h2>Version 2.0.19 / 2016-01-15</h2>
<ul>
<li>Throttle Source combobox was populated multiple times (<a href=https://github.com/opentx/opentx/issues/3222>#3222</a>)</li>
</ul>
<h2>Version 2.0.18 / 2016-01-03</h2>
<ul>
<li>Enabled <i>Mixers monitor</i> in Taranis simulator</li>
+1 -31
View File
@@ -2,7 +2,7 @@ PROJECT( companion )
SET( C9X_VERSION_MAJOR "2" )
SET( C9X_VERSION_MINOR "0" )
SET( C9X_VERSION_REVISION "18" )
SET( C9X_VERSION_REVISION "20" )
SET( C9X_VERSION ${C9X_VERSION_MAJOR}.${C9X_VERSION_MINOR}.${C9X_VERSION_REVISION} )
CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )
@@ -287,37 +287,7 @@ target_link_libraries(companion modeledit simulation common qcustomplot ${QT_LIB
############# Standalone simu ###############
set(TH9X_CHECKOUT_DIRECTORY ${PROJECT_BINARY_DIR}/firmwares/th9x)
add_custom_command(
OUTPUT ${TH9X_CHECKOUT_DIRECTORY}/th9xsimulator.cpp
COMMAND ${CMAKE_COMMAND} -E make_directory ${TH9X_CHECKOUT_DIRECTORY}
COMMAND cd ${TH9X_CHECKOUT_DIRECTORY} && svn checkout http://th9x.googlecode.com/svn/trunk/src@285 .
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/firmwares/th9x/th9xsimulator.cpp ${TH9X_CHECKOUT_DIRECTORY}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/firmwares/th9x/th9xsimulator.cpp
)
set(ER9X_CHECKOUT_DIRECTORY ${PROJECT_BINARY_DIR}/firmwares/er9x)
add_custom_command(
OUTPUT ${ER9X_CHECKOUT_DIRECTORY}/er9xsimulator.cpp
COMMAND ${CMAKE_COMMAND} -E make_directory ${ER9X_CHECKOUT_DIRECTORY}
COMMAND cd ${ER9X_CHECKOUT_DIRECTORY} && svn checkout http://er9x.googlecode.com/svn/trunk/src@790 .
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/firmwares/er9x/er9xsimulator.cpp ${ER9X_CHECKOUT_DIRECTORY}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/firmwares/er9x/er9xsimulator.cpp
)
set(ERSKY9X_CHECKOUT_DIRECTORY ${PROJECT_BINARY_DIR}/firmwares/ersky9x)
add_custom_command(
OUTPUT ${ERSKY9X_CHECKOUT_DIRECTORY}/ersky9xsimulator.cpp
COMMAND ${CMAKE_COMMAND} -E make_directory ${ERSKY9X_CHECKOUT_DIRECTORY}
COMMAND cd ${ERSKY9X_CHECKOUT_DIRECTORY} && svn checkout http://ersky9x.googlecode.com/svn/trunk/src@170 .
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/firmwares/ersky9x/ersky9xsimulator.cpp ${ERSKY9X_CHECKOUT_DIRECTORY}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/firmwares/ersky9x/ersky9xsimulator.cpp
)
set(simu_SRCS
${TH9X_CHECKOUT_DIRECTORY}/th9xsimulator.cpp
${ER9X_CHECKOUT_DIRECTORY}/er9xsimulator.cpp
${ERSKY9X_CHECKOUT_DIRECTORY}/ersky9xsimulator.cpp
${RADIO_SRC_DIRECTORY}/bitmaps/sticks.lbm
${RADIO_SRC_DIRECTORY}/translations/en.h
${RADIO_SRC_DIRECTORY}/lua_exports.inc
@@ -17,7 +17,6 @@
#include <iostream>
#include "er9xinterface.h"
#include "er9xeeprom.h"
#include "er9xsimulator.h"
#include "file.h"
#include "appdata.h"
@@ -1,224 +0,0 @@
/*
* Author - Bertrand Songis <bsongis@gmail.com>
*
* Based on 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 "firmwares/er9x/er9xsimulator.h"
#include "firmwares/er9x/er9xinterface.h"
#define SIMU
#define SIMU_EXCEPTIONS
#define FRSKY
#define PHASES
#undef min
#undef max
#define NUM_POTS 3
#define SWSRC_SW1 DSW_SW1
#include <exception>
namespace Er9x {
#include "simpgmspace.h"
#include "er9x.cpp"
#include "stamp.cpp"
#include "menus.cpp"
#include "pers.cpp"
#include "file.cpp"
#include "lcd.cpp"
#include "drivers.cpp"
#include "simpgmspace.cpp"
#include "templates.cpp"
#include "frsky.cpp"
#include "audio.cpp"
uint8_t pxxFlag = 0;
int16_t g_anas[7];
#define IS_BACKLIGHT_ON() (PORTB & (1<<OUT_B_LIGHT))
uint16_t anaIn(uint8_t chan)
{
if (chan == 7)
return 1500;
else
return g_anas[chan];
}
bool hasExtendedTrims()
{
return false;
}
void setTrim(uint8_t idx, int8_t value)
{
g_model.trim[idx] = value;
}
void getTrims(int16_t values[4])
{
for (int i=0; i<4; i++)
values[i] = g_model.trim[i];
}
#define GPIO_TRIM_LH_L pind
#define GPIO_TRIM_LV_DN pind
#define GPIO_TRIM_RV_UP pind
#define GPIO_TRIM_RH_L pind
#define GPIO_TRIM_LH_R pind
#define GPIO_TRIM_LV_UP pind
#define GPIO_TRIM_RV_DN pind
#define GPIO_TRIM_RH_R pind
#define PIN_TRIM_LH_L (1<<INP_D_TRM_LH_DWN)
#define PIN_TRIM_LV_DN (1<<INP_D_TRM_LV_DWN)
#define PIN_TRIM_RV_UP (1<<INP_D_TRM_RV_UP)
#define PIN_TRIM_RH_L (1<<INP_D_TRM_RH_DWN)
#define PIN_TRIM_LH_R (1<<INP_D_TRM_LH_UP)
#define PIN_TRIM_LV_UP (1<<INP_D_TRM_LV_UP)
#define PIN_TRIM_RV_DN (1<<INP_D_TRM_RV_DWN)
#define PIN_TRIM_RH_R (1<<INP_D_TRM_RH_UP)
#define TRIM_CASE(key, pin, mask) \
case key: \
if (state) pin |= mask; else pin &= ~mask;\
break;
void simuSetTrim(uint8_t trim, bool state)
{
switch (trim) {
TRIM_CASE(0, GPIO_TRIM_LH_L, PIN_TRIM_LH_L)
TRIM_CASE(1, GPIO_TRIM_LH_R, PIN_TRIM_LH_R)
TRIM_CASE(2, GPIO_TRIM_LV_DN, PIN_TRIM_LV_DN)
TRIM_CASE(3, GPIO_TRIM_LV_UP, PIN_TRIM_LV_UP)
TRIM_CASE(4, GPIO_TRIM_RV_DN, PIN_TRIM_RV_DN)
TRIM_CASE(5, GPIO_TRIM_RV_UP, PIN_TRIM_RV_UP)
TRIM_CASE(6, GPIO_TRIM_RH_L, PIN_TRIM_RH_L)
TRIM_CASE(7, GPIO_TRIM_RH_R, PIN_TRIM_RH_R)
}
}
#define SWITCH_CASE(swtch, pin, mask) \
case swtch: \
if (state) pin &= ~(mask); else pin |= (mask); \
break;
#define SWITCH_3_CASE(swtch, pin1, pin2, mask1, mask2) \
case swtch: \
if (state >= 0) pin1 &= ~(mask1); else pin1 |= (mask1); \
if (state <= 0) pin2 &= ~(mask2); else pin2 |= (mask2); \
break;
void simuSetSwitch(uint8_t swtch, int8_t state)
{
switch (swtch) {
SWITCH_CASE(0, pinc, 1<<INP_C_ThrCt)
SWITCH_CASE(4, pinc, 1<<INP_C_AileDR)
SWITCH_3_CASE(3, ping, pine, (1<<INP_G_ID1), (1<<INP_E_ID2))
SWITCH_CASE(1, ping, 1<<INP_G_RuddDR)
SWITCH_CASE(2, pine, 1<<INP_E_ElevDR)
SWITCH_CASE(5, pine, 1<<INP_E_Gear)
SWITCH_CASE(6, pine, 1<<INP_E_Trainer)
default:
break;
}
}
#define KEY_CASE(key, pin, mask) \
case key: \
if (state) pin |= mask; else pin &= ~mask;\
break;
void simuSetKey(uint8_t key, bool state)
{
switch (key) {
KEY_CASE(KEY_MENU, pinb, (1<<INP_B_KEY_MEN))
KEY_CASE(KEY_EXIT, pinb, (1<<INP_B_KEY_EXT))
KEY_CASE(KEY_RIGHT, pinb, (1<<INP_B_KEY_RGT))
KEY_CASE(KEY_LEFT, pinb, (1<<INP_B_KEY_LFT))
KEY_CASE(KEY_UP, pinb, (1<<INP_B_KEY_UP))
KEY_CASE(KEY_DOWN, pinb, (1<<INP_B_KEY_DWN))
}
}
#define IS_BACKLIGHT_ON() (PORTB & (1<<OUT_B_LIGHT))
}
using namespace Er9x;
Er9xSimulator::Er9xSimulator(Er9xInterface * er9xInterface):
er9xInterface(er9xInterface)
{
}
bool Er9xSimulator::timer10ms()
{
AUDIO_DRIVER(); // the tone generator
AUDIO_HEARTBEAT(); // the queue processing
#define TIMER10MS_IMPORT
#include "simulatorimport.h"
}
uint8_t * Er9xSimulator::getLcd()
{
#define GETLCD_IMPORT
#include "simulatorimport.h"
}
bool Er9xSimulator::lcdChanged(bool & lightEnable)
{
#define LCDCHANGED_IMPORT
#include "simulatorimport.h"
}
void Er9xSimulator::start(RadioData &radioData, bool tests)
{
er9xInterface->save(&eeprom[0], radioData);
StartMainThread(tests);
}
void Er9xSimulator::stop()
{
StopMainThread();
}
void Er9xSimulator::getValues(TxOutputs &outputs)
{
#define GETVALUES_IMPORT
#include "simulatorimport.h"
outputs.beep = audio.busy();
}
void Er9xSimulator::setValues(TxInputs &inputs)
{
#define SETVALUES_IMPORT
#include "simulatorimport.h"
}
void Er9xSimulator::setTrim(unsigned int idx, int value)
{
Er9x::setTrim(idx, value);
}
void Er9xSimulator::getTrims(Trims & trims)
{
trims.extended = false;
Er9x::getTrims(trims.values);
}
const char * Er9xSimulator::getError()
{
#define GETERROR_IMPORT
#include "simulatorimport.h"
}
@@ -1,66 +0,0 @@
/*
* Author - Bertrand Songis <bsongis@gmail.com>
*
* Based on 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 er9x_simulator_h
#define er9x_simulator_h
#include "simulatorinterface.h"
class RadioData;
class Er9xInterface;
class Er9xSimulator : public SimulatorInterface {
public:
Er9xSimulator(Er9xInterface *);
virtual void start(RadioData & radioData, bool tests);
virtual void stop();
virtual bool timer10ms();
virtual uint8_t * getLcd();
virtual bool lcdChanged(bool & lightEnable);
virtual void setValues(TxInputs &inputs);
virtual void getValues(TxOutputs &outputs);
virtual void setTrim(unsigned int idx, int value);
virtual void getTrims(Trims & trims);
virtual unsigned int getPhase() { return 0; }
virtual const char * getPhaseName(unsigned int phase) { return 0; }
virtual void wheelEvent(uint8_t steps) { }
virtual const char * getError();
virtual void sendTelemetry(uint8_t * data, unsigned int len) {};
virtual void setTrainerInput(unsigned int inputNumber, int16_t value) {};
protected:
Er9xInterface * er9xInterface;
};
#endif
@@ -17,7 +17,6 @@
#include <iostream>
#include "ersky9xinterface.h"
#include "ersky9xeeprom.h"
#include "ersky9xsimulator.h"
#include "file.h"
#define FILE_TYP_GENERAL 1
@@ -1,247 +0,0 @@
/*
* Author - Bertrand Songis <bsongis@gmail.com>
*
* Based on 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 "firmwares/ersky9x/ersky9xsimulator.h"
#include "firmwares/ersky9x/ersky9xinterface.h"
#define SIMU
#define SIMU_EXCEPTIONS
#define PCBSKY9X
#define PCBSKY
#define STAMP
#define FRSKY
#define FRSKY_HUB
#define WS_HOW_HIGH
#define TEMPLATES
#define HELI
#define HAPTIC
#define AUDIO
#define REVB
#define NUM_POTS 3
#define SWSRC_SW1 DSW_SW1
#undef min
#undef max
#include <exception>
namespace Ersky9x {
#include "../ersky9x/timers.h"
#include "../ersky9x/ersky9x.cpp"
#include "../ersky9x/stamp.cpp"
#include "../ersky9x/menus.cpp"
#include "../ersky9x/pers.cpp"
#include "../ersky9x/file.cpp"
#include "../ersky9x/lcd.cpp"
#include "../ersky9x/drivers.cpp"
#include "../ersky9x/logicio.cpp"
#include "../ersky9x/timers.cpp"
#include "../ersky9x/simpgmspace.cpp"
#include "../ersky9x/templates.cpp"
#include "../ersky9x/frsky.cpp"
#include "../ersky9x/audio.cpp"
#include "../ersky9x/sound.cpp"
#include "../ersky9x/diskio.cpp"
#define IS_BACKLIGHT_ON() (PWM->PWM_CH_NUM[0].PWM_CDTY != 100)
//uint8_t pxxFlag = 0;
int16_t g_anas[7];
uint16_t anaIn(uint8_t chan)
{
if (chan == 7)
return 1500;
else
return g_anas[chan];
}
bool hasExtendedTrims()
{
return false;
}
void setTrim(uint8_t idx, int8_t value)
{
g_model.trim[idx] = value;
}
void getTrims(int16_t values[4])
{
for (int i=0; i<4; i++)
values[i] = g_model.trim[i];
}
#define SWITCH_CASE(swtch, pin, mask) \
case swtch: \
if (state) pin |= (mask); else pin &= ~(mask); \
break;
#define SWITCH_3_CASE(swtch, pin1, pin2, mask1, mask2) \
case swtch: \
if (state < 0) pin1 &= ~(mask1); else pin1 |= (mask1); \
if (state > 0) pin2 &= ~(mask2); else pin2 |= (mask2); \
break;
void simuSetSwitch(uint8_t swtch, int8_t state)
{
// printf("swtch=%d state=%d\n", swtch, state); fflush(stdout);
switch (swtch) {
SWITCH_CASE(0, PIOC->PIO_PDSR, 1<<20)
SWITCH_CASE(1, PIOA->PIO_PDSR, 1<<15)
SWITCH_CASE(2, PIOC->PIO_PDSR, 1<<31)
SWITCH_3_CASE(3, PIOC->PIO_PDSR, PIOC->PIO_PDSR, 0x00004000, 0x00000800)
SWITCH_CASE(4, PIOA->PIO_PDSR, 1<<2)
SWITCH_CASE(5, PIOC->PIO_PDSR, 1<<16)
SWITCH_CASE(6, PIOC->PIO_PDSR, 1<<8)
default:
break;
}
}
#define GPIO_BUTTON_MENU PIOB->PIO_PDSR
#define GPIO_BUTTON_EXIT PIOC->PIO_PDSR
#define GPIO_BUTTON_UP PIOC->PIO_PDSR
#define GPIO_BUTTON_DOWN PIOC->PIO_PDSR
#define GPIO_BUTTON_RIGHT PIOC->PIO_PDSR
#define GPIO_BUTTON_LEFT PIOC->PIO_PDSR
#define PIN_BUTTON_MENU 0x00000020
#define PIN_BUTTON_EXIT 0x01000000
#define PIN_BUTTON_UP 0x00000002
#define PIN_BUTTON_DOWN 0x00000020
#define PIN_BUTTON_RIGHT 0x00000010
#define PIN_BUTTON_LEFT 0x00000008
#define KEY_CASE(key, pin, mask) \
case key: \
if (state) pin &= ~mask; else pin |= mask;\
break;
void simuSetKey(uint8_t key, bool state)
{
switch (key) {
KEY_CASE(KEY_MENU, GPIO_BUTTON_MENU, PIN_BUTTON_MENU)
KEY_CASE(KEY_EXIT, GPIO_BUTTON_EXIT, PIN_BUTTON_EXIT)
KEY_CASE(KEY_RIGHT, GPIO_BUTTON_RIGHT, PIN_BUTTON_RIGHT)
KEY_CASE(KEY_LEFT, GPIO_BUTTON_LEFT, PIN_BUTTON_LEFT)
KEY_CASE(KEY_UP, GPIO_BUTTON_UP, PIN_BUTTON_UP)
KEY_CASE(KEY_DOWN, GPIO_BUTTON_DOWN, PIN_BUTTON_DOWN)
}
}
#define GPIO_TRIM_LH_L PIOA->PIO_PDSR
#define GPIO_TRIM_LV_DN PIOA->PIO_PDSR
#define GPIO_TRIM_RV_UP PIOA->PIO_PDSR
#define GPIO_TRIM_RH_L PIOA->PIO_PDSR
#define GPIO_TRIM_LH_R PIOB->PIO_PDSR
#define GPIO_TRIM_LV_UP PIOC->PIO_PDSR
#define GPIO_TRIM_RV_DN PIOC->PIO_PDSR
#define GPIO_TRIM_RH_R PIOC->PIO_PDSR
#define PIN_TRIM_LH_L 0x00800000
#define PIN_TRIM_LV_DN 0x01000000
#define PIN_TRIM_RV_UP 0x00000002
#define PIN_TRIM_RH_L 0x00000001
#define PIN_TRIM_LH_R 0x00000010
#define PIN_TRIM_LV_UP 0x10000000
#define PIN_TRIM_RV_DN 0x00000400
#define PIN_TRIM_RH_R 0x00000200
#define TRIM_CASE KEY_CASE
void simuSetTrim(uint8_t trim, bool state)
{
switch (trim) {
TRIM_CASE(0, GPIO_TRIM_LH_L, PIN_TRIM_LH_L)
TRIM_CASE(1, GPIO_TRIM_LH_R, PIN_TRIM_LH_R)
TRIM_CASE(2, GPIO_TRIM_LV_DN, PIN_TRIM_LV_DN)
TRIM_CASE(3, GPIO_TRIM_LV_UP, PIN_TRIM_LV_UP)
TRIM_CASE(4, GPIO_TRIM_RV_DN, PIN_TRIM_RV_DN)
TRIM_CASE(5, GPIO_TRIM_RV_UP, PIN_TRIM_RV_UP)
TRIM_CASE(6, GPIO_TRIM_RH_L, PIN_TRIM_RH_L)
TRIM_CASE(7, GPIO_TRIM_RH_R, PIN_TRIM_RH_R)
}
}
}
using namespace Ersky9x;
Ersky9xSimulator::Ersky9xSimulator(Ersky9xInterface * ersky9xInterface):
ersky9xInterface(ersky9xInterface)
{
}
bool Ersky9xSimulator::timer10ms()
{
#define TIMER10MS_IMPORT
#include "simulatorimport.h"
}
uint8_t * Ersky9xSimulator::getLcd()
{
#define GETLCD_IMPORT
#include "simulatorimport.h"
}
bool Ersky9xSimulator::lcdChanged(bool & lightEnable)
{
#define LCDCHANGED_IMPORT
#include "simulatorimport.h"
}
void Ersky9xSimulator::start(RadioData &radioData, bool tests)
{
ersky9xInterface->save(Ersky9x::eeprom, radioData);
StartEepromThread(NULL);
StartMainThread(tests);
}
void Ersky9xSimulator::stop()
{
StopMainThread();
StopEepromThread();
}
void Ersky9xSimulator::getValues(TxOutputs &outputs)
{
#define GETVALUES_IMPORT
#include "simulatorimport.h"
}
void Ersky9xSimulator::setValues(TxInputs &inputs)
{
#define SETVALUES_IMPORT
#include "simulatorimport.h"
}
void Ersky9xSimulator::setTrim(unsigned int idx, int value)
{
Ersky9x::setTrim(idx, value);
}
void Ersky9xSimulator::getTrims(Trims & trims)
{
trims.extended = false;
Ersky9x::getTrims(trims.values);
}
const char * Ersky9xSimulator::getError()
{
#define GETERROR_IMPORT
#include "simulatorimport.h"
}
@@ -1,66 +0,0 @@
/*
* Author - Bertrand Songis <bsongis@gmail.com>
*
* Based on 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 ersky9x_simulator_h
#define ersky9x_simulator_h
#include "simulatorinterface.h"
class RadioData;
class Ersky9xInterface;
class Ersky9xSimulator : public SimulatorInterface {
public:
Ersky9xSimulator(Ersky9xInterface *);
virtual void start(RadioData & radioData, bool tests);
virtual void stop();
virtual bool timer10ms();
virtual uint8_t * getLcd();
virtual bool lcdChanged(bool & lightEnable);
virtual void setValues(TxInputs &inputs);
virtual void getValues(TxOutputs &outputs);
virtual void setTrim(unsigned int idx, int value);
virtual void getTrims(Trims & trims);
virtual unsigned int getPhase() { return 0; }
virtual const char * getPhaseName(unsigned int phase) { return 0; }
virtual void wheelEvent(uint8_t steps) { }
virtual const char * getError();
virtual void sendTelemetry(uint8_t * data, unsigned int len) {};
virtual void setTrainerInput(unsigned int inputNumber, int16_t value) {};
protected:
Ersky9xInterface * ersky9xInterface;
};
#endif
@@ -1976,7 +1976,7 @@ class ArmCustomFunctionField: public TransformedField {
if (fn.func >= FuncOverrideCH1 && fn.func <= FuncOverrideCH32) {
fn.func = AssignFunc(fn.func + index);
fn.param = (int8_t)value;
fn.param = (int16_t)(uint16_t)value;
}
else if (fn.func >= FuncSetTimer1 && fn.func <= FuncSetTimer2) {
fn.func = AssignFunc(fn.func + index);
@@ -17,7 +17,6 @@
#include <iostream>
#include "th9xinterface.h"
#include "th9xeeprom.h"
#include "th9xsimulator.h"
#include "file.h"
#include "appdata.h"
@@ -1,233 +0,0 @@
/*
* Author - Bertrand Songis <bsongis@gmail.com>
*
* Based on 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 "firmwares/th9x/th9xsimulator.h"
#include "firmwares/th9x/th9xinterface.h"
#define SIM
#define SIMU
#define SIMU_EXCEPTIONS
#undef min
#undef max
#define NUM_POTS 3
#define NUM_CSW 12
#define SWSRC_SW1 10
#include <exception>
#include <algorithm>
namespace Th9x {
#include "simpgmspace.h"
#include "th9x.cpp"
#include "stamp.cpp"
#include "menus.cpp"
#include "pers.cpp"
#include "file.cpp"
#include "lcd.cpp"
#include "drivers.cpp"
#include "foldedlist.cpp"
#include "simpgmspace.cpp"
#include "pulses.cpp"
int16_t g_anas[7];
char g_title[80] = "";
uint16_t anaIn(uint8_t chan)
{
if (chan == 7)
return 750;
else
return 512 + g_anas[chan];
}
bool hasExtendedTrims()
{
return false;
}
void setTrim(uint8_t idx, int8_t value)
{
g_model.trimData[idx].itrim = trimRevertM(value, g_model.trimData[idx].tmode);
}
void getTrims(int16_t values[4])
{
for (int i=0; i<4; i++) {
values[i] = trimVal(i);
}
}
void eeprom_RESV_mismatch(void)
{
assert(!"Should never been called. Only needed by VC++ (debug mode)");
}
#define GPIO_TRIM_LH_L pind
#define GPIO_TRIM_LV_DN pind
#define GPIO_TRIM_RV_UP pind
#define GPIO_TRIM_RH_L pind
#define GPIO_TRIM_LH_R pind
#define GPIO_TRIM_LV_UP pind
#define GPIO_TRIM_RV_DN pind
#define GPIO_TRIM_RH_R pind
#define PIN_TRIM_LH_L (1<<INP_D_TRM_LH_DWN)
#define PIN_TRIM_LV_DN (1<<INP_D_TRM_LV_DWN)
#define PIN_TRIM_RV_UP (1<<INP_D_TRM_RV_UP)
#define PIN_TRIM_RH_L (1<<INP_D_TRM_RH_DWN)
#define PIN_TRIM_LH_R (1<<INP_D_TRM_LH_UP)
#define PIN_TRIM_LV_UP (1<<INP_D_TRM_LV_UP)
#define PIN_TRIM_RV_DN (1<<INP_D_TRM_RV_DWN)
#define PIN_TRIM_RH_R (1<<INP_D_TRM_RH_UP)
#define TRIM_CASE(key, pin, mask) \
case key: \
if (state) pin |= mask; else pin &= ~mask;\
break;
void simuSetTrim(uint8_t trim, bool state)
{
switch (trim) {
TRIM_CASE(0, GPIO_TRIM_LH_L, PIN_TRIM_LH_L)
TRIM_CASE(1, GPIO_TRIM_LH_R, PIN_TRIM_LH_R)
TRIM_CASE(2, GPIO_TRIM_LV_DN, PIN_TRIM_LV_DN)
TRIM_CASE(3, GPIO_TRIM_LV_UP, PIN_TRIM_LV_UP)
TRIM_CASE(4, GPIO_TRIM_RV_DN, PIN_TRIM_RV_DN)
TRIM_CASE(5, GPIO_TRIM_RV_UP, PIN_TRIM_RV_UP)
TRIM_CASE(6, GPIO_TRIM_RH_L, PIN_TRIM_RH_L)
TRIM_CASE(7, GPIO_TRIM_RH_R, PIN_TRIM_RH_R)
}
}
#define SWITCH_CASE(swtch, pin, mask) \
case swtch: \
if (state) pin &= ~(mask); else pin |= (mask); \
break;
#define SWITCH_3_CASE(swtch, pin1, pin2, mask1, mask2) \
case swtch: \
if (state >= 0) pin1 &= ~(mask1); else pin1 |= (mask1); \
if (state <= 0) pin2 &= ~(mask2); else pin2 |= (mask2); \
break;
void simuSetSwitch(uint8_t swtch, int8_t state)
{
switch (swtch) {
SWITCH_CASE(0, pine, 1<<INP_E_ThrCt)
SWITCH_CASE(4, pine, 1<<INP_E_AileDR)
SWITCH_3_CASE(3, ping, pine, (1<<INP_G_ID1), (1<<INP_E_ID2))
SWITCH_CASE(1, ping, 1<<INP_G_RuddDR)
SWITCH_CASE(2, pine, 1<<INP_E_ElevDR)
SWITCH_CASE(5, pine, 1<<INP_E_Gear)
SWITCH_CASE(6, pine, 1<<INP_E_Trainer)
default:
break;
}
}
#define KEY_CASE(key, pin, mask) \
case key: \
if (state) pin |= mask; else pin &= ~mask;\
break;
void simuSetKey(uint8_t key, bool state)
{
switch (key) {
KEY_CASE(KEY_MENU, pinb, (1<<INP_B_KEY_MEN))
KEY_CASE(KEY_EXIT, pinb, (1<<INP_B_KEY_EXT))
KEY_CASE(KEY_RIGHT, pinb, (1<<INP_B_KEY_RGT))
KEY_CASE(KEY_LEFT, pinb, (1<<INP_B_KEY_LFT))
KEY_CASE(KEY_UP, pinb, (1<<INP_B_KEY_UP))
KEY_CASE(KEY_DOWN, pinb, (1<<INP_B_KEY_DWN))
}
}
#define IS_BACKLIGHT_ON() (PORTB & (1<<OUT_B_LIGHT))
}
using namespace Th9x;
Th9xSimulator::Th9xSimulator(Th9xInterface * th9xInterface):
th9xInterface(th9xInterface)
{
}
bool Th9xSimulator::timer10ms()
{
#define TIMER10MS_IMPORT
#include "simulatorimport.h"
}
uint8_t * Th9xSimulator::getLcd()
{
#define GETLCD_IMPORT
#include "simulatorimport.h"
}
bool Th9xSimulator::lcdChanged(bool & lightEnable)
{
#define LCDCHANGED_IMPORT
#include "simulatorimport.h"
}
void Th9xSimulator::start(RadioData &radioData, bool tests)
{
th9xInterface->save(&eeprom[0], radioData);
StartMainThread(tests);
}
void Th9xSimulator::stop()
{
StopMainThread();
}
void Th9xSimulator::getValues(TxOutputs &outputs)
{
#define GETVALUES_IMPORT
#include "simulatorimport.h"
for (int i=0; i<8; i++)
outputs.chans[i] *= 2;
}
void Th9xSimulator::setValues(TxInputs &_inputs)
{
TxInputs inputs = _inputs;
for (int i=0; i<4; i++)
inputs.sticks[i] /= 2;
for (int i=0; i<3; i++)
inputs.pots[i] /= 2;
#define SETVALUES_IMPORT
#include "simulatorimport.h"
}
void Th9xSimulator::setTrim(unsigned int idx, int value)
{
Th9x::setTrim(idx, value);
}
void Th9xSimulator::getTrims(Trims & trims)
{
trims.extended = false;
Th9x::getTrims(trims.values);
}
const char * Th9xSimulator::getError()
{
#define GETERROR_IMPORT
#include "simulatorimport.h"
}
@@ -1,60 +0,0 @@
/*
* Author - Bertrand Songis <bsongis@gmail.com>
*
* Based on 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 th9x_simulator_h
#define th9x_simulator_h
#include "simulatorinterface.h"
class RadioData;
class Th9xInterface;
class Th9xSimulator : public SimulatorInterface {
public:
Th9xSimulator(Th9xInterface *);
virtual void start(RadioData & radioData, bool tests);
virtual void stop();
virtual bool timer10ms();
virtual uint8_t * getLcd();
virtual bool lcdChanged(bool & lightEnable);
virtual void setValues(TxInputs &inputs);
virtual void getValues(TxOutputs &outputs);
virtual void setTrim(unsigned int idx, int value);
virtual void getTrims(Trims & trims);
virtual unsigned int getPhase() { return 0; }
virtual void wheelEvent(uint8_t steps) { }
virtual const char * getError();
protected:
Th9xInterface * th9xInterface;
};
#endif
+1
View File
@@ -610,6 +610,7 @@ void SetupPanel::populateThrottleSourceCB()
lock = true;
ui->throttleSource->clear();
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
for (i=0; i<6; i++) {
ui->throttleSource->addItem(sourcesTaranis[i], i);
+22
View File
@@ -1,3 +1,25 @@
<h2>Version 2.0.20 / 2016-09-14</h2>
Nothing new (only Firmware build server and Companion fixes)
[9XR-PRO / Sky9x]
<ul>
<li>Fixed: location for 9XR-PRO and SKY9X Mike's bootloader has changed (<a href=https://github.com/opentx/opentx/issues/3527>#3527</a>)</li>
</ul>
<h2>Version 2.0.19 / 2016-01-15</h2>
[ARM Boards]
<ul>
<li>Fixed : Logical switch internal state was being reset by the AND switch, that affected its function
(it looked like AND was applied before the EDGE processing, not after like it is done for other logical switch types)
(<a href=https://github.com/opentx/opentx/issues/2939>#2939</a>)</li>
<li>SD manager bug when scrolling up fixed (<a href=https://github.com/opentx/opentx/issues/3230>#3230</a>)</li>
</ul>
<h2>Version 2.0.18 / 2016-01-03</h2>
[Taranis]
+3 -3
View File
@@ -335,7 +335,7 @@ SHELL = sh
IMG2LBM = -python ../util/img2lbm.py
BIN2LBM = -python ../util/bin2lbm.py
TRANSLATE = -python ../util/translate.py
VERSION = 2.0.18
VERSION = 2.0.20
SRC =
CPPSRC =
@@ -1256,12 +1256,12 @@ bootloader.lbm: bootloader/bootloader_ramBoot.bin
else ifeq ($(PCB), 9XRPRO)
bootloader.lbm:
@echo "Fetching Mike's bootloader..."
wget http://ersky9x.googlecode.com/svn/trunk/src/bootloader/bootflash8.lbm
wget https://github.com/MikeBland/OpenRcBootloader/releases/download/V1.9/bootflash8.lbm
mv bootflash8.lbm $@
else ifeq ($(PCB), SKY9X)
bootloader.lbm:
@echo "Fetching Mike's bootloader..."
wget http://ersky9x.googlecode.com/svn/trunk/src/bootloader/bootflash4.lbm
wget https://github.com/MikeBland/OpenRcBootloader/releases/download/V1.9/bootflash4.lbm
mv bootflash4.lbm $@
endif
+1 -1
View File
@@ -1101,7 +1101,7 @@ void menuGeneralSdManager(uint8_t _event)
if (isFilenameLower(isfile, fn, reusableBuffer.sdmanager.lines[1]) && isFilenameGreater(isfile, fn, reusableBuffer.sdmanager.lines[0])) {
memset(reusableBuffer.sdmanager.lines[0], 0, sizeof(reusableBuffer.sdmanager.lines[0]));
strcpy(reusableBuffer.sdmanager.lines[0], fn);
NODE_TYPE(reusableBuffer.sdmanager.lines[6]) = isfile;
NODE_TYPE(reusableBuffer.sdmanager.lines[0]) = isfile;
}
}
}
+5
View File
@@ -219,7 +219,12 @@ bool getLogicalSwitch(uint8_t idx)
#endif
if (ls->func == LS_FUNC_NONE || (s && !getSwitch(s))) {
#if defined(CPUARM)
if (ls->func != LS_FUNC_STICKY && ls->func != LS_FUNC_STAY ) {
#else
if (ls->func != LS_FUNC_STICKY) {
#endif
// AND switch must not affect STICKY and EDGE (STAY) processing
LS_LAST_VALUE(mixerCurrentFlightMode, idx) = CS_LAST_VALUE_INIT;
}
result = false;
+1
View File
@@ -81,6 +81,7 @@ void sig(int sgn)
#include <inttypes.h>
#include <stdio.h>
#define HAVE_STRUCT_TIMESPEC
#include <pthread.h>
#include <semaphore.h>
#include <stddef.h>
+193
View File
@@ -361,3 +361,196 @@ TEST(getSwitch, inputWithTrim)
EXPECT_EQ(getSwitch(SWSRC_SW1), true);
}
#endif
#if defined(PCBTARANIS)
/*
PACK(typedef struct t_LogicalSwitchData { // Logical Switches data
int8_t v1;
int16_t v2;
int16_t v3;
uint8_t func;
uint8_t delay;
uint8_t duration;
int8_t andsw;
}) LogicalSwitchData;
*/
TEST(getSwitch, edgeInstant)
{
MODEL_RESET();
MIXER_RESET();
// LS1 setup: EDGE SFup (0:instant)
// LS2 setup: (EDGE SFup (0:instant)) AND SAup
g_model.logicalSw[0] = { SWSRC_SF2, -129, -1, LS_FUNC_STAY };
g_model.logicalSw[1] = { SWSRC_SF2, -129, -1, LS_FUNC_STAY, 0, 0, SWSRC_SA2 };
simuSetSwitch(0, -1); //SA down
simuSetSwitch(5, 0); //SF down
// EXPECT_EQ(getSwitch(SWSRC_SF2), false);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
// now trigger SFup, LS1 should become true
simuSetSwitch(5, 1); //SF up
// EXPECT_EQ(getSwitch(SWSRC_SF2), true);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), true);
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
// now release SA0 and SW2 should stay true
simuSetSwitch(5, 0); //SF down
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
// now reset logical switches
logicalSwitchesReset();
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
// second part with SAup
simuSetSwitch(0, 1); //SA up
simuSetSwitch(5, 0); //SF down
// EXPECT_EQ(getSwitch(SWSRC_SF2), false);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
// now trigger SFup, LS1 should become true
simuSetSwitch(5, 1); //SF up
// EXPECT_EQ(getSwitch(SWSRC_SF2), true);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), true);
EXPECT_EQ(getSwitch(SWSRC_SW2), true);
// now release SA0 and SW2 should stay true
simuSetSwitch(5, 0); //SF down
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
// now reset logical switches
logicalSwitchesReset();
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
// now bug #2939
// SF is kept up and SA is toggled
simuSetSwitch(0, -1); //SA down
simuSetSwitch(5, 1); //SF up
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), true);
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
simuSetSwitch(0, 1); //SA up
simuSetSwitch(5, 1); //SF up
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
simuSetSwitch(0, -1); //SA down
simuSetSwitch(5, 1); //SF up
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
//test what happens when EDGE condition is true and
//logical switches are reset - the switch should fire again
simuSetSwitch(0, 1); //SA up
simuSetSwitch(5, 1); //SF up
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false); //switch will not trigger, because SF was already up
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
logicalSwitchesReset();
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), true);
EXPECT_EQ(getSwitch(SWSRC_SW2), true);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
}
TEST(getSwitch, edgeRelease)
{
MODEL_RESET();
MIXER_RESET();
// test for issue #2728
// LS1 setup: EDGE SFup (0:release)
// LS2 setup: (EDGE SFup (0:release)) AND SAup
g_model.logicalSw[0] = { SWSRC_SF2, -129, 0, LS_FUNC_STAY };
g_model.logicalSw[1] = { SWSRC_SF2, -129, 0, LS_FUNC_STAY, 0, 0, SWSRC_SA2 };
simuSetSwitch(0, -1); //SA down
simuSetSwitch(5, 0); //SF down
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
simuSetSwitch(5, 1); //SF up
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
simuSetSwitch(5, 0); //SF down
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), true);
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
// second part with SAup
simuSetSwitch(0, 1); //SA up
simuSetSwitch(5, 0); //SF down
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
simuSetSwitch(5, 1); //SF up
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
simuSetSwitch(5, 0); //SF down
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), true);
EXPECT_EQ(getSwitch(SWSRC_SW2), true);
// with switches reset both should remain false
logicalSwitchesReset();
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
}
#endif // #if defined(CPUARM)