Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cfb617228b | |||
| d21efcc125 | |||
| 5e1f2bc018 |
-12
@@ -1,12 +0,0 @@
|
||||
/.idea/
|
||||
/.*project
|
||||
/.settings
|
||||
/.autotools
|
||||
radio/src/bootloader/.dep/
|
||||
radio/src/bootloader/bootloader_ramBoot*
|
||||
*.lbm
|
||||
*.o
|
||||
/doc/
|
||||
*.stamp
|
||||
radio/src/lua/lua_fields_*.txt
|
||||
radio/src/lua/lua_exports_*.txt
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
language: cpp
|
||||
|
||||
before_install:
|
||||
- sudo apt-get remove cmake cmake-data --yes
|
||||
- sudo add-apt-repository ppa:george-edison55/precise-backports --yes
|
||||
- sudo add-apt-repository ppa:terry.guo/gcc-arm-embedded --yes
|
||||
- sudo apt-get update
|
||||
|
||||
install:
|
||||
- sudo apt-get install -y xvfb 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
|
||||
- mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Debug -DPCB=TARANIS .. && cmake --build .
|
||||
@@ -1,22 +0,0 @@
|
||||
project(OpenTX)
|
||||
|
||||
set(VERSION_MAJOR "2")
|
||||
set(VERSION_MINOR "2")
|
||||
set(VERSION_REVISION "0")
|
||||
set(VERSION_SUFFIX $ENV{OPENTX_VERSION_SUFFIX})
|
||||
set(VERSION_FAMILY ${VERSION_MAJOR}.${VERSION_MINOR})
|
||||
set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION}${VERSION_SUFFIX})
|
||||
message(STATUS "OpenTX ${VERSION}")
|
||||
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
set(RADIO_DIRECTORY ${PROJECT_SOURCE_DIR}/radio)
|
||||
set(RADIO_SRC_DIRECTORY ${RADIO_DIRECTORY}/src)
|
||||
set(COMPANION_SRC_DIRECTORY ${PROJECT_SOURCE_DIR}/companion/src)
|
||||
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)
|
||||
|
||||
add_subdirectory(${RADIO_SRC_DIRECTORY})
|
||||
add_subdirectory(${COMPANION_SRC_DIRECTORY})
|
||||
-19
@@ -1,19 +0,0 @@
|
||||
Bertrand Songis (bsongis)
|
||||
André Bernet (kilrah)
|
||||
Michael Blandford
|
||||
Damjan Adamic (projectkk2glider)
|
||||
Franck Aguerre (jivarofad)
|
||||
Romolo Manfredini (romoloman)
|
||||
Martin Hotař (mhotar)
|
||||
|
||||
Rob Thomson
|
||||
Bryan J. Rentoul (gruvin)
|
||||
Cameron Weeks (th9xer)
|
||||
Andreas Weitl
|
||||
Kjell Kernen
|
||||
Gabriel Birkus
|
||||
Jean-Pierre Parisy
|
||||
Karl Szmutny
|
||||
Michal Hlavinka
|
||||
Pat Mackenzie
|
||||
Michael Byrne
|
||||
-852
@@ -1,852 +0,0 @@
|
||||
<a href="http://frsky-rc.com">FrSky (monthly)</a>
|
||||
<a href="http://alofthobbies.com">Aloft Hobbies</a>
|
||||
<a href="http://jonathan.it">Jonathan Modellismo</a>
|
||||
<a href="http://wstech.de">WsTech</a>
|
||||
<a href="http://aviomotive.com">Aviomotive</a>
|
||||
<a href="http://boltrc.com">BoltRC</a>
|
||||
<a href="http://aerialtechhobbies.com">Aerial Tech Hobbies</a>
|
||||
<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
|
||||
Alessandro Mari
|
||||
Gianpiero Spontina
|
||||
Ingo Kuzniak
|
||||
Hans-Åke Rahm
|
||||
Tamas Varga
|
||||
Thomas Gregg
|
||||
Didier Christien
|
||||
Alain Pinard
|
||||
Sergio Melas
|
||||
Paul Montenot
|
||||
Chris Guy
|
||||
Adrien Gravouille
|
||||
Thomas Black
|
||||
Marc Lucht
|
||||
Zdenek Trojanek
|
||||
Martin Hotar
|
||||
Stefan Grundevik
|
||||
Fabio Eboli
|
||||
Federico Zotti
|
||||
Albin Esbjörnsson
|
||||
Kilian Hüttenhofer
|
||||
Stephen Stough
|
||||
Adilson Oliveira
|
||||
Robert Saint Marie
|
||||
Tad Leake
|
||||
Andreas Weitl
|
||||
Chan Lofland
|
||||
Dirk Kasten
|
||||
Denisov Alexander
|
||||
Timo Varppee
|
||||
Ondrej Hatapka
|
||||
Valérie Billon
|
||||
R. Scott Page
|
||||
Johan Cronje
|
||||
Renato Aranghelovici
|
||||
Jeffrey Irvin
|
||||
John Rodgers
|
||||
Kenneth Crump
|
||||
Damjan Adamic
|
||||
Martin Wilson
|
||||
Joe Street
|
||||
John Holdsworth
|
||||
Daniel Schwartz
|
||||
Dean Church (monthly)
|
||||
Michael Halse
|
||||
David Mark
|
||||
Ted Moss
|
||||
Jim Wagner
|
||||
Nicola Porzi
|
||||
Michael Halse
|
||||
Chewytm
|
||||
Espen Solbu
|
||||
Mike Frizell
|
||||
Bruce Jones
|
||||
Stefano Airaghi
|
||||
Dan Eeckhout
|
||||
Alex Calderhead
|
||||
Leonard MacKey
|
||||
Heung Jin Choi
|
||||
Mike Retterer
|
||||
Keith Wood
|
||||
Viljo Liukku
|
||||
Eric Beier
|
||||
Burt Pickard-Richardson
|
||||
Helmut Renz
|
||||
Rick Harms
|
||||
Vincenzo Vavala
|
||||
Patricia Martin
|
||||
Harald Klein
|
||||
Carl Petersen
|
||||
Douglas Burkett
|
||||
Clifford Evans
|
||||
Teodor Yantchev
|
||||
Jarad Berkman
|
||||
Christian Schulz
|
||||
Gregory J Shepherd
|
||||
Michael Shellim
|
||||
Ming Wang
|
||||
Bernard Lukaschek
|
||||
Nigel Chippindale
|
||||
Mike Perkins
|
||||
Ted Hammond
|
||||
David Beanland
|
||||
Bernd Koehler
|
||||
Frédéric Duflos
|
||||
Dave Fasken
|
||||
Heinrich Illig
|
||||
Michael Collins
|
||||
Michael Manning
|
||||
Craig Lorentz
|
||||
André Lasseret
|
||||
Felipe Alexandre de Oliveira
|
||||
Brian Harris
|
||||
Philippe Herbots
|
||||
Rainer Nelte
|
||||
Franck Bernhard
|
||||
Erhard Werner
|
||||
Stig Jøran Moen
|
||||
Keith Hertzog
|
||||
Christophe Dauvergne
|
||||
Tauno Rautakorpi
|
||||
Sven Assmus
|
||||
Paul Dittman
|
||||
Mike Matheny
|
||||
Cheryl Wynne
|
||||
Emay Toha
|
||||
Don Nolder
|
||||
André Lasseret
|
||||
Filip Lowette
|
||||
Arnaldo Gabella
|
||||
Fiorenzo Agnelli
|
||||
Michele Villa
|
||||
Christophe Rodriguez
|
||||
Larisa Filocamo
|
||||
Hartmut Sahm
|
||||
Åke Brodin
|
||||
Ted Moss
|
||||
Filippos Tigarakis
|
||||
Chewytm
|
||||
Eric Burdis
|
||||
Nigel Chippindale
|
||||
Michael Deasy
|
||||
Stephen Stough
|
||||
Kenneth Lilja (monthly)
|
||||
Robert Jero
|
||||
Gary Bancroft
|
||||
Robert Cotsford
|
||||
NorthSide
|
||||
George Constandinides
|
||||
Robert Schonk Jr
|
||||
Kevin Berkefeld
|
||||
Peter Webster
|
||||
Mike Matheny
|
||||
Martin Sniedze
|
||||
Fernando Rimoldi
|
||||
Sidney Fisher
|
||||
Bruce Anderson
|
||||
John Rodgers
|
||||
Ed Pare
|
||||
Thomas Kilduff
|
||||
Robert Ferguson
|
||||
Bryan Green
|
||||
Kevin Berkefeld
|
||||
Julien Michel
|
||||
Krittikun Chiraphanda
|
||||
Douglas Law
|
||||
Alberto Scotti
|
||||
Oliver Kunkel
|
||||
D. Joseph Frazier
|
||||
Heiko Polig
|
||||
Andrew Fernie
|
||||
Marco Lange
|
||||
Nick McMillan
|
||||
Michel Baily (monthly)
|
||||
Patrick Mullen
|
||||
Scott Campbell
|
||||
Erich Roeder
|
||||
Wayne Davy
|
||||
Michael Fontenot
|
||||
Willie Swanepoel
|
||||
Satoru Sasaki
|
||||
Tyler Darby
|
||||
Nicholas Crego
|
||||
Johan Moelich
|
||||
Timo Esser
|
||||
Brian Paddock
|
||||
Jean Pierre Parisy
|
||||
Norbert Martsch
|
||||
Jean-Marie Guitard
|
||||
Tilman Baumann
|
||||
Fred Larssen
|
||||
Ari Aalto
|
||||
Robert Sams
|
||||
Kirk Robertson
|
||||
John Koontz
|
||||
Jeffery Golias
|
||||
Paul Robinson
|
||||
Dave Matison
|
||||
Mike Matheny
|
||||
Pino Agostino
|
||||
Graham Boucher
|
||||
Nelson Noura
|
||||
Joel Allamy
|
||||
Philip David Martin
|
||||
Sean Stephen
|
||||
Bruce Mackay
|
||||
Blake Spilman
|
||||
Timothy Pelletier
|
||||
Glen Roe (ShowMaster)
|
||||
Jan Van Ooteghem
|
||||
Lawrence Christensen
|
||||
Leo Duflou
|
||||
Bruce Wood
|
||||
Arnd Feige
|
||||
Tauno Rautakorpi
|
||||
Steve Coley
|
||||
Stefan Kiendl
|
||||
Gregory Nuspel
|
||||
Mitchell Brenner
|
||||
Ronnnie DePrez
|
||||
Ferenc Koller
|
||||
Robert Sessler
|
||||
Didier Lanot
|
||||
Rodney Hunt
|
||||
Steve Bernard
|
||||
Paul Nazaroff
|
||||
Gordon Ernenputsch
|
||||
Ksamak
|
||||
Marc Gittelman
|
||||
David Poole
|
||||
Ralph Sauer
|
||||
Karl-Heinz Gansel
|
||||
Michels Bernhard
|
||||
Thomas Demmelbauer
|
||||
Felice Baratto
|
||||
Michael Halse
|
||||
Horst Kampen
|
||||
Ian Gough
|
||||
Matthew Brett
|
||||
Lexington S Morley
|
||||
Clemens Drews
|
||||
Axel Stöckle
|
||||
Roberto Orsello
|
||||
Richard Ruck
|
||||
Hugh Caldwell
|
||||
Christian Marauli
|
||||
Albin Esbjörnsson
|
||||
Per Esbjörnsson
|
||||
Bernd Hohmann
|
||||
Sławomir Juszczak
|
||||
Stephen Henderson
|
||||
David Morgan
|
||||
Aloft Hobbies
|
||||
Netanel Hobara
|
||||
Cameron Galipo
|
||||
Doug Schafer
|
||||
Pietro Rossin
|
||||
Earl Killingsworth
|
||||
Victor B Wright
|
||||
Terry McKinley
|
||||
Марков Алексей
|
||||
Offer Shmuely
|
||||
Ian Lobley
|
||||
Stéphane Fortas
|
||||
Peter Mitrik
|
||||
Thomas Majewski
|
||||
ANF King
|
||||
Henrik Hammarström
|
||||
Kenneth Lilja
|
||||
R Wells
|
||||
Uwe Jordt
|
||||
Harald Wilczak
|
||||
Bernhard Lohmann
|
||||
Ferenc Koller
|
||||
Robert Ferguson
|
||||
Daniel Byers
|
||||
Tyler Darby
|
||||
Miguel Villalpando
|
||||
Kim Dong Hoon
|
||||
Terry McKinley
|
||||
Walter Bell
|
||||
Clinton Linck
|
||||
Josep Clodas Sola
|
||||
Thierry Martin
|
||||
Peter Mauro
|
||||
Mitchell Brenner
|
||||
Yak
|
||||
Lluis Bullich Rañe
|
||||
Steffen Rohr
|
||||
Eric Jacquin
|
||||
Harvest Lane
|
||||
Ville Kuvaja
|
||||
DK-System
|
||||
Heinz Vogel
|
||||
Heung Jin Choi
|
||||
MMJS van der Helm
|
||||
Dan Neelands
|
||||
Yashiro Masayuki
|
||||
Isaac Sloan
|
||||
Harold Baird
|
||||
Roy Bender
|
||||
Bradley Murchie
|
||||
Maximilian Süß
|
||||
Dean Jansa
|
||||
Ronald Donker
|
||||
Paul Oldenkamp
|
||||
Dietmar Drees
|
||||
Bradley Murchie
|
||||
Richard Fahie
|
||||
James Kaufman
|
||||
Henry Deucker
|
||||
Christian Fuchs
|
||||
Arold Reinders
|
||||
Robert Miller
|
||||
Mark Gaskievicz
|
||||
Roland Müller
|
||||
Frank Gewalt
|
||||
Remi Viard
|
||||
Reginald H Millsom
|
||||
Pierluigi Sommaruga
|
||||
A Harris
|
||||
Stefan Grunenberg
|
||||
Francisco Gutierrez Muñoz
|
||||
Steve Coley
|
||||
Sean Cull
|
||||
Roberto Orsello
|
||||
David Finger
|
||||
Jean-Marie Oddo
|
||||
Mike Matheny
|
||||
Glen Roe (Showmaster)
|
||||
Arron Bates
|
||||
Tim Spurr
|
||||
Daniel Morgan
|
||||
Trent Ready
|
||||
Mark Maskiell
|
||||
Robert Crockford
|
||||
Mark Illum
|
||||
David McGuire
|
||||
Martyn Coles
|
||||
Jose Sobral
|
||||
Heung Jin Choi
|
||||
Tomasz Janiak
|
||||
Fabien Gagné
|
||||
Joe Street
|
||||
Micha Ronen
|
||||
Albert Blondin
|
||||
Klaus Schuebel
|
||||
Evening Shade Pottery
|
||||
Thomas Kilduff
|
||||
Sven Assmus
|
||||
Markus Eberl
|
||||
Nicholas Field
|
||||
Harald Wilczak
|
||||
John Grepps
|
||||
Anthony Burbidge
|
||||
Sherba Baine
|
||||
Gordon Evans
|
||||
Fred Figge
|
||||
Uwe Kuehn
|
||||
David Beatty
|
||||
Aaron Stringer
|
||||
Alan J Wasserman
|
||||
Wolfgang Rauser
|
||||
Samuel Cook
|
||||
Friedrich Ipolt
|
||||
Barrington Cole
|
||||
Charles Lakins
|
||||
Thos. O'Meara Photography
|
||||
Adam Chevalier
|
||||
Mike Mulligan
|
||||
Serge Michaux
|
||||
Robert Young
|
||||
Wilco Hijink
|
||||
Roy Nixon
|
||||
Lexington S Morley
|
||||
Daryl Dacko
|
||||
Beat Zurflueh
|
||||
Piotr Kundu
|
||||
Kevin Berkefeld
|
||||
Tomasz Klys
|
||||
Mirco Didone'
|
||||
Christoph Schroeter
|
||||
Zdenek Trojanek
|
||||
Bryan Anderson
|
||||
Kamco Enterprises
|
||||
Robert Bates
|
||||
Robert Brown
|
||||
Dennis Marinus
|
||||
Ronald Van Putte
|
||||
Thomas Kvitle Jenssen
|
||||
Patrick Tuxbury
|
||||
Istvan Magi
|
||||
Sasaki Satoru
|
||||
David Laburthe
|
||||
Vit Jelinek
|
||||
Pablo Gomez Martinez
|
||||
Alan Thoren
|
||||
Jack Clodfelter
|
||||
William Simon
|
||||
James Houck
|
||||
Peter Fithern
|
||||
Thomas Svedman
|
||||
TechFixPros
|
||||
Rafael Eric Suarez Nordlow
|
||||
Colin Rycroft
|
||||
Emanuel Stassar
|
||||
Michael Gregory
|
||||
Robert Russell
|
||||
Felix Kaiser
|
||||
Joshua Bardwell
|
||||
Davd Goodall
|
||||
Leonard MacKey
|
||||
Miles Kelly
|
||||
Sergio Robledo
|
||||
Mikael Wallbäck
|
||||
Daniel Malcman
|
||||
Paul Dittman
|
||||
Attilio Rausse
|
||||
Sidney Gates
|
||||
Andrea Montefusco
|
||||
Paul Luby
|
||||
Donald L Webster
|
||||
Kenneth Frehafer
|
||||
Matthias Hase
|
||||
Markus Wolf
|
||||
Andrew Fazio
|
||||
Stefan Künst
|
||||
Stephen Adams
|
||||
Tauno Rautakorpi
|
||||
Frank Houvenaghel
|
||||
George Neusse
|
||||
Andreja Rusjakovski
|
||||
Axel Stöckle
|
||||
Erwin Störrle
|
||||
Rodger Hopper
|
||||
Fernando Cesar
|
||||
Jonathan Gillis
|
||||
DK-System
|
||||
Lexington S Morley
|
||||
Bernd Koehler
|
||||
Davis RC
|
||||
Pete Johnson
|
||||
Patricia Martin
|
||||
Florian Tschacher
|
||||
Brian Spearing
|
||||
Craig Hall
|
||||
Joseph Case
|
||||
Harald Klein
|
||||
Robert Crockford
|
||||
Chris Boultinghouse
|
||||
Kitsew
|
||||
Georgios Papadopoulos
|
||||
Fourmost Products
|
||||
Dennis Miller
|
||||
Dave Matison
|
||||
Maximilian Radig
|
||||
Juan Rodriguez
|
||||
Robert Sessler
|
||||
John Murray
|
||||
Martin Sniedze
|
||||
David Poole
|
||||
Manfred Delakowitz
|
||||
Martijn Kruissen
|
||||
Jörgen Norman
|
||||
Nathan Kinney
|
||||
John Godden
|
||||
Larry Roper
|
||||
Mike Frizell
|
||||
Daniel Pospolita
|
||||
Peter Herz
|
||||
Don Mondrik
|
||||
Paul Fram
|
||||
Charles Knight
|
||||
Matthew Adams
|
||||
Kenneth Reed
|
||||
Gary Wild
|
||||
Christof Ramm
|
||||
Bruno Bedard
|
||||
Salih Samim Aydin
|
||||
Alexander Pils
|
||||
Andrew Scerbina
|
||||
Donovan Bodishbaugh
|
||||
Ray Dunn
|
||||
Burt Pickard-Richardson
|
||||
Robert Ferguson
|
||||
CY Enterprise
|
||||
Michel Stathakis Neto
|
||||
Beat Zurflueh
|
||||
Portstate Pty Ltd
|
||||
Jens Hoffmann
|
||||
Ricardo Santos
|
||||
Jean-Francois Le Breton
|
||||
Michael Deasy
|
||||
Anindya Mukerjee
|
||||
Emay Toha
|
||||
Kamco Enterprises
|
||||
Peter Mueller
|
||||
Giovanni Trentini
|
||||
Cecil Porter
|
||||
Robert Canavan
|
||||
Greg Higginbottom
|
||||
Tim Walker
|
||||
Spis Ltd/TurboNote
|
||||
Patricia Cox
|
||||
Matthew Lukes
|
||||
Sabine Witte
|
||||
Phillip Perry
|
||||
Beat Zurflueh
|
||||
Russell Stutzman
|
||||
Dietmar Drees
|
||||
Kenneth Ward
|
||||
Jens Lochmüller
|
||||
Anthony Witham
|
||||
Peter Hauke
|
||||
Arizona Action Photos
|
||||
Francis F Dale
|
||||
Willie Swanepoel
|
||||
Edward Hauser
|
||||
Adilson Oliveira
|
||||
Joseph Ordille
|
||||
Michael Shellim
|
||||
Teddie Holmes
|
||||
Alexandre Rault
|
||||
Eric Albin
|
||||
Lukas Kliment
|
||||
Bernard Philippe
|
||||
Bernard Delpy
|
||||
Didier Klein
|
||||
Arnaldo Guedes
|
||||
Cyberauto Systems
|
||||
John Alsbrooks
|
||||
John Kearney
|
||||
Christopher Borden
|
||||
Marc Virgilio Ricci
|
||||
Frederick Davie
|
||||
Jürgen Enders
|
||||
Terrence Pitts
|
||||
Thomas Sandner
|
||||
Marco Coltorti
|
||||
Harald Wilczak
|
||||
Rodney Lorimor
|
||||
Richard Davis
|
||||
Stephen Palmer
|
||||
Michael Napolitan
|
||||
Joshua Bardwell
|
||||
Fred Dawson
|
||||
Jim Wagner
|
||||
Peter Johnson
|
||||
Fredrik Lewerth
|
||||
Arvin Stenersen
|
||||
Daniel Morgan
|
||||
Roy Nixon
|
||||
Joachim Blunck
|
||||
Karl-Heinz Gansel
|
||||
Monrovia Mountain Enterprises
|
||||
Alessandro Villa
|
||||
Jan-Åke Nilsson
|
||||
Matthias Rei
|
||||
DVR Solutions BV
|
||||
Bertrand Condevaux Lanloy
|
||||
Henri Mirra
|
||||
Aurélien Planiol
|
||||
Kevin Caldwell
|
||||
Andrew Garello
|
||||
Tomasz Maziarz
|
||||
Russell Flack
|
||||
Fernando Rimoldi
|
||||
Greg Reid
|
||||
Dietmar Drees
|
||||
Holger Landwehr
|
||||
Arno Loehdorf
|
||||
Boon Sripattha
|
||||
Patrik Åkerfeldt
|
||||
Alonzo Fretwell
|
||||
Renjith Chandrasekharan
|
||||
Ruben Gomez Hernandez
|
||||
Michael Gardner
|
||||
Judith Green
|
||||
Timo Ruppell
|
||||
John Lipscomb
|
||||
Norbert Wenke
|
||||
Erik Frieberg
|
||||
Raimo Ruotsalainen
|
||||
Brian Harris
|
||||
Sebastian Blüml
|
||||
Efisio Maxia
|
||||
Jeff Theobald
|
||||
Anthony Rizzo
|
||||
Rodney Huddleston
|
||||
Dietmar Drees
|
||||
Jürgen Monden
|
||||
David Morgan
|
||||
Andrew Fernie
|
||||
Donald Burke
|
||||
Ronald Donker
|
||||
Fredie Singh
|
||||
Patrizio Simoncini
|
||||
Harald Gabler
|
||||
Michael Brown
|
||||
Julien Gérard
|
||||
Alexandre d'Alton
|
||||
Peter Mergaerts
|
||||
Jan Houwers
|
||||
Christian Grandjean
|
||||
Roger Bergevin
|
||||
NorthSide
|
||||
Sigmund Martinsen
|
||||
Lionel Lafraise
|
||||
Gisli Ofeigsson
|
||||
The Gruvin9x Project
|
||||
Manuel McLure
|
||||
Fernando Rimoldi
|
||||
Hiltenkamp Stephan
|
||||
Sandeep Kishore Jain
|
||||
Greg Parker
|
||||
Norman Maaß
|
||||
Adriano Del Ben
|
||||
Justin Poole
|
||||
Kenneth Harrison
|
||||
Eugene LaFaille
|
||||
John O'Shaughnessy
|
||||
Uwe Jordt
|
||||
Stuart Olson
|
||||
Frédéric Devillard
|
||||
Cheung Leo
|
||||
Peter Webster
|
||||
Jean-Claude Bachetta
|
||||
Delfin Perena
|
||||
Sae-wook Yoon
|
||||
Focus on Excellence
|
||||
Jeffery Golias
|
||||
Nick Milton
|
||||
Paul Zasso
|
||||
Reidar Johannes Lillebotn
|
||||
Handley William
|
||||
Luke Williams
|
||||
Michael Shellim
|
||||
Brian Spearing
|
||||
Derek Foster
|
||||
Pasi Pitkänen
|
||||
Lexington S Morley
|
||||
Jeff Roberson
|
||||
Volkov Victor
|
||||
Bryan Anderson
|
||||
Daniel Garber
|
||||
Pavel Stein
|
||||
Ravi Gupta
|
||||
Patrick Tuxbury
|
||||
Mark Deverell
|
||||
John Capell
|
||||
Neil McVean
|
||||
Matthew Elyash
|
||||
Kerry Cochrell
|
||||
Willem Aandewiel
|
||||
Reg Bell
|
||||
Jean Chenoz
|
||||
Philippe Grand
|
||||
Tauno Rautakorpi
|
||||
Jeff Dillingham
|
||||
Brad Kelley
|
||||
Shaun Currier
|
||||
Danilo Schiara
|
||||
John Hennig
|
||||
RK Custom Homes
|
||||
James Houck
|
||||
Piet Teekens
|
||||
Tommy Widenflycht
|
||||
Johan Petrus Theophilus
|
||||
Maria van Melis
|
||||
Ralph Gustafson
|
||||
Paul Luby
|
||||
Andrew Duncan
|
||||
Stephen Crowther
|
||||
Edward Glover
|
||||
Kelly Byrd
|
||||
Brad Curtis
|
||||
Wolfgang Kuhl
|
||||
John Beidl
|
||||
Roy Nixon
|
||||
Glen Roe
|
||||
CY Enterprise
|
||||
Evening Shade Pottery
|
||||
Gilles Dando
|
||||
Patrick Richard
|
||||
Justin Altemeier
|
||||
Constant Dupuis
|
||||
Tony Kenward
|
||||
Pierre Rondel
|
||||
Ernest Luguera Sanchez
|
||||
Adam Brackney
|
||||
Joe Baker
|
||||
单 雷平
|
||||
Ben Fay
|
||||
Chris Monk
|
||||
Stan von Miller
|
||||
Christian Krebs
|
||||
Michel Motte
|
||||
Graziano Rampinelli
|
||||
Joe Baker
|
||||
Jean-Philippe Laurent
|
||||
Romain Rouzaud
|
||||
Michel Garbarino
|
||||
Henri Mirra
|
||||
Otto Fröhlich
|
||||
Thomas Cramer
|
||||
Anthony Trombetta
|
||||
Fernando Rimoldi
|
||||
Dietmar Drees
|
||||
Michal Kowalski
|
||||
Ivan Correa
|
||||
Modellbau
|
||||
Massimo Luigi Stara
|
||||
Graham Baldwin
|
||||
Tomasz Rejman
|
||||
Wolfgang Lang
|
||||
John Greenwood
|
||||
Till von Reumont
|
||||
Paul Pereira Brunner
|
||||
Donald L Singer
|
||||
Junsun Lee
|
||||
Guy Lamaison
|
||||
Erwin Dulken
|
||||
Mike H Dailey
|
||||
Jon Cammarata
|
||||
Martin Krueger
|
||||
Adolfo Perogio
|
||||
Sylvain Techer
|
||||
Wes Warner
|
||||
Kevin Caldwell
|
||||
Ali Ersan Gur
|
||||
Hans-Rudolf Riniker
|
||||
Sébastien Boutard
|
||||
Jean Chessé
|
||||
Mike H Dailey
|
||||
Don Polk
|
||||
Roberto Orsello
|
||||
Borovikov Dmitriy
|
||||
John Lipscomb
|
||||
Peter Glassey
|
||||
Joseph Kramer
|
||||
F.Javier Martinez Velasco
|
||||
Claudio Piccinini
|
||||
John Jackson
|
||||
John Beech
|
||||
Rene TraaJohn Jackson
|
||||
Sebastien Charpentier (monthly)
|
||||
Nigel Hendriks
|
||||
Frédéric Devillard
|
||||
Albert Herzog
|
||||
Anindya Mukerjee
|
||||
Kenny Stanberry
|
||||
Tauno Rautakorpi
|
||||
Mathias Krapp
|
||||
Fernando Rimoldi
|
||||
Wolfgang Rauser
|
||||
Richard Shagam
|
||||
Stephen Bailey
|
||||
DK-System
|
||||
Casa Kuxtal
|
||||
Christopher Potts
|
||||
Douglas George
|
||||
Michael Banks
|
||||
Jon Wiltshire
|
||||
David Green
|
||||
Guy Willems
|
||||
Xavier Mestelan Pinon
|
||||
Maik Gottschalk
|
||||
Scott Sparks
|
||||
John Dunning
|
||||
RAD51
|
||||
Ron Powell
|
||||
Alain Labonne
|
||||
Carol Sills
|
||||
Franck Aßmann
|
||||
Larry Anderson
|
||||
Mikael Wallbäck
|
||||
Wes Warner
|
||||
Christoffer H Henni
|
||||
Donna Bayer
|
||||
Garry Ogilvie
|
||||
Karlheinz Sirsch
|
||||
Fred Larssen
|
||||
Rob Coppock
|
||||
Franz Josef Hahn
|
||||
Serge Ribault
|
||||
Tanguy Le Moign
|
||||
Barrett Powell
|
||||
Patrice Lafeuille
|
||||
Martin Blume
|
||||
Marek Kopyto
|
||||
Marco Lange
|
||||
Gary Nix
|
||||
Jack Oliphant
|
||||
John Lever
|
||||
Adolphe Montefiore
|
||||
Steven De Weerdt
|
||||
Håkan Berggen
|
||||
Ayelet Egosi
|
||||
Jean-Frederic Gaudreault
|
||||
Jim Wagner
|
||||
Lee Scott
|
||||
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
|
||||
Gregory Barron
|
||||
Marcel Fischer
|
||||
Klas Mälman
|
||||
Viljo Liukku
|
||||
Eric Smith
|
||||
Sven Assmus
|
||||
Luke Mole
|
||||
NorthSide
|
||||
Hannes Mössler
|
||||
James Kaufman
|
||||
Ravi Gupta
|
||||
Lexington S Morley
|
||||
Ralph Segar
|
||||
Frédéric Devillard
|
||||
Cory Theurer
|
||||
Valentinos Zachariou
|
||||
Garrett Paquette
|
||||
Heung Jin Choi
|
||||
Kerry Cochrell
|
||||
Doug Miller
|
||||
Andrzej Weydmann
|
||||
Chair-man.nl
|
||||
Eric Beier
|
||||
Jay Warren
|
||||
Marian Matej
|
||||
Alastair Smith
|
||||
Timothy Senecal
|
||||
Dietmar Drees
|
||||
Bruce Jones
|
||||
Adil Busaidy
|
||||
Herman Hofman
|
||||
Jean Paul Michel
|
||||
Peter McHenry
|
||||
Julien lecoquierre
|
||||
Jean-Marie Clay
|
||||
Robert Nicoll
|
||||
Dan Nixon
|
||||
Ewald Moehring
|
||||
Giovanni Carnesecchi
|
||||
Paul Dumsday
|
||||
Tadeusz Adamowski
|
||||
Andrew Newton
|
||||
Neil Horne
|
||||
Kerstin Appelqvist
|
||||
@@ -1,339 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
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.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
@@ -1,9 +1,7 @@
|
||||
##OpenTX 2.2 Branch
|
||||
##OpenTX Master Branch
|
||||
|
||||
[](https://travis-ci.org/opentx/opentx)
|
||||
[](https://gitter.im/opentx/opentx?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=DJ9MASSKVW8WN)
|
||||
You have found your way to the GitHub repository site for the OpenTX Master Branch. This code branch holds the source code for the latest stable releases.
|
||||
|
||||
The ongoing development on 2.2.x is done in this branch.
|
||||
The ongoing development is taking place in the next branch, not here.
|
||||
|
||||
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.
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
macro(add_bitmaps_target targetname filter width format)
|
||||
file(GLOB bitmaps ${filter})
|
||||
foreach(bitmap ${bitmaps})
|
||||
get_filename_component(target ${bitmap} NAME_WE)
|
||||
set(target ${target}.lbm)
|
||||
add_custom_command(
|
||||
OUTPUT ${target}
|
||||
COMMAND python ${RADIO_DIRECTORY}/util/img2lbm.py ${bitmap} ${target} ${width} ${format}
|
||||
DEPENDS ${bitmap}
|
||||
)
|
||||
list(APPEND bitmaps_files ${target})
|
||||
endforeach()
|
||||
add_custom_target(${targetname} DEPENDS ${bitmaps_files})
|
||||
endmacro(add_bitmaps_target)
|
||||
|
||||
macro(add_truetype_font_target radio name font size bold)
|
||||
set(target ${RADIO_SRC_DIRECTORY}/fonts/${radio}/font_${name})
|
||||
add_custom_command(
|
||||
OUTPUT ${target}.png
|
||||
OUTPUT ${target}.specs
|
||||
COMMAND ${RADIO_DIRECTORY}/util/font2png.py ${font} ${size} ${bold} ${target}
|
||||
WORKING_DIRECTORY ${RADIO_SRC_DIRECTORY}
|
||||
)
|
||||
add_custom_target(ttf_${radio}_${name} DEPENDS ${target}.png ${target}.specs)
|
||||
endmacro(add_truetype_font_target)
|
||||
@@ -1,19 +0,0 @@
|
||||
# Locate lupdate binary from QT
|
||||
|
||||
# This module defines
|
||||
# LUPDATE_EXECUTABLE, where is QT lupdate
|
||||
# LUPDATE_FOUND, if false, don't try to use lupdate
|
||||
|
||||
FIND_PROGRAM( LUPDATE_EXECUTABLE
|
||||
NAMES
|
||||
lupdate lupdate-qt4
|
||||
)
|
||||
|
||||
MESSAGE( STATUS ${LUPDATE_EXECUTABLE} )
|
||||
|
||||
# if the program is found then we have it
|
||||
IF( LUPDATE_EXECUTABLE )
|
||||
SET( LUPDATE_FOUND "YES" )
|
||||
ENDIF( LUPDATE_EXECUTABLE )
|
||||
|
||||
MARK_AS_ADVANCED( LUPDATE_EXECUTABLE )
|
||||
@@ -1,71 +0,0 @@
|
||||
# Find libphonon
|
||||
# Once done this will define
|
||||
#
|
||||
# PHONON_FOUND - system has Phonon Library
|
||||
# PHONON_INCLUDES - the Phonon include directory
|
||||
# PHONON_LIBS - link these to use Phonon
|
||||
# PHONON_VERSION - the version of the Phonon Library
|
||||
|
||||
# Copyright (c) 2008, Matthias Kretz <kretz@kde.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
macro(_phonon_find_version)
|
||||
set(_phonon_namespace_header_file "${PHONON_INCLUDE_DIR}/phonon/phononnamespace.h")
|
||||
if (APPLE AND EXISTS "${PHONON_INCLUDE_DIR}/Headers/phononnamespace.h")
|
||||
set(_phonon_namespace_header_file "${PHONON_INCLUDE_DIR}/Headers/phononnamespace.h")
|
||||
endif (APPLE AND EXISTS "${PHONON_INCLUDE_DIR}/Headers/phononnamespace.h")
|
||||
file(READ ${_phonon_namespace_header_file} _phonon_header LIMIT 5000 OFFSET 1000)
|
||||
string(REGEX MATCH "define PHONON_VERSION_STR \"(4\\.[0-9]+\\.[0-9a-z]+)\"" _phonon_version_match "${_phonon_header}")
|
||||
set(PHONON_VERSION "${CMAKE_MATCH_1}")
|
||||
message(STATUS "Phonon Version: ${PHONON_VERSION}")
|
||||
endmacro(_phonon_find_version)
|
||||
|
||||
if(PHONON_FOUND)
|
||||
# Already found, nothing more to do except figuring out the version
|
||||
_phonon_find_version()
|
||||
else(PHONON_FOUND)
|
||||
if(PHONON_INCLUDE_DIR AND PHONON_LIBRARY)
|
||||
set(PHONON_FIND_QUIETLY TRUE)
|
||||
endif(PHONON_INCLUDE_DIR AND PHONON_LIBRARY)
|
||||
|
||||
# As discussed on kde-buildsystem: first look at CMAKE_PREFIX_PATH, then at the suggested PATHS (kde4 install dir)
|
||||
find_library(PHONON_LIBRARY NAMES phonon phonon4 PATHS ${KDE4_LIB_INSTALL_DIR} ${QT_LIBRARY_DIR} NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
|
||||
# then at the default system locations (CMAKE_SYSTEM_PREFIX_PATH, i.e. /usr etc.)
|
||||
find_library(PHONON_LIBRARY NAMES phonon)
|
||||
|
||||
find_path(PHONON_INCLUDE_DIR NAMES phonon/phonon_export.h PATHS ${KDE4_INCLUDE_INSTALL_DIR} ${QT_INCLUDE_DIR} ${INCLUDE_INSTALL_DIR} ${QT_LIBRARY_DIR} NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
|
||||
find_path(PHONON_INCLUDE_DIR NAMES phonon/phonon_export.h)
|
||||
|
||||
if(PHONON_INCLUDE_DIR AND PHONON_LIBRARY)
|
||||
set(PHONON_LIBS ${phonon_LIB_DEPENDS} ${PHONON_LIBRARY})
|
||||
set(PHONON_INCLUDES ${PHONON_INCLUDE_DIR}/KDE ${PHONON_INCLUDE_DIR})
|
||||
set(PHONON_FOUND TRUE)
|
||||
_phonon_find_version()
|
||||
else(PHONON_INCLUDE_DIR AND PHONON_LIBRARY)
|
||||
set(PHONON_FOUND FALSE)
|
||||
endif(PHONON_INCLUDE_DIR AND PHONON_LIBRARY)
|
||||
|
||||
if(PHONON_FOUND)
|
||||
if(NOT PHONON_FIND_QUIETLY)
|
||||
message(STATUS "Found Phonon: ${PHONON_LIBRARY}")
|
||||
message(STATUS "Found Phonon Includes: ${PHONON_INCLUDES}")
|
||||
endif(NOT PHONON_FIND_QUIETLY)
|
||||
else(PHONON_FOUND)
|
||||
if(Phonon_FIND_REQUIRED)
|
||||
if(NOT PHONON_INCLUDE_DIR)
|
||||
message(STATUS "Phonon includes NOT found!")
|
||||
endif(NOT PHONON_INCLUDE_DIR)
|
||||
if(NOT PHONON_LIBRARY)
|
||||
message(STATUS "Phonon library NOT found!")
|
||||
endif(NOT PHONON_LIBRARY)
|
||||
message(FATAL_ERROR "Phonon library or includes NOT found!")
|
||||
else(Phonon_FIND_REQUIRED)
|
||||
message(STATUS "Unable to find Phonon")
|
||||
endif(Phonon_FIND_REQUIRED)
|
||||
endif(PHONON_FOUND)
|
||||
|
||||
|
||||
mark_as_advanced(PHONON_INCLUDE_DIR PHONON_LIBRARY PHONON_INCLUDES)
|
||||
endif(PHONON_FOUND)
|
||||
@@ -1,165 +0,0 @@
|
||||
# - Locate the SDL library
|
||||
# This module defines
|
||||
# SDL_LIBRARY, the library to link against
|
||||
# SDL_FOUND, if false, do not try to link to SDL
|
||||
# SDL_INCLUDE_DIR, where to find SDL.h
|
||||
#
|
||||
# Don't forget to include SDLmain.h and SDLmain.m your project for the
|
||||
# OS X framework based version. (Other versions link to -lSDLmain which
|
||||
# this module will try to find on your behalf.) Also for OS X, this
|
||||
# module will automatically add the -framework Cocoa on your behalf.
|
||||
# $SDLDIR is an environment variable that would
|
||||
# correspond to the ./configure --prefix=$SDLDIR
|
||||
# used in building SDL.
|
||||
# l.e.galup 9-20-02
|
||||
#
|
||||
# Modified by Eric Wing.
|
||||
# Added new modifications to recognize OS X frameworks and
|
||||
# additional Unix paths (FreeBSD, etc).
|
||||
# Also corrected the header search path to follow "proper" SDL guidelines.
|
||||
# Added a search for SDLmain which is needed by some platforms.
|
||||
# Added a search for threads which is needed by some platforms.
|
||||
# Added needed compile switches for MinGW.
|
||||
#
|
||||
# On OSX, this will prefer the Framework version (if found) over others.
|
||||
# People will have to manually change the cache values of
|
||||
# SDL_LIBRARY to override this selection.
|
||||
#
|
||||
# Note that the header path has changed from SDL/SDL.h to just SDL.h
|
||||
# This needed to change because "proper" SDL convention
|
||||
# is #include "SDL.h", not <SDL/SDL.h>. This is done for portability
|
||||
# reasons because not all systems place things in SDL/ (see FreeBSD).
|
||||
FIND_PATH(SDL_INCLUDE_DIR SDL.h
|
||||
$ENV{SDLDIR}/include
|
||||
~/Library/Frameworks/SDL.framework/Headers
|
||||
/Library/Frameworks/SDL.framework/Headers
|
||||
/usr/local/include/SDL
|
||||
/usr/include/SDL
|
||||
/usr/local/include/SDL12
|
||||
/usr/local/include/SDL11 # FreeBSD ports
|
||||
/usr/include/SDL12
|
||||
/usr/include/SDL11
|
||||
/usr/local/include
|
||||
/usr/include
|
||||
/sw/include/SDL # Fink
|
||||
/sw/include
|
||||
/opt/local/include/SDL # DarwinPorts
|
||||
/opt/local/include
|
||||
/opt/csw/include/SDL # Blastwave
|
||||
/opt/csw/include
|
||||
/opt/include/SDL
|
||||
/opt/include
|
||||
C:/Programs/SDL/include
|
||||
)
|
||||
# I'm not sure if I should do a special casing for Apple. It is
|
||||
# unlikely that other Unix systems will find the framework path.
|
||||
# But if they do ([Next|Open|GNU]Step?),
|
||||
# do they want the -framework option also?
|
||||
IF(${SDL_INCLUDE_DIR} MATCHES ".framework")
|
||||
# The Cocoa framework must be linked into SDL because SDL is Cocoa based.
|
||||
# Remember that the OS X framework version expects you to drop in
|
||||
# SDLmain.h and SDLmain.m directly into your project.
|
||||
# (Cocoa link moved to bottom of this script.)
|
||||
# SET (SDL_LIBRARY "-framework SDL -framework Cocoa" CACHE STRING "SDL framework for OSX")
|
||||
# SET(SDL_LIBRARY "-framework SDL" CACHE STRING "SDL framework for OSX")
|
||||
# Extract the path the framework resides in so we can use it for the -F flag
|
||||
STRING(REGEX REPLACE "(.*)/.*\\.framework/.*" "\\1" SDL_FRAMEWORK_PATH_TEMP ${SDL_INCLUDE_DIR})
|
||||
IF("${SDL_FRAMEWORK_PATH_TEMP}" STREQUAL "/Library/Frameworks"
|
||||
OR "${SDL_FRAMEWORK_PATH_TEMP}" STREQUAL "/System/Library/Frameworks"
|
||||
)
|
||||
# String is in default search path, don't need to use -F
|
||||
SET(SDL_LIBRARY_TEMP "-framework SDL")
|
||||
ELSE("${SDL_FRAMEWORK_PATH_TEMP}" STREQUAL "/Library/Frameworks"
|
||||
OR "${SDL_FRAMEWORK_PATH_TEMP}" STREQUAL "/System/Library/Frameworks"
|
||||
)
|
||||
# String is not /Library/Frameworks, need to use -F
|
||||
SET(SDL_LIBRARY_TEMP "-F${SDL_FRAMEWORK_PATH_TEMP} -framework SDL")
|
||||
ENDIF("${SDL_FRAMEWORK_PATH_TEMP}" STREQUAL "/Library/Frameworks"
|
||||
OR "${SDL_FRAMEWORK_PATH_TEMP}" STREQUAL "/System/Library/Frameworks"
|
||||
)
|
||||
# Clear the temp variable so nobody can see it
|
||||
SET(SDL_FRAMEWORK_PATH_TEMP "" CACHE INTERNAL "")
|
||||
|
||||
ELSE(${SDL_INCLUDE_DIR} MATCHES ".framework")
|
||||
# SDL-1.1 is the name used by FreeBSD ports...
|
||||
# don't confuse it for the version number.
|
||||
FIND_LIBRARY(SDL_LIBRARY_TEMP
|
||||
NAMES SDL SDL-1.1
|
||||
PATHS
|
||||
$ENV{SDLDIR}/lib
|
||||
/usr/local/lib
|
||||
/usr/lib
|
||||
/sw/lib
|
||||
/opt/local/lib
|
||||
/opt/csw/lib
|
||||
/opt/lib
|
||||
C:/Programs/SDL/lib
|
||||
)
|
||||
# Non-OS X framework versions expect you to also dynamically link to
|
||||
# SDLmain. This is mainly for Windows and OS X. Other platforms
|
||||
# seem to provide SDLmain for compatibility even though they don't
|
||||
# necessarily need it.
|
||||
FIND_LIBRARY(SDLMAIN_LIBRARY
|
||||
NAMES SDLmain SDLmain-1.1
|
||||
PATHS
|
||||
$ENV{SDLDIR}/lib
|
||||
/usr/local/lib
|
||||
/usr/lib
|
||||
/sw/lib
|
||||
/opt/local/lib
|
||||
/opt/csw/lib
|
||||
/opt/lib
|
||||
C:/Programs/SDL/lib
|
||||
)
|
||||
ENDIF(${SDL_INCLUDE_DIR} MATCHES ".framework")
|
||||
|
||||
# SDL may require threads on your system.
|
||||
# The Apple build may not need an explicit flag because one of the
|
||||
# frameworks may already provide it.
|
||||
# But for non-OSX systems, I will use the CMake Threads package.
|
||||
IF(NOT APPLE)
|
||||
FIND_PACKAGE(Threads)
|
||||
ENDIF(NOT APPLE)
|
||||
|
||||
# MinGW needs an additional library, mwindows
|
||||
# It's total link flags should look like -lmingw32 -lSDLmain -lSDL -lmwindows
|
||||
# (Actually on second look, I think it only needs one of the m* libraries.)
|
||||
IF(MINGW)
|
||||
SET(MINGW32_LIBRARY mingw32 CACHE STRING "mwindows for MinGW")
|
||||
ENDIF(MINGW)
|
||||
|
||||
SET(SDL_FOUND "NO")
|
||||
IF(SDL_LIBRARY_TEMP)
|
||||
# For SDLmain
|
||||
IF(SDLMAIN_LIBRARY)
|
||||
SET(SDL_LIBRARY_TEMP ${SDLMAIN_LIBRARY} ${SDL_LIBRARY_TEMP})
|
||||
ENDIF(SDLMAIN_LIBRARY)
|
||||
|
||||
# For OS X, SDL uses Cocoa as a backend so it must link to Cocoa.
|
||||
# CMake doesn't display the -framework Cocoa string in the UI even
|
||||
# though it actually is there. I think it has something to do
|
||||
# with the CACHE STRING. Maybe somebody else knows how to fix this.
|
||||
# The problem is mainly cosmetic, and not a functional issue.
|
||||
IF(APPLE)
|
||||
SET(SDL_LIBRARY_TEMP ${SDL_LIBRARY_TEMP} "-framework Cocoa")
|
||||
ENDIF(APPLE)
|
||||
|
||||
# For threads, as mentioned Apple doesn't need this.
|
||||
# In fact, there seems to be a problem if Find the threads package
|
||||
# and try using this line, so I'm just skipping it entirely for OS X.
|
||||
IF(NOT APPLE)
|
||||
SET(SDL_LIBRARY_TEMP ${SDL_LIBRARY_TEMP} ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(NOT APPLE)
|
||||
|
||||
# For MinGW library
|
||||
IF(MINGW)
|
||||
SET(SDL_LIBRARY_TEMP ${MINGW32_LIBRARY} ${SDL_LIBRARY_TEMP})
|
||||
ENDIF(MINGW)
|
||||
|
||||
# Set the final string here so the GUI reflects the final state.
|
||||
SET(SDL_LIBRARY ${SDL_LIBRARY_TEMP} CACHE STRING "Where the SDL Library can be found")
|
||||
|
||||
SET(SDL_FOUND "YES")
|
||||
ENDIF(SDL_LIBRARY_TEMP)
|
||||
|
||||
MARK_AS_ADVANCED(SDL_LIBRARY_TEMP)
|
||||
@@ -1,68 +0,0 @@
|
||||
# Find Xerces-C
|
||||
# The following setings are defined
|
||||
# XERCESC_ROOT_DIR, the root of the include and lib directory
|
||||
# XERCESC_INCLUDE_DIR, the full path of the include dir (ADVANCED)
|
||||
# XERCESC_LIBRARIES, the name of the xerces-c library (ADVANCED)
|
||||
|
||||
# Look for a root installation
|
||||
IF( MSVC )
|
||||
SET( XERCES_WINDIR C:/Programs/xerces-vc )
|
||||
ELSE( )
|
||||
SET( XERCES_WINDIR C:/Programs/xerces )
|
||||
ENDIF( )
|
||||
|
||||
FIND_PATH(XERCESC_ROOT_DIR include/xercesc/parsers/SAXParser.hpp
|
||||
${XERCES_WINDIR}
|
||||
"C:/mingw/msys/1.0/local"
|
||||
"C:/Program Files/CodeSynthesis XSD 3.2"
|
||||
/usr
|
||||
/usr/local
|
||||
"C:/MinGW"
|
||||
$ENV{CODESYNTH}
|
||||
DOC "The root of an installed xerces-c installation"
|
||||
)
|
||||
|
||||
# try to find the header
|
||||
FIND_PATH(XERCESC_INCLUDE_DIR xercesc/parsers/SAXParser.hpp
|
||||
${XERCESC_ROOT_DIR}/include
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
)
|
||||
|
||||
# Find the library
|
||||
FIND_LIBRARY(XERCESC_LIBRARY
|
||||
NAMES xerces-c xerces-c_3
|
||||
PATHS
|
||||
${XERCESC_ROOT_DIR}/lib
|
||||
${XERCESC_ROOT_DIR}/lib/vc-9.0
|
||||
${XERCESC_ROOT_DIR}/lib64/vc-9.0
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
DOC "The name of the xerces-c library"
|
||||
)
|
||||
|
||||
IF (XERCESC_ROOT_DIR)
|
||||
IF (XERCESC_INCLUDE_DIR AND XERCESC_LIBRARY)
|
||||
SET (XERCESC_FOUND TRUE)
|
||||
SET (XERCESC_LIBRARIES "${XERCESC_LIBRARY}")
|
||||
# FIXME: There should be a better way of handling this?
|
||||
# FIXME: How can we test to see if the lib dir isn't
|
||||
# FIXME: one of the default dirs?
|
||||
LINK_DIRECTORIES(${XERCESC_ROOT_DIR}/lib)
|
||||
ENDIF (XERCESC_INCLUDE_DIR AND XERCESC_LIBRARY)
|
||||
ENDIF (XERCESC_ROOT_DIR)
|
||||
|
||||
IF (XERCESC_FOUND)
|
||||
IF (NOT XERCESC_FIND_QUIETLY)
|
||||
MESSAGE (STATUS " found xerces-c: ${XERCESC_LIBRARY}")
|
||||
ENDIF (NOT XERCESC_FIND_QUIETLY)
|
||||
ELSE (XERCESC_FOUND)
|
||||
IF (XERCESC_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "Could not find Xerces-C")
|
||||
ENDIF (XERCESC_FIND_REQUIRED)
|
||||
ENDIF (XERCESC_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
XERCESC_INCLUDE_DIR
|
||||
XERCESC_LIBRARY
|
||||
)
|
||||
@@ -1,54 +0,0 @@
|
||||
# Locate Xsd from code synthesis include paths and binary
|
||||
# Xsd can be found at http://codesynthesis.com/products/xsd/
|
||||
# Written by Frederic Heem, frederic.heem _at_ telsey.it
|
||||
|
||||
# This module defines
|
||||
# XSD_INCLUDE_DIR, where to find elements.hxx, etc.
|
||||
# XSD_EXECUTABLE, where is the xsd compiler
|
||||
# XSD_FOUND, If false, don't try to use xsd
|
||||
|
||||
FIND_PATH( XSD_INCLUDE_DIR xsd/cxx/parser/elements.hxx
|
||||
"/opt/local/xsd-3.3.0-i686-macosx/libxsd"
|
||||
"C:/Programs/xsd-3.3.0/libxsd"
|
||||
"C:/Program Files/CodeSynthesis XSD 3.2/include"
|
||||
"C:/mingw/xsd-3.3.0-i686-windows/libxsd"
|
||||
$ENV{XSDDIR}/include
|
||||
$ENV{CODESYNTH}/include
|
||||
/usr/local/include /usr/include
|
||||
$ENV{XSDDIR}/libxsd
|
||||
)
|
||||
|
||||
IF( WIN32 )
|
||||
SET( XSDCXX_FILENAME1 xsd-cxx.exe )
|
||||
ELSE( )
|
||||
SET( XSDCXX_FILENAME1 xsdcxx )
|
||||
SET( XSDCXX_FILENAME2 xsd )
|
||||
ENDIF( )
|
||||
|
||||
FIND_PROGRAM( XSDCXX_EXECUTABLE
|
||||
NAMES
|
||||
${XSDCXX_FILENAME1} ${XSDCXX_FILENAME2}
|
||||
PATHS
|
||||
"/opt/local/xsd-3.3.0-i686-macosx/bin"
|
||||
"C:/Programs/xsd-3.3.0/bin"
|
||||
"C:/mingw/xsd-3.3.0-i686-windows/bin"
|
||||
"C:/Program Files/CodeSynthesis XSD 3.2/bin"
|
||||
$ENV{XSDDIR}/bin
|
||||
/usr/local/bin
|
||||
/usr/bin
|
||||
$ENV{XSDDIR}/xsd
|
||||
)
|
||||
|
||||
MESSAGE(STATUS ${XSDCXX_EXECUTABLE})
|
||||
|
||||
# if the include and the program are found then we have it
|
||||
IF( XSD_INCLUDE_DIR )
|
||||
IF( XSDCXX_EXECUTABLE )
|
||||
SET( XSD_FOUND "YES" )
|
||||
ENDIF( XSDCXX_EXECUTABLE )
|
||||
ENDIF( XSD_INCLUDE_DIR )
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
XSD_INCLUDE_DIR
|
||||
XSDCXX_EXECUTABLE
|
||||
)
|
||||
@@ -1,38 +0,0 @@
|
||||
macro(today RESULT)
|
||||
if(WIN32)
|
||||
execute_process(COMMAND "cmd" " /C date /T" OUTPUT_VARIABLE ${RESULT})
|
||||
string(REGEX REPLACE "(..)/(..)/(....).*" "\\1.\\2.\\3" ${RESULT} ${${RESULT}})
|
||||
elseif(UNIX)
|
||||
execute_process(COMMAND "date" "+%Y-%m-%d" OUTPUT_VARIABLE ${RESULT})
|
||||
string(REGEX REPLACE "(....)-(..)-(..).*" "\\1-\\2-\\3" ${RESULT} ${${RESULT}})
|
||||
else(WIN32)
|
||||
message(SEND_ERROR "date not implemented")
|
||||
set(${RESULT} 00.00.0000)
|
||||
endif(WIN32)
|
||||
endmacro(today)
|
||||
|
||||
macro(now RESULT)
|
||||
if(WIN32)
|
||||
execute_process(COMMAND "cmd" " /C time /T" OUTPUT_VARIABLE ${RESULT})
|
||||
string(REGEX REPLACE "(..):(..).*" "\\1:\\2:00" ${RESULT} ${${RESULT}})
|
||||
elseif(UNIX)
|
||||
execute_process(COMMAND "date" "+%H:%M:%S" OUTPUT_VARIABLE ${RESULT})
|
||||
string(REGEX REPLACE "(..):(..):(..).*" "\\1:\\2:\\3" ${RESULT} ${${RESULT}})
|
||||
else(WIN32)
|
||||
message(SEND_ERROR "time not implemented")
|
||||
set(${RESULT} 00:00:00)
|
||||
endif(WIN32)
|
||||
endmacro(now)
|
||||
|
||||
macro(git_id RESULT)
|
||||
if(WIN32)
|
||||
execute_process(COMMAND "cmd" " /C git --git-dir=${PROJECT_SOURCE_DIR}/.git rev-parse HEAD" OUTPUT_VARIABLE ${RESULT})
|
||||
string(REGEX REPLACE "(.*)\n" "\\1" ${RESULT} ${${RESULT}})
|
||||
elseif(UNIX)
|
||||
execute_process(COMMAND "git" "--git-dir=${PROJECT_SOURCE_DIR}/.git" "rev-parse" "HEAD" OUTPUT_VARIABLE ${RESULT})
|
||||
string(REGEX REPLACE "(.*)\n" "\\1" ${RESULT} ${${RESULT}})
|
||||
else(WIN32)
|
||||
message(SEND_ERROR "Git ID implemented")
|
||||
set(${RESULT} 0)
|
||||
endif(WIN32)
|
||||
endmacro(git_id)
|
||||
@@ -1,411 +0,0 @@
|
||||
<h2>Version 2.1.6 / 2015-11-11</h2>
|
||||
[Taranis]
|
||||
<ul>
|
||||
<li>Telemetry custom screen changes didn't emit modified signal (<a href=https://github.com/opentx/opentx/issues/3029>#3029</a>)</li>
|
||||
<li>Hide D8/LR12 when eu firmware option is selected</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Version 2.1.5 / 2015-11-05</h2>
|
||||
|
||||
Notice: version 2.1.4 was skipped by the OpenTX team to avoid confusion with FrSky's release of OpenTX 2.1.4
|
||||
|
||||
<ul>
|
||||
<li>Fixed: changing any setting on the telemetry panel does not set the file as being modified (<a href=https://github.com/opentx/opentx/issues/2875>#2875</a>)</li>
|
||||
<li>Print model fix for "Play value.... not on startup" (<a href=https://github.com/opentx/opentx/issues/2736>#2736</a>)</li>
|
||||
<li>Top LCD Timer could not be selected for X9E (<a href=https://github.com/opentx/opentx/issues/2850>#2850</a>)</li>
|
||||
<li>More informative error/info messages when openin eepe files (<a href=https://github.com/opentx/opentx/issues/2778>#2778</a>)</li>
|
||||
<li>Print model fix for curves (<a href=https://github.com/opentx/opentx/issues/2896>#2896</a>)</li>
|
||||
<li>Added missing special functions (bind, range check, set failsafe) (<a href=https://github.com/opentx/opentx/issues/2753>#2753</a>)</li>
|
||||
<li>Some defaults missing when changing telemetry formula, update propagation issues (<a href=https://github.com/opentx/opentx/issues/2928>#2928</a>)</li>
|
||||
<li>Fixed wrong import of Logical switches from OpenTX 2.0.x version (<a href=https://github.com/opentx/opentx/issues/2942>#2942</a>)</li>
|
||||
<li>Fixed a problem with updates path on Windows (<a href=https://github.com/opentx/opentx/issues/2876>#2876</a>)</li>
|
||||
<li>Edge representation unified (changed from "no release" to "instant") (<a href=https://github.com/opentx/opentx/issues/2837>#2837</a>)</li>
|
||||
<li>Added channel names on failsafe sliders (<a href=https://github.com/opentx/opentx/issues/3021>#3021</a>)</li>
|
||||
<li>Corrected failsafe mapping when using Custom failsafe mode, D16 protocol and channel range different from from 1-8.
|
||||
Users with such setups are advised to re-check their failsafe settings (<a href=https://github.com/opentx/opentx/issues/2975>#2975</a>)</li>
|
||||
<li>Various texts and translations corrections</li>
|
||||
<li>Various small bug-fixes: <a href=https://github.com/opentx/opentx/issues/2994>#2994</a>,
|
||||
<a href=https://github.com/opentx/opentx/issues/3016>#3016</a>,
|
||||
<a href=https://github.com/opentx/opentx/issues/3012>#3012</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Version 2.1.3 / 2015-09-09</h2>
|
||||
|
||||
<ul>
|
||||
<li>Fix missing translations in inputs/mixes tabs, print and compare dialogs (<a href=https://github.com/opentx/opentx/issues/2847>#2847</a>)</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Version 2.1.2 / 2015-09-07</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.
|
||||
The effect will only be visible for the users that did not install any of the previous 2.1.x versions.
|
||||
(<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>
|
||||
<li>Fixed language-related startup crash on Mac (<a href=https://github.com/opentx/opentx/issues/2815>#2815</a>)</li>
|
||||
<li>Fixed issues with conversion from 2.0 (<a href=https://github.com/opentx/opentx/issues/2809>#2809</a>, <a href=https://github.com/opentx/opentx/issues/2800>#2800</a>)</li>
|
||||
<li>Fixed Throttle source export issue on X9E (<a href=https://github.com/opentx/opentx/issues/2844>#2844</a>)</li>
|
||||
<li>Added support for the AR9X replacement board (prototype) for the Turnigy 9X radio, info <a href=http://www.rcgroups.com/forums/showthread.php?t=2479552>here</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Version 2.1.1 / 2015-08-06</h2>
|
||||
<ul>
|
||||
<li>Vario source and center silent options were not saved(<a href=https://github.com/opentx/opentx/issues/2476>#2476</a>)</li>
|
||||
<li>DSM receiver numbers for external module were not converted from previous version EEPROM (<a href=https://github.com/opentx/opentx/issues/2474>#2474</a>)</li>
|
||||
<li>Precision incorrectly set for Calculated->Cells sensor (<a href=https://github.com/opentx/opentx/issues/2479>#2479</a>)</li>
|
||||
<li>Unit incorrectly set for Calculated->Cells sensor (<a href=https://github.com/opentx/opentx/issues/2485>#2485</a>)</li>
|
||||
<li>Fixed import/export of trim values (<a href=https://github.com/opentx/opentx/issues/2484>#2484</a>)</li>
|
||||
<li>Removed constant access to floppy disk (<a href=https://github.com/opentx/opentx/issues/2160>#2160</a>)</li>
|
||||
<li>Telemetry view script combo box list was empty (<a href=https://github.com/opentx/opentx/issues/2465>#2465</a>)</li>
|
||||
<li>Telemetry view bars ranges not transfered to radio (<a href=https://github.com/opentx/opentx/issues/2491>#2491</a>)</li>
|
||||
<li>Fixed Standalone simulator radio selection display problem (<a href=https://github.com/opentx/opentx/issues/2503>#2503</a>)</li>
|
||||
<li>Added missing simulation libraries and enabled side by side installation of Companion 2.0 and 2.1 on Linux (<a href=https://github.com/opentx/opentx/issues/2500>#2500</a>)</li>
|
||||
<li>Standalone simulator now remembers which radio was simulated in previous session (<a href=https://github.com/opentx/opentx/issues/2503>#2503</a>)</li>
|
||||
<li>Radio calibration value were not displayed (<a href=https://github.com/opentx/opentx/issues/2502>#2502</a>)</li>
|
||||
<li>Fixed Vario / Voltage / Current sources export problem</li>
|
||||
<li>Writing model settings to 9XR-PRO did not work (<a href=https://github.com/opentx/opentx/issues/2402>#2402</a>, <a href=https://github.com/opentx/opentx/issues/2517>#2517</a>)</li>
|
||||
<li>Model Print and Model Compare improvements</li>
|
||||
<li>Fixed Companion OSX version (<a href=https://github.com/opentx/opentx/issues/2549>#2549</a>)</li>
|
||||
<li>Firmware nightly builds are now downloadable from nightly builds of Companion (<a href=https://github.com/opentx/opentx/issues/2526>#2526</a>, <a href=https://github.com/opentx/opentx/issues/2634>#2634</a>)</li>
|
||||
<li>Fixed telemetry item lists (<a href=https://github.com/opentx/opentx/issues/2541>#2541</a>)</li>
|
||||
<li>Fixed missing pots P1..P3 for 9X (<a href=https://github.com/opentx/opentx/issues/2543>#2543</a>)</li>
|
||||
<li>Fixed "Invalid model and settings" error message when writing models and settings to the radio (<a href=https://github.com/opentx/opentx/issues/2544>#2544</a>)</li>
|
||||
<li>Global Functions fixes (<a href=https://github.com/opentx/opentx/issues/2558>#2558</a>)</li>
|
||||
<li>Export to Google Earth now working (only) with the new telemetry fields (GPS, GAlt and GSpd) (<a href=https://github.com/opentx/opentx/issues/2546>#2546</a>)</li>
|
||||
<li>Fixed unsuccessful writing of setting to the radio for 9XR PRO (<a href=https://github.com/opentx/opentx/issues/2605>#2605</a>)</li>
|
||||
<li>Fixed missing LUA script outputs in special function "Play Value" (<a href=https://github.com/opentx/opentx/issues/2649>#2649</a>)</li>
|
||||
<li>Various texts and translations corrections</li>
|
||||
<li>Various small bug-fixes</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Version 2.1.0 / 2015-07-16</h2>
|
||||
<ul>
|
||||
<li>SD card synchronizaton tool</li>
|
||||
<li>Added session duraton information in Log Viewer</li>
|
||||
<li>Enabled <i>Mixers monitor</i> in Taranis simulator</li>
|
||||
<li>Better support for multi-axes in Log Viewer (<a href=https://github.com/opentx/opentx/issues/2267>#2267</a>)</li>
|
||||
<li>File path issue in Taranis simulator function <i>findTrueFileName()</i> on Windows (<a href=https://github.com/opentx/opentx/issues/2301>#2301</a>)</li>
|
||||
<li>Added simulator volume gain setting (<a href=https://github.com/opentx/opentx/issues/2260>#2260</a>)</li>
|
||||
<li>Added GPS glitch filtering and Latitude/Longitude position synchronization to Google Earth export (<a href=https://github.com/opentx/opentx/issues/2326>#2326</a>)</li>
|
||||
<li>Fixed a rare program crash when editing Input for 9X radio (<a href=https://github.com/opentx/opentx/issues/2420>#2420</a>)</li>
|
||||
<li>Fixed missing RSSI audio warnings if simulator was started multiple times (<a href=https://github.com/opentx/opentx/issues/2446>#2446</a>)</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Version 2.0.17 / 2015-05-04</h2>
|
||||
<ul>
|
||||
<li>Simulator crash (<a href=https://github.com/opentx/opentx/issues/2253>#2253</a>)</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Version 2.0.16 / 2015-05-03</h2>
|
||||
<ul>
|
||||
<li><i>nooverridech</i> firmware option was not working</li>
|
||||
<li>Fixed setting Expo from gvars for 9XR-Pro (<a href=https://github.com/opentx/opentx/issues/2040>#2040</a>)</li>
|
||||
<li>Added Mixers Monitor screen option <i>mixersmon</i> (<a href=https://github.com/opentx/opentx/issues/1945>#1945</a>)</li>
|
||||
<li>Added audio playing in simulator (<a href=https://github.com/opentx/opentx/issues/457>#457</a>)</li>
|
||||
<li>Fixed sorting of audio tracks (<a href=https://github.com/opentx/opentx/issues/2002>#2002</a>)</li>
|
||||
<li>Model wizard fixes (<a href=https://github.com/opentx/opentx/issues/2091>#2091</a>)</li>
|
||||
<li>GVAR names removed for 9x, radio doesn't support them (<a href=https://github.com/opentx/opentx/issues/2150>#2150</a>)</li>
|
||||
<li>Some LS sources didn't follow the Imperial units setting (<a href=https://github.com/opentx/opentx/issues/2180>#2180</a>)</li>
|
||||
<li>Added more fields to the telemetry simulator (<a href=https://github.com/opentx/opentx/issues/2171>#2171</a>)</li>
|
||||
<li>Log viewer improvements and massive speed increase (<a href=https://github.com/opentx/opentx/issues/1863>#1863</a>, <a href=https://github.com/opentx/opentx/issues/2163>#2163</a>)</li>
|
||||
<li>Added Battery meter range setting (<a href=https://github.com/opentx/opentx/issues/2195>#2195</a>)</li>
|
||||
<li>Improvements in Print and Compare dialogs (<a href=https://github.com/opentx/opentx/issues/2219>#2219</a>)</li>
|
||||
<li>Reset pots to the middle by right double clicking them in Simulator (<a href=https://github.com/opentx/opentx/issues/1939>#1939</a>)</li>
|
||||
<li>Minor fixes: <a href=https://github.com/opentx/opentx/issues/2153>#2153</a>,
|
||||
<a href=https://github.com/opentx/opentx/issues/2138>#2138</a>,
|
||||
<a href=https://github.com/opentx/opentx/issues/2090>#2090</a>,
|
||||
<a href=https://github.com/opentx/opentx/issues/2122>#2122</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Version 2.0.15 / 2015-01-13</h2>
|
||||
<ul>
|
||||
<li>Firmware was not written correctly on radio when compatibility warning check enabled</li>
|
||||
<li>Time format for Special Functions Set Timers</li>
|
||||
</ul>
|
||||
|
||||
<h2>Version 2.0.14 / 2015-01-12</h2>
|
||||
<ul>
|
||||
<li>OpenTX Companion and Companion9x can now be installed side by side on Linux</li>
|
||||
<li>Improved TAB order in dialogs</li>
|
||||
<li>Special Function <i>Start Logs</i> renamed to more appropriate <i>SD Logs</i></li>
|
||||
<li>Improvements for MAC build</li>
|
||||
<li>Fixes to Google Earth logs export</li>
|
||||
<li>Firmware compatibility warning check added when flashing new firmware to radio</li>
|
||||
<li>Fixed issue with Telemetry Type setting on 9XR-PRO</li>
|
||||
<li>Added Telemetry simulator</li>
|
||||
<li>Added Trainer simulator</li>
|
||||
<li>Added Debug Output window</li>
|
||||
<li>Various texts and translations corrections</li>
|
||||
<li>Various small bug-fixes</li>
|
||||
<li>More reliable method of writing EEPROM.BIN and FIRMWARE.BIN to radio</li>
|
||||
<li>Fixed issue with Edge function INSTANT for V1>2s</li>
|
||||
<li>Fixed buffer overflow in Joystick code</li>
|
||||
</ul>
|
||||
|
||||
<h2>Version 2.0.13 / 2014-11-20</h2>
|
||||
<ul>
|
||||
<li>Too many curves shown on non ARM boards</li>
|
||||
<li>Fixed vario limits</li>
|
||||
<li>Fixes in compare dialog</li>
|
||||
<li>Fixed receiver number range</li>
|
||||
<li>Virtual inputs not selectable in SF Volume and heli Collective Source</li>
|
||||
<li>Joystick calibration crash after channel assignment</li>
|
||||
<li>Gvar import error for limits</li>
|
||||
<li>Companion shows too many curve types in input/mixer for 9x</li>
|
||||
<li>NOT curves removed from inputs (for non ARM platforms)</li>
|
||||
<li>Companion again builds on OS X (Mac)</li>
|
||||
<li>Companion simulator Lua crash on OS X 64bit (Mac)</li>
|
||||
<li>Companion didn't take care of PlayScript functions</li>
|
||||
</ul>
|
||||
|
||||
<h2>Version 2.0.12 / 2014-09-15</h2>
|
||||
<ul>
|
||||
<li>Typos & Translations updated</li>
|
||||
</ul>
|
||||
|
||||
<h2>Version 2.0.11 / 2014-09-10</h2>
|
||||
<ul>
|
||||
<li>Limits EEPROM export was broken (all boards except Taranis)</li>
|
||||
<li>Fix issue when a GVAR was used as Offset</li>
|
||||
</ul>
|
||||
|
||||
<h2>Version 2.0.10 / 2014-09-08</h2>
|
||||
<ul>
|
||||
<li>Taranis is now the default board in General Settings</li>
|
||||
<li>GVARS allowed in Limits min/max/offset</li>
|
||||
<li>Limits displayed in us when ppmus option selected
|
||||
</ul>
|
||||
|
||||
<h2>Version 2.0.8 / 2014-07-23</h2>
|
||||
<ul>
|
||||
<li>Compare dialog bugfixes</li>
|
||||
<li>Curve index correctly resetted when type changed</li>
|
||||
</ul>
|
||||
|
||||
<h2>Version 2.0.7</h2>
|
||||
<ul>
|
||||
<li>SafetyCH function was missing in simulator</li>
|
||||
<li>EEPROM export warning when exporting logical switches > L12 on 9X128</li>
|
||||
<li>FAS offset was not exported on 9X/9XR boards</li>
|
||||
<li>Trims modes bugfix on non Taranis boards</li>
|
||||
<li>It was impossible to open a backuped model from the Tx</li>
|
||||
</ul>
|
||||
|
||||
<h2>Version 2.0.6</h2>
|
||||
<ul>
|
||||
<li>Fix Mix curves bug on Sky9x boards</li>
|
||||
<li>Channels 17-32 are displayed in the simulator</li>
|
||||
<li>Backlight simulation bugfix</li>
|
||||
</ul>
|
||||
|
||||
<h2>Version 2.0.5</h2>
|
||||
<ul>
|
||||
<li>Fix crash on startup</li>
|
||||
<li>Fix version number in simu</li>
|
||||
<li>9XR-Pro now supported on Mac</li>
|
||||
<li>Fix loss of settings in telemetry custom screens</li>
|
||||
<li>Fix 10000% bug when using GVs in mixer weithg or offset</li>
|
||||
<li>Fix Cnsp range in logical switches (up to 30000mAh)</li>
|
||||
</ul>
|
||||
|
||||
<h2>Version 2.0.4</h2>
|
||||
<ul>
|
||||
<li>Sound should be ok on all platforms</li>
|
||||
<li>Min/Max reviewed in Logical switches (for the whole telemetry)</li>
|
||||
<li>Various bug fixes</li>
|
||||
</ul>
|
||||
|
||||
<h2>Version 2.0.3</h2>
|
||||
<ul>
|
||||
<li>EEPROM import bug on AdjustGVAR function</li>
|
||||
<li>Timers correctly displayed in logical switches tab</li>
|
||||
</ul>
|
||||
|
||||
<h2>Version 2.0.2</h2>
|
||||
<ul>
|
||||
<li>Mouse scroll wheel behaves differently</li>
|
||||
<li>Play Sounds should now work on all platforms</li>
|
||||
<li>A lot of small bug fixes</li>
|
||||
</ul>
|
||||
|
||||
<h2>Version 2.0.1</h2>
|
||||
<ul>
|
||||
<li>Fix on recursive GVars</li>
|
||||
<li>Sky9x EEPROM read/write fix</li>
|
||||
<li>Translations updated
|
||||
<li>Wizard fixes
|
||||
<li>Fix on invalid splashes bitmaps
|
||||
</ul>
|
||||
|
||||
<h2>Version 2.0.0</h2>
|
||||
<ul>
|
||||
<li>Companion now merged into OpenTX</li>
|
||||
<li>Too many changes to list them all!</li>
|
||||
</ul>
|
||||
|
||||
<h2>Version 1.52</h2>
|
||||
<ul>
|
||||
<li>Fix crash when writing certain EEPROMS</li>
|
||||
<li>Google Earth export of logs containing GPS positions</li>
|
||||
<li>DSM2 added for Taranis</li>
|
||||
</ul>
|
||||
|
||||
<h2>Version 1.51</h2>
|
||||
<ul>
|
||||
<li>Wrong DFU-Util default path (MAC)</li>
|
||||
<li>new voices download server (ip address changed to new fiber connection)</li>
|
||||
<li>Fixed contributor list</li>
|
||||
</ul>
|
||||
|
||||
<h2>Version 1.50</h2>
|
||||
<ul>
|
||||
<li>solved issue with taranis radio with some linux distributions</li>
|
||||
<li>blank eeprom created using a radio profile that holds calibration data, will contain calibration data from the profile</li>
|
||||
<li>new opentx compilation server (ip address changed to new fiber connection)</li>
|
||||
</ul>
|
||||
|
||||
<h2>Version 1.49</h2>
|
||||
<ul>
|
||||
<li>Stack usage optimizations</li>
|
||||
<li>Playsound order is misaligned between companion9x and the TX</li>
|
||||
<li>Model image could not be reset.</li>
|
||||
</ul>
|
||||
|
||||
<h2>Version 1.48</h2>
|
||||
<ul>
|
||||
<li>Interface fixes</li>
|
||||
<li>Hide include dr/expo when not applicable</li>
|
||||
<li>Fix extraction of grayscale images from taranis firmwares</li>
|
||||
<li>No TX and RX in Taranis telemetry fields</li>
|
||||
<li>Issue 255 fixed - "No GVAR selection possible for PLAY VALUE"</li>
|
||||
<li>Issue 254 fixed - "SE Language for building opentx"</li>
|
||||
<li>Issue 253 fixed - "OpenTX doesn't accept this protocol (DSM2 on Sky9x)"</li>
|
||||
<li>Prevent segfault while parsing wrong log files or files with broken lines</li>
|
||||
<li>Small bug in model printout</li>
|
||||
<li>Fixed wrong display of values in custom functions</li>
|
||||
<li>Image in preferences was saved only black & white</li>
|
||||
<li>Issue 247 fixed - "Labelled items on radio should not be translated."</li>
|
||||
<li>Added support of tstick (taranis like stick) compile option for sky9x opentx firmware</li>
|
||||
</ul>
|
||||
|
||||
<h2>Version 1.47</h2>
|
||||
<ul>
|
||||
<li>Interface fixes (issues 232,233,238,241)</li>
|
||||
<li>Fix for print/compare models</li>
|
||||
<li>Function switch parameter on screen different than printout.</li>
|
||||
<li>Translations fixes</li>
|
||||
<li>Command line print mode</li>
|
||||
<li>Better mavlink support</li>
|
||||
<li>SE tts language added for taranis</li>
|
||||
<li>Alternate font option for opentx added</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<h2>Version 1.46</h2>
|
||||
<ul>
|
||||
<li>Interface fixes (issues 224,225)</li>
|
||||
<li>Show persistent timers value in modeledit</li>
|
||||
<li>Consistent naming of Custom Switches in c9x</li>
|
||||
</ul>
|
||||
|
||||
<h2>Version 1.45</h2>
|
||||
<ul>
|
||||
<li>Various fixes</li>
|
||||
</ul>
|
||||
|
||||
<h2>Version 1.44</h2>
|
||||
<ul>
|
||||
<li>Fix regression on AND parameter in custom functions</li>
|
||||
<li>Add mavlink support for stock and m128 boards</li>
|
||||
</ul>
|
||||
|
||||
<h2>Version 1.43</h2>
|
||||
<ul>
|
||||
<li>Copy Malfunctions in Custom Functions (Issue 205)</li>
|
||||
<li>Enable repeat parameter in functions for all boards</li>
|
||||
<li>Remove sink tones from vario for stock/m128 board</li>
|
||||
<li>Fix for wrongly named channels in mixerlist (Issue 210)</li>
|
||||
<li>Fix badly exported gvars in mixers</li>
|
||||
<li>Fix while editing custom switches</li>
|
||||
<li>Add access to the release notes of currently selected firmware</li>
|
||||
</ul>
|
||||
|
||||
<h2>Version 1.42</h2>
|
||||
<ul>
|
||||
<li>Add Companion9X changelog</li>
|
||||
<li>Add Fw release notes browser</li>
|
||||
<li>Simplify burn menu for sky9x and Taranis.</li>
|
||||
<li>Fix in telemetry conversion (rssi alarm) for stock board</li>
|
||||
<li>Drop support of sky9x boards on MacOS due to missing SAM-BA tool.</li>
|
||||
</ul>
|
||||
|
||||
<h2>Version 1.41</h2>
|
||||
<ul>
|
||||
<li>Fix unneeded rescaling of splash images</li>
|
||||
<li>Fix for telemetry screens for Taranis</li>
|
||||
</ul>
|
||||
|
||||
<h2>Version 1.40</h2>
|
||||
<ul>
|
||||
<li>Log dialog - Split of logging sessions.</li>
|
||||
<li>Telemetry screen 1 as default (issue 206)</li>
|
||||
<li>Rename all channels in mixer tab accordingly to limits names</li>
|
||||
<li>Fix a segfault in phases tabs (Issue 203 regression introduced in release 2140)</li>
|
||||
</ul>
|
||||
|
||||
<h2>Version 1.39</h2>
|
||||
<ul>
|
||||
<li>Custom functions cut&paste </li>
|
||||
<li>Custom switches cut&paste </li>
|
||||
<li>Color button text in curve editor for MACOSX</li>
|
||||
<li>Adjust name lengths for Taranis</li>
|
||||
</ul>
|
||||
|
||||
<h2>Version 1.38</h2>
|
||||
<ul>
|
||||
<li>Core when model names were > 10 chars</li>
|
||||
</ul>
|
||||
|
||||
<h2>Version 1.37</h2>
|
||||
<ul>
|
||||
<li>Fix OpenTX segfault in Taranis simulator</li>
|
||||
<li>Implement brightness control for Taranis</li>
|
||||
<li>Reduce modeledit windows size</li>
|
||||
<li>Taranis splash screen in grayscale</li>
|
||||
</ul>
|
||||
|
||||
<h2>Version 1.36</h2>
|
||||
<ul>
|
||||
<li>Burning windows (with progress bar) now in foreground (Issue 197)</li>
|
||||
<li>Allow a selection of tracks for Background Music (Issue 199)</li>
|
||||
</ul>
|
||||
|
||||
<h2>Version 1.35</h2>
|
||||
<ul>
|
||||
<li>Country names mismatch between Taranis and Companion 9X (Issue 198)</li>
|
||||
<li>TIM function in custom switches</li>
|
||||
<li>Fix timer switches.</li>
|
||||
<li>Taranis LCD adjustment in general settings.</li>
|
||||
<li>New tool in curve editor</li>
|
||||
<li>Minor fixes</li>
|
||||
<li>Expo move bug + invalid chars in channels, expo and mixer names</li>
|
||||
<li>Try to reduce modeledit window form MAC</li>
|
||||
<li>Wrong init of RF-Module data</li>
|
||||
<li>Read flash from TX didn't worked for Taranis</li>
|
||||
</ul>
|
||||
@@ -1,444 +0,0 @@
|
||||
include(Macros)
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
set(C9X_NAME_SUFFIX ${VERSION_MAJOR}${VERSION_MINOR})
|
||||
set(COMPANION_NAME "companion${C9X_NAME_SUFFIX}")
|
||||
set(SIMULATOR_NAME "simulator${C9X_NAME_SUFFIX}")
|
||||
set(SIMULATOR_LIB_PATH ${CMAKE_INSTALL_PREFIX}/lib/companion${C9X_NAME_SUFFIX})
|
||||
else(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
set(COMPANION_NAME "companion")
|
||||
set(SIMULATOR_NAME "simulator")
|
||||
endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
|
||||
option(ALLOW_NIGHTLY_BUILDS "Allow nightly builds download / update") # Disabled by default
|
||||
if(ALLOW_NIGHTLY_BUILDS)
|
||||
add_definitions(-DALLOW_NIGHTLY_BUILDS)
|
||||
endif(ALLOW_NIGHTLY_BUILDS)
|
||||
|
||||
option(DEBUG_IMPORT "Turn 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)
|
||||
|
||||
option(TABLE_LAYOUT "Use QTableWidget for grid layouts") # Disabled by default
|
||||
if(TABLE_LAYOUT)
|
||||
add_definitions(-DTABLE_LAYOUT)
|
||||
message(STATUS "Using QTableWidget")
|
||||
endif(TABLE_LAYOUT)
|
||||
|
||||
message(STATUS "Looking for XercesC ")
|
||||
find_package(XercesC)
|
||||
if(XERCESC_FOUND)
|
||||
include_directories(${XERCESC_INCLUDE_DIR})
|
||||
set(LidarFormat_LIBRAIRIES ${LidarFormat_LIBRAIRIES} ${XERCESC_LIBRARIES})
|
||||
else()
|
||||
message(FATAL_ERROR "XercesC not found! Please set XercesC path ...")
|
||||
endif()
|
||||
|
||||
message(STATUS "Looking for Xsd ")
|
||||
find_package(Xsd)
|
||||
if(XSD_FOUND)
|
||||
include_directories(${XSD_INCLUDE_DIR})
|
||||
message("XSD Include Path: " ${XSD_INCLUDE_DIR})
|
||||
else()
|
||||
message(FATAL_ERROR "XSD not found! Please set XSD path ...")
|
||||
endif()
|
||||
|
||||
message(STATUS "Looking for SDL ")
|
||||
find_package(Sdl)
|
||||
if(SDL_FOUND)
|
||||
include_directories(${SDL_INCLUDE_DIR})
|
||||
message("SDL Include Path: " ${SDL_INCLUDE_DIR})
|
||||
add_definitions(-DJOYSTICKS)
|
||||
add_definitions(-DSIMU_AUDIO)
|
||||
else()
|
||||
message("SDL not found! Joysticks support will be disabled. Simulator audio will not work.")
|
||||
endif()
|
||||
|
||||
find_package(Qt4 4.8.1 REQUIRED)
|
||||
set(QT_USE_QTNETWORK True)
|
||||
set(QT_USE_QTXML True)
|
||||
include(${QT_USE_FILE})
|
||||
|
||||
message(STATUS "Looking for PHONON ")
|
||||
find_package(Phonon)
|
||||
if(PHONON_FOUND)
|
||||
include_directories(${PHONO_INCLUDE_DIR})
|
||||
message("PHONON Include Path: " ${PHONON_INCLUDE_DIR})
|
||||
add_definitions(-DPHONON)
|
||||
else()
|
||||
message("PHONON not found!")
|
||||
endif()
|
||||
|
||||
message(STATUS "Looking for QT lupdate ")
|
||||
find_package(Lupdate)
|
||||
if(LUPDATE_FOUND)
|
||||
message("QT lupdate: " ${LUPDATE_EXECUTABLE})
|
||||
else()
|
||||
message("QT lupdate not found!")
|
||||
endif()
|
||||
|
||||
add_definitions(-DQXT_STATIC)
|
||||
|
||||
add_custom_command(
|
||||
COMMAND ${XSDCXX_EXECUTABLE} cxx-tree --root-element-all --generate-serialization --output-dir ${PROJECT_BINARY_DIR}/ ${PROJECT_SOURCE_DIR}/radio.xsd
|
||||
OUTPUT ${PROJECT_BINARY_DIR}/radio.hxx ${PROJECT_BINARY_DIR}/radio.cxx
|
||||
DEPENDS ${PROJECT_SOURCE_DIR}/radio.xsd
|
||||
)
|
||||
|
||||
if(MSVC)
|
||||
set(CMAKE_CXX_FLAGS "/EHsc /LD")
|
||||
include_directories(${PROJECT_SOURCE_DIR}/winbuild C:/Programs/pthreads/Pre-built.2/include C:/Programs/msinttypes C:/Programs/dirent/include)
|
||||
link_directories(C:/Programs/pthreads/Pre-built.2/lib/)
|
||||
set(PTHREAD_LIBRARY pthreadVC2.lib)
|
||||
else()
|
||||
set(PTHREAD_LIBRARY pthread)
|
||||
add_definitions(-Wall)
|
||||
link_directories(/usr/local/lib)
|
||||
endif()
|
||||
|
||||
set(RADIO_SRC_DIRECTORY ${PROJECT_SOURCE_DIR}/radio/src)
|
||||
set(SIMU_SRC_DIRECTORY ${PROJECT_SOURCE_DIR}/companion/src/simulation)
|
||||
set(COMPANION_SRC_DIRECTORY ${PROJECT_SOURCE_DIR}/companion/src)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${COMPANION_SRC_DIRECTORY}
|
||||
${COMPANION_SRC_DIRECTORY}/shared
|
||||
${SIMU_SRC_DIRECTORY}
|
||||
${XSD_INCLUDE_DIR}
|
||||
${COMPANION_SRC_DIRECTORY}/qxtcommandoptions
|
||||
)
|
||||
|
||||
add_subdirectory(shared)
|
||||
add_subdirectory(modeledit)
|
||||
add_subdirectory(generaledit)
|
||||
add_subdirectory(simulation)
|
||||
add_subdirectory(firmwares/opentx/simulator)
|
||||
add_subdirectory(qcustomplot)
|
||||
add_subdirectory(qxtcommandoptions)
|
||||
|
||||
set(common_SRCS
|
||||
eeprominterface.cpp
|
||||
firmwares/th9x/th9xeeprom.cpp # TODO not needed
|
||||
firmwares/th9x/th9xinterface.cpp
|
||||
firmwares/er9x/er9xeeprom.cpp
|
||||
firmwares/er9x/er9xinterface.cpp
|
||||
firmwares/gruvin9x/gruvin9xeeprom.cpp
|
||||
firmwares/gruvin9x/gruvin9xinterface.cpp
|
||||
firmwares/ersky9x/ersky9xeeprom.cpp
|
||||
firmwares/ersky9x/ersky9xinterface.cpp
|
||||
firmwares/opentx/opentxeeprom.cpp
|
||||
firmwares/opentx/open9xStockeeprom.cpp
|
||||
firmwares/opentx/open9xGruvin9xeeprom.cpp
|
||||
firmwares/opentx/open9xSky9xeeprom.cpp
|
||||
firmwares/opentx/opentxinterface.cpp
|
||||
file.cpp
|
||||
appdata.cpp
|
||||
)
|
||||
|
||||
qt4_wrap_cpp(common_SRCS)
|
||||
|
||||
add_library(common ${common_SRCS})
|
||||
|
||||
set(companion_SRCS
|
||||
hexinterface.cpp
|
||||
firmwareinterface.cpp
|
||||
converteeprom.cpp
|
||||
# xmlinterface.cpp
|
||||
# ${PROJECT_BINARY_DIR}/radio.cxx
|
||||
helpers.cpp
|
||||
helpers_html.cpp
|
||||
mdichild.cpp
|
||||
modelslist.cpp
|
||||
mountlist.cpp
|
||||
apppreferencesdialog.cpp
|
||||
fwpreferencesdialog.cpp
|
||||
burnconfigdialog.cpp
|
||||
multimodelprinter.cpp
|
||||
comparedialog.cpp
|
||||
contributorsdialog.cpp
|
||||
releasenotesdialog.cpp
|
||||
releasenotesfirmwaredialog.cpp
|
||||
customizesplashdialog.cpp
|
||||
radiointerface.cpp
|
||||
progresswidget.cpp
|
||||
progressdialog.cpp
|
||||
process_copy.cpp
|
||||
process_flash.cpp
|
||||
process_sync.cpp
|
||||
flashfirmwaredialog.cpp
|
||||
flasheepromdialog.cpp
|
||||
printdialog.cpp
|
||||
modelprinter.cpp
|
||||
fusesdialog.cpp
|
||||
logsdialog.cpp
|
||||
downloaddialog.cpp
|
||||
splashlibrarydialog.cpp
|
||||
mainwindow.cpp
|
||||
companion.cpp
|
||||
radionotfound.cpp
|
||||
wizarddata.cpp
|
||||
wizarddialog.cpp
|
||||
)
|
||||
|
||||
set(companion_MOC_HDRS
|
||||
apppreferencesdialog.h
|
||||
fwpreferencesdialog.h
|
||||
burnconfigdialog.h
|
||||
comparedialog.h
|
||||
printdialog.h
|
||||
fusesdialog.h
|
||||
logsdialog.h
|
||||
contributorsdialog.h
|
||||
releasenotesdialog.h
|
||||
releasenotesfirmwaredialog.h
|
||||
customizesplashdialog.h
|
||||
splashlibrarydialog.h
|
||||
splashlabel.h
|
||||
progresswidget.h
|
||||
progressdialog.h
|
||||
process_copy.h
|
||||
process_flash.h
|
||||
process_sync.h
|
||||
flashfirmwaredialog.h
|
||||
flasheepromdialog.h
|
||||
downloaddialog.h
|
||||
modelslist.h
|
||||
mdichild.h
|
||||
mainwindow.h
|
||||
radionotfound.h
|
||||
helpers.h
|
||||
wizarddialog.h
|
||||
modelprinter.h
|
||||
multimodelprinter.h
|
||||
)
|
||||
|
||||
set(companion_UIS
|
||||
mdichild.ui
|
||||
comparedialog.ui
|
||||
fusesdialog.ui
|
||||
logsdialog.ui
|
||||
apppreferencesdialog.ui
|
||||
fwpreferencesdialog.ui
|
||||
burnconfigdialog.ui
|
||||
downloaddialog.ui
|
||||
printdialog.ui
|
||||
htmldialog.ui
|
||||
customizesplashdialog.ui
|
||||
splashlibrarydialog.ui
|
||||
progresswidget.ui
|
||||
progressdialog.ui
|
||||
flashfirmwaredialog.ui
|
||||
flasheepromdialog.ui
|
||||
radionotfound.ui
|
||||
)
|
||||
|
||||
set(companion_RCS
|
||||
companion.qrc
|
||||
${CMAKE_CURRENT_BINARY_DIR}/translations.qrc
|
||||
)
|
||||
|
||||
today(DATE)
|
||||
now(TIME)
|
||||
|
||||
configure_file(${COMPANION_SRC_DIRECTORY}/version.h.in ${CMAKE_BINARY_DIR}/version.h @ONLY)
|
||||
configure_file(${COMPANION_SRC_DIRECTORY}/translations.qrc.in ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc @ONLY)
|
||||
configure_file(${COMPANION_SRC_DIRECTORY}/companion.desktop.in ${CMAKE_CURRENT_BINARY_DIR}/companion.desktop @ONLY)
|
||||
configure_file(${COMPANION_SRC_DIRECTORY}/simulator.desktop.in ${CMAKE_CURRENT_BINARY_DIR}/simulator.desktop @ONLY)
|
||||
|
||||
if(WIN32)
|
||||
set(companion_SRCS ${companion_SRCS} icon.rc)
|
||||
if(NOT MSVC)
|
||||
set(CMAKE_EXE_LINKER_FLAGS -mwindows)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include_directories(${CMAKE_BINARY_DIR})
|
||||
include_directories(${CMAKE_SOURCE_DIR})
|
||||
|
||||
set(LANGUAGES he pl pt ru de fr es it sv cs fi nl)
|
||||
foreach(language ${LANGUAGES})
|
||||
set(companion_TS ${companion_TS} translations/companion_${language}.ts)
|
||||
endforeach(language)
|
||||
|
||||
set(companion_SRCS ${companion_SRCS})
|
||||
qt4_wrap_ui(companion_SRCS ${companion_UIS})
|
||||
qt4_wrap_cpp(companion_SRCS ${companion_MOC_HDRS})
|
||||
qt4_add_translation(companion_QM ${companion_TS})
|
||||
qt4_add_resources(companion_SRCS ${companion_RCS})
|
||||
|
||||
add_definitions(-DQT_TRANSLATIONS_DIR="${QT_TRANSLATIONS_DIR}")
|
||||
|
||||
if(APPLE)
|
||||
add_executable(${COMPANION_NAME} MACOSX_BUNDLE ${companion_SRCS} ${companion_QM})
|
||||
# OS X compiler no longer automatically includes /Library/Frameworks in search path
|
||||
set(CMAKE_EXE_LINKER_FLAGS -F/Library/Frameworks)
|
||||
else()
|
||||
add_executable(${COMPANION_NAME} WIN32 ${companion_SRCS} ${companion_QM})
|
||||
endif()
|
||||
|
||||
target_link_libraries(${COMPANION_NAME} generaledit modeledit simulation common qcustomplot shared ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY} ${XERCESC_LIBRARY} ${PTHREAD_LIBRARY} ${SDL_LIBRARY} ${PHONON_LIBS})
|
||||
|
||||
############# Standalone simu ###############
|
||||
|
||||
set(simu_SRCS
|
||||
modeledit/node.cpp
|
||||
modeledit/edge.cpp # TODO not needed
|
||||
simulator.cpp
|
||||
)
|
||||
|
||||
set(simu_MOC_HDRS
|
||||
modeledit/node.h
|
||||
)
|
||||
|
||||
set(simu_SRCS ${simu_SRCS})
|
||||
qt4_wrap_cpp(simu_SRCS ${simu_MOC_HDRS})
|
||||
qt4_add_resources(simu_SRCS companion.qrc) # TODO not needed
|
||||
|
||||
if(WIN32)
|
||||
set(simu_SRCS ${simu_SRCS} icon.rc)
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
add_executable(${SIMULATOR_NAME} MACOSX_BUNDLE ${simu_SRCS})
|
||||
else()
|
||||
add_executable(${SIMULATOR_NAME} WIN32 ${simu_SRCS})
|
||||
endif()
|
||||
|
||||
target_link_libraries(${SIMULATOR_NAME} simulation common qxtcommandoptions ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY} ${PTHREAD_LIBRARY} ${SDL_LIBRARY} ${PHONON_LIBS} ${OPENTX_SIMULATOR_LIBS})
|
||||
|
||||
############# Packaging ####################
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
install(TARGETS ${COMPANION_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
|
||||
install(TARGETS ${SIMULATOR_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/companion.desktop DESTINATION share/applications RENAME companion${C9X_NAME_SUFFIX}.desktop)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/simulator.desktop DESTINATION share/applications RENAME simulator${C9X_NAME_SUFFIX}.desktop)
|
||||
install(FILES images/linuxicons/16x16/companion.png DESTINATION /usr/share/icons/hicolor/16x16/apps RENAME companion${C9X_NAME_SUFFIX}.png)
|
||||
install(FILES images/linuxicons/22x22/companion.png DESTINATION /usr/share/icons/hicolor/22x22/apps RENAME companion${C9X_NAME_SUFFIX}.png)
|
||||
install(FILES images/linuxicons/24x24/companion.png DESTINATION /usr/share/icons/hicolor/24x24/apps RENAME companion${C9X_NAME_SUFFIX}.png)
|
||||
install(FILES images/linuxicons/32x32/companion.png DESTINATION /usr/share/icons/hicolor/32x32/apps RENAME companion${C9X_NAME_SUFFIX}.png)
|
||||
install(FILES images/linuxicons/48x48/companion.png DESTINATION /usr/share/icons/hicolor/48x48/apps RENAME companion${C9X_NAME_SUFFIX}.png)
|
||||
install(FILES images/linuxicons/128x128/companion.png DESTINATION /usr/share/icons/hicolor/128x128/apps RENAME companion${C9X_NAME_SUFFIX}.png)
|
||||
install(FILES images/linuxicons/256x256/companion.png DESTINATION /usr/share/icons/hicolor/256x256/apps RENAME companion${C9X_NAME_SUFFIX}.png)
|
||||
install(FILES images/linuxicons/512x512/companion.png DESTINATION /usr/share/icons/hicolor/512x512/apps RENAME companion${C9X_NAME_SUFFIX}.png)
|
||||
install(FILES images/linuxicons/scalable/companion.svg DESTINATION /usr/share/icons/hicolor/scalable/apps RENAME companion${C9X_NAME_SUFFIX}.svg)
|
||||
install(FILES ../targets/linux/45-companion-taranis.rules DESTINATION /lib/udev/rules.d RENAME 45-companion${C9X_NAME_SUFFIX}-taranis.rules)
|
||||
# Linux specific code
|
||||
set(OperatingSystem "Linux")
|
||||
else(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
install(TARGETS ${COMPANION_NAME} DESTINATION ${QT_BINARY_DIR})
|
||||
endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
|
||||
if(WIN32)
|
||||
if(MSVC)
|
||||
set(COMPANION_NSI_IN_FILE companion-vs.nsi.in)
|
||||
set(SIMULATOR_NSI_IN_FILE simulator-vs.nsi.in)
|
||||
else()
|
||||
set(COMPANION_NSI_IN_FILE companion-msys.nsi.in)
|
||||
set(SIMULATOR_NSI_IN_FILE simulator-msys.nsi.in)
|
||||
endif()
|
||||
|
||||
set(SYSDIR "$ENV{windir}/system32")
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../targets/windows/${COMPANION_NSI_IN_FILE} ${PROJECT_BINARY_DIR}/companion/companion.nsi @ONLY)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../targets/windows/${SIMULATOR_NSI_IN_FILE} ${PROJECT_BINARY_DIR}/companion/simulator.nsi @ONLY)
|
||||
|
||||
find_program(NSIS_EXE makensis.exe PATHS
|
||||
"C:/Program Files/NSIS"
|
||||
"C:/Program Files (x86)/NSIS"
|
||||
"C:/Programs/NSIS"
|
||||
)
|
||||
|
||||
add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/companion/companion-windows.exe
|
||||
COMMAND "${NSIS_EXE}" ARGS ${PROJECT_BINARY_DIR}/companion/companion.nsi
|
||||
DEPENDS companion simulator opentx-simulators ${PROJECT_BINARY_DIR}/companion/companion.nsi
|
||||
COMMENT "Companion Windows NSIS Installer")
|
||||
|
||||
add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/companion/simulator-install.exe
|
||||
COMMAND "${NSIS_EXE}" ARGS ${PROJECT_BINARY_DIR}/companion/simulator.nsi
|
||||
DEPENDS simulator opentx-simulators ${PROJECT_BINARY_DIR}/companion/simulator.nsi
|
||||
COMMENT "Simulator Windows NSIS Installer")
|
||||
|
||||
add_custom_target(installer
|
||||
DEPENDS ${PROJECT_BINARY_DIR}/companion/companion-windows.exe
|
||||
DEPENDS ${PROJECT_BINARY_DIR}/companion/simulator-windows.exe
|
||||
SOURCES ${PROJECT_BINARY_DIR}/companion/companion.nsi
|
||||
SOURCES ${PROJECT_BINARY_DIR}/companion/simulator.nsi
|
||||
)
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
set(MACOSX_BUNDLE_ICON_FILE iconmac.icns)
|
||||
if(CMAKE_GENERATOR STREQUAL Xcode)
|
||||
set(WORK_DIR ${CMAKE_BINARY_DIR}/Debug)
|
||||
else()
|
||||
set(WORK_DIR ${PROJECT_BINARY_DIR})
|
||||
endif()
|
||||
|
||||
add_custom_target(addframeworks
|
||||
COMMAND mkdir -p companion.app/Contents/Frameworks
|
||||
COMMAND mkdir -p companion.app/Contents/Resources
|
||||
COMMAND mkdir -p companion.app/Contents/translations
|
||||
COMMAND rsync ${PROJECT_SOURCE_DIR}/images/${MACOSX_BUNDLE_ICON_FILE} companion.app/Contents/Resources/${MACOSX_BUNDLE_ICON_FILE} # Copy the icon files
|
||||
COMMAND rsync -r --exclude=.svn ${PROJECT_SOURCE_DIR}/../targets/mac/qt_menu.nib companion.app/Contents/Resources/
|
||||
COMMAND rsync ${PROJECT_BINARY_DIR}/*.qm companion.app/Contents/translations
|
||||
COMMAND rsync ${PROJECT_BINARY_DIR}/*.qm companion.app/Contents/translations
|
||||
COMMAND rsync -r ${XSD_INCLUDE_DIR}/.. companion.app/Contents/Frameworks/
|
||||
COMMAND rsync -r /Library/Frameworks/SDL.framework companion.app/Contents/Frameworks/
|
||||
COMMAND ${QT_BINARY_DIR}/macdeployqt companion.app
|
||||
COMMAND install_name_tool -change @rpath/SDL.framework/Versions/A/SDL @executable_path/../Frameworks/SDL.framework/Versions/A/SDL companion.app/Contents/MacOS/companion
|
||||
WORKING_DIRECTORY ${WORK_DIR}
|
||||
DEPENDS ${COMPANION_NAME})
|
||||
|
||||
add_custom_target(makedmg
|
||||
COMMAND ${QT_BINARY_DIR}/macdeployqt companion.app -dmg -no-plugins
|
||||
WORKING_DIRECTORY ${WORK_DIR}
|
||||
DEPENDS addframeworks opentx-simulators-bundle)
|
||||
endif()
|
||||
|
||||
if(LUPDATE_FOUND)
|
||||
add_custom_target(translations
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
COMMAND ${LUPDATE_EXECUTABLE} ${CMAKE_SOURCE_DIR} -no-obsolete -ts ${companion_TS}
|
||||
)
|
||||
else()
|
||||
add_custom_target(translations
|
||||
COMMAND echo "Sorry, QT lupdate was not found."
|
||||
)
|
||||
endif()
|
||||
|
||||
set(CPACK_PACKAGE_NAME "companion${C9X_NAME_SUFFIX}")
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Models and settings editor for the OpenTx open source firmware")
|
||||
string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_PACKAGE_NAME_LOWERCASE)
|
||||
|
||||
# The file stripping is deliberately disabled, with the stripped file we get
|
||||
# very poor trace-backs from the users when they report Companion crash
|
||||
set(CPACK_STRIP_FILES FALSE)
|
||||
|
||||
find_program(DPKG_PROGRAM dpkg DOC "dpkg program of Debian-based systems")
|
||||
if(DPKG_PROGRAM)
|
||||
set(CPACK_GENERATOR "DEB")
|
||||
execute_process(
|
||||
COMMAND ${DPKG_PROGRAM} --print-architecture
|
||||
OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME_LOWERCASE}_${VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
|
||||
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Bertrand Songis <bsongis-nosp@m-gmail.com>")
|
||||
set(CPACK_DEBIAN_PACKAGE_VERSION ${VERSION})
|
||||
set(CPACK_DEBIAN_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
|
||||
set(CPACK_DEBIAN_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
|
||||
set(CPACK_DEBIAN_ARCHITECTURE $(CMAKE_SYSTEM_PROCESSOR))
|
||||
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
|
||||
else(DPKG_PROGRAM)
|
||||
set(CPACK_GENERATOR "RPM")
|
||||
set(CPACK_RPM_PACKAGE_VERSION ${VERSION})
|
||||
set(CPACK_RPM_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
|
||||
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME_LOWERCASE}-${VERSION}-${CMAKE_SYSTEM_PROCESSOR}")
|
||||
SET(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/lib /lib/udev /lib/udev/rules.d")
|
||||
endif(DPKG_PROGRAM)
|
||||
|
||||
include(CPack)
|
||||
@@ -1,786 +0,0 @@
|
||||
/*
|
||||
* Author - Kjell Kernen
|
||||
*
|
||||
* 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 "appdata.h"
|
||||
|
||||
// Global data and storage object
|
||||
AppData g;
|
||||
|
||||
// ** CompStoreObj class********************
|
||||
void CompStoreObj::clear (const QString tag1, const QString tag2, const QString tag3)
|
||||
{
|
||||
QSettings settings(COMPANY, PRODUCT);
|
||||
if (tag2.isEmpty())
|
||||
{
|
||||
settings.remove(tag1);
|
||||
}
|
||||
else if (tag3.isEmpty())
|
||||
{
|
||||
settings.beginGroup(tag1);
|
||||
settings.remove(tag2);
|
||||
settings.endGroup();
|
||||
}
|
||||
else
|
||||
{
|
||||
settings.beginGroup(tag1);
|
||||
settings.beginGroup(tag2);
|
||||
settings.remove(tag3);
|
||||
settings.endGroup();
|
||||
settings.endGroup();
|
||||
}
|
||||
}
|
||||
|
||||
void CompStoreObj::store(const QByteArray newArray, QByteArray &array, const QString tag, const QString group1, const QString group2 )
|
||||
{
|
||||
QSettings settings(COMPANY, PRODUCT);
|
||||
if (!group1.isEmpty()) settings.beginGroup(group1);
|
||||
if (!group2.isEmpty()) settings.beginGroup(group2);
|
||||
|
||||
settings.setValue(tag, newArray);
|
||||
array = newArray;
|
||||
|
||||
if (!group1.isEmpty()) settings.endGroup();
|
||||
if (!group2.isEmpty()) settings.endGroup();
|
||||
}
|
||||
|
||||
void CompStoreObj::store(const QStringList newSList, QStringList &stringList, const QString tag, const QString group1, const QString group2 )
|
||||
{
|
||||
QSettings settings(COMPANY, PRODUCT);
|
||||
if (!group1.isEmpty()) settings.beginGroup(group1);
|
||||
if (!group2.isEmpty()) settings.beginGroup(group2);
|
||||
|
||||
settings.setValue(tag, newSList);
|
||||
stringList = newSList;
|
||||
|
||||
if (!group1.isEmpty()) settings.endGroup();
|
||||
if (!group2.isEmpty()) settings.endGroup();
|
||||
}
|
||||
|
||||
void CompStoreObj::store(const QString newString, QString &string, const QString tag, const QString group1, const QString group2 )
|
||||
{
|
||||
QSettings settings(COMPANY, PRODUCT);
|
||||
if (!group1.isEmpty()) settings.beginGroup(group1);
|
||||
if (!group2.isEmpty()) settings.beginGroup(group2);
|
||||
|
||||
settings.setValue(tag, newString);
|
||||
string = newString;
|
||||
|
||||
if (!group1.isEmpty()) settings.endGroup();
|
||||
if (!group2.isEmpty()) settings.endGroup();
|
||||
}
|
||||
|
||||
void CompStoreObj::store(const bool newTruth, bool &truth, const QString tag, const QString group1, const QString group2 )
|
||||
{
|
||||
QSettings settings(COMPANY, PRODUCT);
|
||||
if (!group1.isEmpty()) settings.beginGroup(group1);
|
||||
if (!group2.isEmpty()) settings.beginGroup(group2);
|
||||
|
||||
settings.setValue(tag, newTruth);
|
||||
truth = newTruth;
|
||||
|
||||
if (!group1.isEmpty()) settings.endGroup();
|
||||
if (!group2.isEmpty()) settings.endGroup();
|
||||
}
|
||||
|
||||
void CompStoreObj::store(const int newNumber, int &number, const QString tag, const QString group1, const QString group2 )
|
||||
{
|
||||
QSettings settings(COMPANY, PRODUCT);
|
||||
if (!group1.isEmpty()) settings.beginGroup(group1);
|
||||
if (!group2.isEmpty()) settings.beginGroup(group2);
|
||||
|
||||
settings.setValue(tag, newNumber);
|
||||
number = newNumber;
|
||||
|
||||
if (!group1.isEmpty()) settings.endGroup();
|
||||
if (!group2.isEmpty()) settings.endGroup();
|
||||
}
|
||||
|
||||
// Retrieval functions
|
||||
void CompStoreObj::retrieve( QByteArray &array, const QString tag, const QString def, const QString group1, const QString group2 )
|
||||
{
|
||||
QSettings settings(COMPANY, PRODUCT);
|
||||
if (!group1.isEmpty()) settings.beginGroup(group1);
|
||||
if (!group2.isEmpty()) settings.beginGroup(group2);
|
||||
|
||||
array = settings.value(tag, def).toByteArray();
|
||||
|
||||
if (!group1.isEmpty()) settings.endGroup();
|
||||
if (!group2.isEmpty()) settings.endGroup();
|
||||
}
|
||||
|
||||
void CompStoreObj::retrieve( QStringList &stringList, const QString tag, const QString def, const QString group1, const QString group2 )
|
||||
{
|
||||
QSettings settings(COMPANY, PRODUCT);
|
||||
if (!group1.isEmpty()) settings.beginGroup(group1);
|
||||
if (!group2.isEmpty()) settings.beginGroup(group2);
|
||||
|
||||
stringList = settings.value(tag, def).toStringList();
|
||||
|
||||
if (!group1.isEmpty()) settings.endGroup();
|
||||
if (!group2.isEmpty()) settings.endGroup();
|
||||
}
|
||||
|
||||
void CompStoreObj::retrieve( QString &string, const QString tag, const QString def, const QString group1, const QString group2 )
|
||||
{
|
||||
QSettings settings(COMPANY, PRODUCT);
|
||||
if (!group1.isEmpty()) settings.beginGroup(group1);
|
||||
if (!group2.isEmpty()) settings.beginGroup(group2);
|
||||
|
||||
string = settings.value(tag, def).toString();
|
||||
|
||||
if (!group1.isEmpty()) settings.endGroup();
|
||||
if (!group2.isEmpty()) settings.endGroup();
|
||||
}
|
||||
|
||||
void CompStoreObj::retrieve( bool &truth, const QString tag, const bool def, const QString group1, const QString group2 )
|
||||
{
|
||||
QSettings settings(COMPANY, PRODUCT);
|
||||
if (!group1.isEmpty()) settings.beginGroup(group1);
|
||||
if (!group2.isEmpty()) settings.beginGroup(group2);
|
||||
|
||||
truth = settings.value(tag, def).toBool();
|
||||
|
||||
if (!group1.isEmpty()) settings.endGroup();
|
||||
if (!group2.isEmpty()) settings.endGroup();
|
||||
}
|
||||
|
||||
void CompStoreObj::retrieve( int &number, const QString tag, const int def, const QString group1, const QString group2 )
|
||||
{
|
||||
QSettings settings(COMPANY, PRODUCT);
|
||||
if (!group1.isEmpty()) settings.beginGroup(group1);
|
||||
if (!group2.isEmpty()) settings.beginGroup(group2);
|
||||
|
||||
number = settings.value(tag, def).toInt();
|
||||
|
||||
if (!group1.isEmpty()) settings.endGroup();
|
||||
if (!group2.isEmpty()) settings.endGroup();
|
||||
}
|
||||
|
||||
// Retrieve and Store functions
|
||||
void CompStoreObj::getset( QByteArray &array, const QString tag, const QString def, const QString group1, const QString group2 )
|
||||
{
|
||||
retrieve( array, tag, def, group1, group2);
|
||||
store(array, array, tag, group1, group2);
|
||||
}
|
||||
|
||||
void CompStoreObj::getset( QStringList &stringList, const QString tag, const QString def, const QString group1, const QString group2 )
|
||||
{
|
||||
retrieve( stringList, tag, def, group1, group2);
|
||||
store(stringList, stringList, tag, group1, group2);
|
||||
}
|
||||
|
||||
void CompStoreObj::getset( QString &string, const QString tag, const QString def, const QString group1, const QString group2 )
|
||||
{
|
||||
retrieve( string, tag, def, group1, group2);
|
||||
store(string, string, tag, group1, group2);
|
||||
}
|
||||
|
||||
void CompStoreObj::getset( bool &truth, const QString tag, const bool def, const QString group1, const QString group2 )
|
||||
{
|
||||
retrieve( truth, tag, def, group1, group2);
|
||||
store(truth, truth, tag, group1, group2);
|
||||
}
|
||||
|
||||
void CompStoreObj::getset( int &number, const QString tag, const int def, const QString group1, const QString group2 )
|
||||
{
|
||||
retrieve( number, tag, def, group1, group2);
|
||||
store(number, number, tag, group1, group2);
|
||||
}
|
||||
|
||||
// ** FwRevision class********************
|
||||
int FwRevision::get( const QString fwType )
|
||||
{
|
||||
QString result;
|
||||
retrieve( result, fwType, "", "FwRevisions" );
|
||||
return result.toInt();
|
||||
}
|
||||
|
||||
void FwRevision::set( const QString fwType, const int fwRevision )
|
||||
{
|
||||
QString tempString = QString("%1").arg(fwRevision);
|
||||
store( tempString, tempString, fwType, "FwRevisions" );
|
||||
}
|
||||
|
||||
void FwRevision::remove( const QString tag )
|
||||
{
|
||||
clear( "FwRevisions", tag );
|
||||
}
|
||||
|
||||
// ** JStickData class********************
|
||||
// Get declarations
|
||||
int JStickData::stick_axe() { return _stickAxe; }
|
||||
int JStickData::stick_min() { return _stickMin; }
|
||||
int JStickData::stick_med() { return _stickMed; }
|
||||
int JStickData::stick_max() { return _stickMax; }
|
||||
int JStickData::stick_inv() { return _stickInv; }
|
||||
|
||||
// Set declarations
|
||||
void JStickData::stick_axe(const int it) { store( it, _stickAxe, QString("stick%1_axe").arg(index), "JsCalibration" );}
|
||||
void JStickData::stick_min(const int it) { store( it, _stickMin, QString("stick%1_min").arg(index), "JsCalibration" );}
|
||||
void JStickData::stick_med(const int it) { store( it, _stickMed, QString("stick%1_med").arg(index), "JsCalibration" );}
|
||||
void JStickData::stick_max(const int it) { store( it, _stickMax, QString("stick%1_max").arg(index), "JsCalibration" );}
|
||||
void JStickData::stick_inv(const int it) { store( it, _stickInv, QString("stick%1_inv").arg(index), "JsCalibration" );}
|
||||
|
||||
// Constructor
|
||||
JStickData::JStickData()
|
||||
{
|
||||
index = -1;
|
||||
}
|
||||
|
||||
void JStickData::remove()
|
||||
{
|
||||
// Remove all JStickData values from settings file
|
||||
QSettings settings(COMPANY, PRODUCT);
|
||||
settings.beginGroup( "JsCalibration" );
|
||||
settings.remove( QString( "stick%1_axe").arg(index) );
|
||||
settings.remove( QString( "stick%1_min").arg(index) );
|
||||
settings.remove( QString( "stick%1_med").arg(index) );
|
||||
settings.remove( QString( "stick%1_max").arg(index) );
|
||||
settings.remove( QString( "stick%1_inv").arg(index) );
|
||||
settings.endGroup();
|
||||
|
||||
// Reset all JStickData variables to initial values
|
||||
init(index);
|
||||
}
|
||||
|
||||
bool JStickData::existsOnDisk()
|
||||
{
|
||||
QSettings settings(COMPANY, PRODUCT);
|
||||
settings.beginGroup("JsCalibration");
|
||||
int axe = settings.value( QString("stick%1_axe").arg(index), -1 ).toInt();
|
||||
settings.endGroup();
|
||||
|
||||
return (axe > -1);
|
||||
}
|
||||
|
||||
void JStickData::init(int newIndex)
|
||||
{
|
||||
index = newIndex;
|
||||
_stickAxe = -1;
|
||||
_stickMin = -32767;
|
||||
_stickMed = 0;
|
||||
_stickMax = 0;
|
||||
_stickInv = 0;
|
||||
|
||||
// Do not write empty joystick calibrations to disk.
|
||||
if ( !existsOnDisk() )
|
||||
return;
|
||||
|
||||
flush();
|
||||
}
|
||||
|
||||
void JStickData::flush()
|
||||
{
|
||||
getset( _stickAxe, QString("stick%1_axe").arg(index), -1, "JsCalibration" );
|
||||
getset( _stickMin, QString("stick%1_min").arg(index), -32767, "JsCalibration" );
|
||||
getset( _stickMed, QString("stick%1_med").arg(index), 0, "JsCalibration" );
|
||||
getset( _stickMax, QString("stick%1_max").arg(index), 0, "JsCalibration" );
|
||||
getset( _stickInv, QString("stick%1_inv").arg(index), 0, "JsCalibration" );
|
||||
}
|
||||
|
||||
// ** Profile class********************
|
||||
// Get declarations
|
||||
QString Profile::fwName() const { return _fwName; }
|
||||
QString Profile::fwType() const { return _fwType; }
|
||||
QString Profile::name() const { return _name; }
|
||||
QString Profile::sdPath() const { return _sdPath; }
|
||||
int Profile::volumeGain() const { return _volumeGain; }
|
||||
QString Profile::pBackupDir() const { return _pBackupDir; }
|
||||
QString Profile::splashFile() const { return _splashFile; }
|
||||
bool Profile::burnFirmware() const { return _burnFirmware; }
|
||||
bool Profile::penableBackup() const { return _penableBackup; }
|
||||
bool Profile::renameFwFiles() const { return _renameFwFiles; }
|
||||
int Profile::channelOrder() const { return _channelOrder; }
|
||||
int Profile::defaultMode() const { return _defaultMode; }
|
||||
|
||||
QString Profile::beeper() const { return _beeper; }
|
||||
QString Profile::countryCode() const { return _countryCode; }
|
||||
QString Profile::display() const { return _display; }
|
||||
QString Profile::haptic() const { return _haptic; }
|
||||
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::txCurrentCalibration() const { return _txCurrentCalibration; }
|
||||
int Profile::gsStickMode() const { return _gsStickMode; }
|
||||
int Profile::ppmMultiplier() const { return _ppmMultiplier; }
|
||||
int Profile::txVoltageCalibration() const { return _txVoltageCalibration; }
|
||||
int Profile::vBatWarn() const { return _vBatWarn; }
|
||||
int Profile::vBatMin() const { return _vBatMin; }
|
||||
int Profile::vBatMax() const { return _vBatMax; }
|
||||
|
||||
// Set declarations
|
||||
void Profile::name (const QString x) { store(x, _name, "Name" ,"Profiles", QString("profile%1").arg(index));}
|
||||
void Profile::fwName (const QString x) { store(x, _fwName, "fwName" ,"Profiles", QString("profile%1").arg(index));}
|
||||
void Profile::fwType (const QString x) { store(x, _fwType, "fwType" ,"Profiles", QString("profile%1").arg(index));}
|
||||
void Profile::sdPath (const QString x) { store(x, _sdPath, "sdPath" ,"Profiles", QString("profile%1").arg(index));}
|
||||
void Profile::volumeGain (const int x) { store(x, _volumeGain, "volumeGain" ,"Profiles", QString("profile%1").arg(index));}
|
||||
void Profile::pBackupDir (const QString x) { store(x, _pBackupDir, "pBackupDir" ,"Profiles", QString("profile%1").arg(index));}
|
||||
void Profile::splashFile (const QString x) { store(x, _splashFile, "SplashFileName" ,"Profiles", QString("profile%1").arg(index));}
|
||||
void Profile::burnFirmware (const bool x) { store(x, _burnFirmware, "burnFirmware" ,"Profiles", QString("profile%1").arg(index));}
|
||||
void Profile::renameFwFiles (const bool x) { store(x, _renameFwFiles, "rename_firmware_files" ,"Profiles", QString("profile%1").arg(index));}
|
||||
void Profile::penableBackup (const bool x) { store(x, _penableBackup, "penableBackup" ,"Profiles", QString("profile%1").arg(index));}
|
||||
void Profile::channelOrder (const int x) { store(x, _channelOrder, "default_channel_order" ,"Profiles", QString("profile%1").arg(index));}
|
||||
void Profile::defaultMode (const int x) { store(x, _defaultMode, "default_mode" ,"Profiles", QString("profile%1").arg(index));}
|
||||
|
||||
void Profile::beeper (const QString x) { store(x, _beeper, "Beeper" ,"Profiles", QString("profile%1").arg(index));}
|
||||
void Profile::countryCode (const QString x) { store(x, _countryCode, "countryCode" ,"Profiles", QString("profile%1").arg(index));}
|
||||
void Profile::display (const QString x) { store(x, _display, "Display" ,"Profiles", QString("profile%1").arg(index));}
|
||||
void Profile::haptic (const QString x) { store(x, _haptic, "Haptic" ,"Profiles", QString("profile%1").arg(index));}
|
||||
void Profile::speaker (const QString x) { store(x, _speaker, "Speaker" ,"Profiles", QString("profile%1").arg(index));}
|
||||
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::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::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));}
|
||||
|
||||
// Constructor
|
||||
Profile::Profile()
|
||||
{
|
||||
index = -1;
|
||||
}
|
||||
|
||||
// The default copy operator can not be used since the index variable would be destroyed
|
||||
Profile& Profile::operator=(const Profile& rhs)
|
||||
{
|
||||
name ( rhs.name() );
|
||||
fwName ( rhs.fwName() );
|
||||
fwType ( rhs.fwType() );
|
||||
sdPath ( rhs.sdPath() );
|
||||
volumeGain ( rhs.volumeGain() );
|
||||
pBackupDir ( rhs.pBackupDir() );
|
||||
splashFile ( rhs.splashFile() );
|
||||
burnFirmware ( rhs.burnFirmware() );
|
||||
renameFwFiles( rhs.renameFwFiles() );
|
||||
penableBackup( rhs.penableBackup() );
|
||||
channelOrder ( rhs.channelOrder() );
|
||||
defaultMode ( rhs.defaultMode() );
|
||||
beeper ( rhs.beeper() );
|
||||
countryCode ( rhs.countryCode() );
|
||||
display ( rhs.display() );
|
||||
haptic ( rhs.haptic() );
|
||||
speaker ( rhs.speaker() );
|
||||
stickPotCalib( rhs.stickPotCalib() );
|
||||
trainerCalib ( rhs.trainerCalib() );
|
||||
txCurrentCalibration ( rhs.txCurrentCalibration() );
|
||||
gsStickMode ( rhs.gsStickMode() );
|
||||
ppmMultiplier( rhs.ppmMultiplier() );
|
||||
txVoltageCalibration ( rhs.txVoltageCalibration() );
|
||||
vBatWarn ( rhs.vBatWarn() );
|
||||
vBatMin ( rhs.vBatMin() );
|
||||
vBatMax ( rhs.vBatMax() );
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
void Profile::remove()
|
||||
{
|
||||
// Remove all profile values from settings file
|
||||
QSettings settings(COMPANY, PRODUCT);
|
||||
settings.beginGroup("Profiles");
|
||||
settings.remove(QString("profile%1").arg(index));
|
||||
settings.endGroup();
|
||||
|
||||
// Reset all profile variables to initial values
|
||||
init(index);
|
||||
}
|
||||
|
||||
bool Profile::existsOnDisk()
|
||||
{
|
||||
QSettings settings(COMPANY, PRODUCT);
|
||||
settings.beginGroup("Profiles");
|
||||
settings.beginGroup(QString("profile%1").arg(index));
|
||||
QStringList keyList = settings.allKeys();
|
||||
settings.endGroup();
|
||||
settings.endGroup();
|
||||
|
||||
return (keyList.length() > 0);
|
||||
}
|
||||
|
||||
void Profile::initFwVariables()
|
||||
{
|
||||
_beeper = "";
|
||||
_countryCode = "";
|
||||
_display = "";
|
||||
_haptic = "";
|
||||
_speaker = "";
|
||||
_stickPotCalib = "";
|
||||
_timeStamp = "";
|
||||
_trainerCalib = "";
|
||||
|
||||
_txCurrentCalibration = 0;
|
||||
_gsStickMode = 0;
|
||||
_ppmMultiplier = 0;
|
||||
_txVoltageCalibration = 0;
|
||||
_vBatWarn = 0;
|
||||
_vBatMin = 0;
|
||||
_vBatMax = 0;
|
||||
}
|
||||
|
||||
void Profile::init(int newIndex)
|
||||
{
|
||||
index = newIndex;
|
||||
|
||||
_fwName = "";
|
||||
_fwType = "";
|
||||
_name = "";
|
||||
_sdPath = "";
|
||||
_volumeGain = 10;
|
||||
_pBackupDir = "";
|
||||
_splashFile = "";
|
||||
_burnFirmware = false;
|
||||
_renameFwFiles = false;
|
||||
_penableBackup = false;
|
||||
_channelOrder = 0;
|
||||
_defaultMode = 1;
|
||||
|
||||
initFwVariables();
|
||||
|
||||
// Do not write empty profiles to disk except the default (0) profile.
|
||||
if ( index > 0 && !existsOnDisk())
|
||||
return;
|
||||
|
||||
flush();
|
||||
}
|
||||
|
||||
void Profile::flush()
|
||||
{
|
||||
// Load and store all variables. Use default values if setting values are missing
|
||||
getset( _fwName, "fwName" ,"" ,"Profiles", QString("profile%1").arg(index));
|
||||
getset( _fwType, "fwType" ,"" ,"Profiles", QString("profile%1").arg(index));
|
||||
getset( _name, "Name" ,"" ,"Profiles", QString("profile%1").arg(index));
|
||||
getset( _sdPath, "sdPath" ,"" ,"Profiles", QString("profile%1").arg(index));
|
||||
getset( _volumeGain, "volumeGain" ,10 ,"Profiles", QString("profile%1").arg(index));
|
||||
getset( _pBackupDir, "pBackupDir" ,"" ,"Profiles", QString("profile%1").arg(index));
|
||||
getset( _splashFile, "SplashFileName" ,"" ,"Profiles", QString("profile%1").arg(index));
|
||||
getset( _burnFirmware, "burnFirmware" ,false ,"Profiles", QString("profile%1").arg(index));
|
||||
getset( _penableBackup, "penableBackup" ,false ,"Profiles", QString("profile%1").arg(index));
|
||||
getset( _renameFwFiles, "rename_firmware_files" ,false ,"Profiles", QString("profile%1").arg(index));
|
||||
getset( _channelOrder, "default_channel_order" ,0 ,"Profiles", QString("profile%1").arg(index));
|
||||
getset( _defaultMode, "default_mode" ,1 ,"Profiles", QString("profile%1").arg(index));
|
||||
|
||||
getset( _beeper, "Beeper" ,"" ,"Profiles", QString("profile%1").arg(index));
|
||||
getset( _countryCode, "countryCode" ,"" ,"Profiles", QString("profile%1").arg(index));
|
||||
getset( _display, "Display" ,"" ,"Profiles", QString("profile%1").arg(index));
|
||||
getset( _haptic, "Haptic" ,"" ,"Profiles", QString("profile%1").arg(index));
|
||||
getset( _speaker, "Speaker" ,"" ,"Profiles", QString("profile%1").arg(index));
|
||||
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( _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( _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));
|
||||
}
|
||||
|
||||
|
||||
// ** AppData class********************
|
||||
|
||||
// Get declarations
|
||||
QStringList AppData::recentFiles() { return _recentFiles; }
|
||||
QByteArray AppData::mainWinGeo() { return _mainWinGeo; }
|
||||
QByteArray AppData::mainWinState() { return _mainWinState; }
|
||||
QByteArray AppData::modelEditGeo() { return _modelEditGeo; }
|
||||
|
||||
QString AppData::armMcu() { return _armMcu; }
|
||||
QString AppData::avrArguments() { return _avrArguments; }
|
||||
QString AppData::avrPort() { return _avrPort; }
|
||||
QString AppData::avrdudeLocation() { return _avrdudeLocation; }
|
||||
QString AppData::dfuArguments() { return _dfuArguments; }
|
||||
QString AppData::dfuLocation() { return _dfuLocation; }
|
||||
QString AppData::locale() { return _locale; }
|
||||
QString AppData::mcu() { return _mcu; }
|
||||
QString AppData::programmer() { return _programmer; }
|
||||
QString AppData::sambaLocation() { return _sambaLocation; }
|
||||
QString AppData::sambaPort() { return _sambaPort; }
|
||||
QString AppData::lastSimulator() { return _lastSimulator; }
|
||||
|
||||
QString AppData::backupDir() { return _backupDir; }
|
||||
QString AppData::gePath() { return _gePath; }
|
||||
QString AppData::eepromDir() { return _eepromDir; }
|
||||
QString AppData::flashDir() { return _flashDir; }
|
||||
QString AppData::imagesDir() { return _imagesDir; }
|
||||
QString AppData::logDir() { return _logDir; }
|
||||
QString AppData::libDir() { return _libDir; }
|
||||
QString AppData::snapshotDir() { return _snapshotDir; }
|
||||
QString AppData::updatesDir() { return _updatesDir; }
|
||||
|
||||
bool AppData::jsSupport() { return _jsSupport; }
|
||||
bool AppData::maximized() { return _maximized; }
|
||||
bool AppData::showSplash() { return _showSplash; }
|
||||
bool AppData::snapToClpbrd() { return _snapToClpbrd; }
|
||||
bool AppData::autoCheckApp() { return _autoCheckApp; }
|
||||
bool AppData::autoCheckFw() { return _autoCheckFw; }
|
||||
bool AppData::simuSW() { return _simuSW; }
|
||||
bool AppData::useWizard() { return _useWizard; }
|
||||
|
||||
int AppData::backLight() { return _backLight; }
|
||||
int AppData::embedSplashes() { return _embedSplashes; }
|
||||
int AppData::fwServerFails() { return _fwServerFails; }
|
||||
int AppData::generalEditTab() { return _generalEditTab; }
|
||||
int AppData::iconSize() { return _iconSize; }
|
||||
int AppData::historySize() { return _historySize; }
|
||||
int AppData::jsCtrl() { return _jsCtrl; }
|
||||
int AppData::id() { return _id; }
|
||||
int AppData::theme() { return _theme; }
|
||||
int AppData::warningId() { return _warningId; }
|
||||
|
||||
// Set declarations
|
||||
void AppData::recentFiles (const QStringList x) { store(x, _recentFiles, "recentFileList" );}
|
||||
void AppData::mainWinGeo (const QByteArray x) { store(x, _mainWinGeo, "mainWindowGeometry" );}
|
||||
void AppData::mainWinState (const QByteArray x) { store(x, _mainWinState, "mainWindowState" );}
|
||||
void AppData::modelEditGeo (const QByteArray x) { store(x, _modelEditGeo, "modelEditGeometry" );}
|
||||
|
||||
void AppData::armMcu (const QString x) { store(x, _armMcu, "arm_mcu" );}
|
||||
void AppData::avrArguments (const QString x) { store(x, _avrArguments, "avr_arguments" );}
|
||||
void AppData::avrPort (const QString x) { store(x, _avrPort, "avr_port" );}
|
||||
void AppData::avrdudeLocation (const QString x) { store(x, _avrdudeLocation, "avrdudeLocation" );}
|
||||
void AppData::dfuArguments (const QString x) { store(x, _dfuArguments, "dfu_arguments" );}
|
||||
void AppData::dfuLocation (const QString x) { store(x, _dfuLocation, "dfu_location" );}
|
||||
void AppData::locale (const QString x) { store(x, _locale, "locale" );}
|
||||
void AppData::mcu (const QString x) { store(x, _mcu, "mcu" );}
|
||||
void AppData::programmer (const QString x) { store(x, _programmer, "programmer" );}
|
||||
void AppData::sambaLocation (const QString x) { store(x, _sambaLocation, "samba_location" );}
|
||||
void AppData::sambaPort (const QString x) { store(x, _sambaPort, "samba_port" );}
|
||||
void AppData::lastSimulator (const QString x) { store(x, _lastSimulator, "last_simulator" );}
|
||||
|
||||
void AppData::backupDir (const QString x) { store(x, _backupDir, "backupPath" );}
|
||||
void AppData::gePath (const QString x) { store(x, _gePath, "gePath" );}
|
||||
void AppData::eepromDir (const QString x) { store(x, _eepromDir, "lastDir" );}
|
||||
void AppData::flashDir (const QString x) { store(x, _flashDir, "lastFlashDir" );}
|
||||
void AppData::imagesDir (const QString x) { store(x, _imagesDir, "lastImagesDir" );}
|
||||
void AppData::logDir (const QString x) { store(x, _logDir, "lastLogDir" );}
|
||||
void AppData::libDir (const QString x) { store(x, _libDir, "libraryPath" );}
|
||||
void AppData::snapshotDir (const QString x) { store(x, _snapshotDir, "snapshotpath" );}
|
||||
void AppData::updatesDir (const QString x) { store(x, _updatesDir, "lastUpdatesDir" );}
|
||||
|
||||
void AppData::maximized (const bool x) { store(x, _maximized, "maximized" );}
|
||||
void AppData::jsSupport (const bool x) { store(x, _jsSupport, "js_support" );}
|
||||
void AppData::showSplash (const bool x) { store(x, _showSplash, "show_splash" );}
|
||||
void AppData::snapToClpbrd (const bool x) { store(x, _snapToClpbrd, "snapshot_to_clipboard" );}
|
||||
void AppData::autoCheckApp (const bool x) { store(x, _autoCheckApp, "startup_check_companion" );}
|
||||
void AppData::autoCheckFw (const bool x) { store(x, _autoCheckFw, "startup_check_fw" );}
|
||||
void AppData::simuSW (const bool x) { store(x, _simuSW, "simuSW" );}
|
||||
void AppData::useWizard (const bool x) { store(x, _useWizard, "useWizard" );}
|
||||
|
||||
void AppData::backLight (const int x) { store(x, _backLight, "backLight" );}
|
||||
void AppData::embedSplashes (const int x) { store(x, _embedSplashes, "embedded_splashes" );}
|
||||
void AppData::fwServerFails (const int x) { store(x, _fwServerFails, "fwserver" );}
|
||||
void AppData::generalEditTab (const int x) { store(x, _generalEditTab, "generalEditTab" );}
|
||||
void AppData::iconSize (const int x) { store(x, _iconSize, "icon_size" );}
|
||||
void AppData::historySize (const int x) { store(x, _historySize, "history_size" );}
|
||||
void AppData::jsCtrl (const int x) { store(x, _jsCtrl, "js_ctrl" );}
|
||||
void AppData::id (const int x) { store(x, _id, "profileId" );}
|
||||
void AppData::theme (const int x) { store(x, _theme, "theme" );}
|
||||
void AppData::warningId (const int x) { store(x, _warningId, "warningId" );}
|
||||
|
||||
// Constructor
|
||||
AppData::AppData()
|
||||
{
|
||||
//Initialize the profiles
|
||||
for (int i=0; i<MAX_PROFILES; i++)
|
||||
profile[i].init( i );
|
||||
|
||||
//Initialize the joysticks
|
||||
for (int i=0; i<MAX_JOYSTICKS; i++)
|
||||
joystick[i].init( i );
|
||||
|
||||
QSettings settings(COMPANY, PRODUCT);
|
||||
|
||||
// Copy existing 2.1 settings if present
|
||||
if (profile[0].name().isEmpty())
|
||||
{
|
||||
QSettings settings21("OpenTX", "Companion 2.1");
|
||||
|
||||
QStringList keys = settings21.allKeys();
|
||||
for (QStringList::iterator i=keys.begin(); i!=keys.end(); i++)
|
||||
{
|
||||
if (settings21.value(*i) != QString("") && settings21.value(*i) != QString("Start Menu Folder"))
|
||||
{
|
||||
settings.setValue(*i, settings21.value(*i));
|
||||
}
|
||||
}
|
||||
|
||||
//Reload profiles
|
||||
for (int i=0; i<MAX_PROFILES; i++)
|
||||
profile[i].init( i );
|
||||
}
|
||||
|
||||
// Copy existing 2.0 settings if present
|
||||
if (profile[0].name().isEmpty())
|
||||
{
|
||||
QSettings settings20("OpenTX", "Companion 2.0");
|
||||
|
||||
QStringList keys = settings20.allKeys();
|
||||
for (QStringList::iterator i=keys.begin(); i!=keys.end(); i++)
|
||||
{
|
||||
if (settings20.value(*i) != QString("") && settings20.value(*i) != QString("Start Menu Folder"))
|
||||
{
|
||||
settings.setValue(*i, settings20.value(*i));
|
||||
}
|
||||
}
|
||||
|
||||
//Reload profiles
|
||||
for (int i=0; i<MAX_PROFILES; i++)
|
||||
profile[i].init( i );
|
||||
}
|
||||
|
||||
// Else copy existing <2.0.16 settings if present
|
||||
if (profile[0].name().isEmpty())
|
||||
{
|
||||
QSettings pre2016settings("OpenTX", "OpenTX Companion");
|
||||
|
||||
QStringList keys = pre2016settings.allKeys();
|
||||
for (QStringList::iterator i=keys.begin(); i!=keys.end(); i++)
|
||||
{
|
||||
if (pre2016settings.value(*i) != QString("") && pre2016settings.value(*i) != QString("Start Menu Folder"))
|
||||
{
|
||||
settings.setValue(*i, pre2016settings.value(*i));
|
||||
}
|
||||
}
|
||||
|
||||
//Reload profiles
|
||||
for (int i=0; i<MAX_PROFILES; i++)
|
||||
profile[i].init( i );
|
||||
}
|
||||
|
||||
// Else import settings from companion9x if present
|
||||
if (profile[0].name().isEmpty())
|
||||
{
|
||||
QSettings c9x_settings("companion9x", "companion9x");
|
||||
// Copy all settings from companion9x to companion
|
||||
QStringList keys = c9x_settings.allKeys();
|
||||
for (QStringList::iterator i=keys.begin(); i!=keys.end(); i++)
|
||||
{
|
||||
settings.setValue(*i, c9x_settings.value(*i));
|
||||
}
|
||||
|
||||
// Store old values in new locations
|
||||
autoCheckApp(settings.value("startup_check_companion9x", true).toBool());
|
||||
useWizard(settings.value("wizardEnable", true).toBool());
|
||||
|
||||
// Convert and store the firmware type
|
||||
QString fwType = settings.value("firmware", "").toString();
|
||||
fwType.replace("open9x","opentx");
|
||||
fwType.replace("x9da","taranis");
|
||||
profile[0].fwType( fwType );
|
||||
|
||||
// Move the Companion9x profile settings to profile0, the new default profile
|
||||
profile[0].name( settings.value( "Name", "" ).toString());
|
||||
profile[0].sdPath( settings.value( "sdPath", "" ).toString());
|
||||
profile[0].splashFile( settings.value( "SplashFileName", "" ).toString());
|
||||
profile[0].burnFirmware( settings.value( "burnFirmware", false ).toBool());
|
||||
profile[0].renameFwFiles( settings.value( "rename_firmware_files", false ).toBool());
|
||||
profile[0].channelOrder( settings.value( "default_channel_order", "0" ).toInt());
|
||||
profile[0].defaultMode( settings.value( "default_mode", "1" ).toInt());
|
||||
|
||||
// Ensure that the default profile has a name
|
||||
if ( profile[0].name().isEmpty() )
|
||||
profile[0].name("My Radio");
|
||||
|
||||
// Delete obsolete settings fields from companion9x
|
||||
settings.remove("ActiveProfile");
|
||||
settings.remove("burnFirmware");
|
||||
settings.remove("custom_id");
|
||||
settings.remove("default_channel_order");
|
||||
settings.remove("default_mode");
|
||||
settings.remove("firmware");
|
||||
settings.remove("lastFw");
|
||||
settings.remove("modelEditTab");
|
||||
settings.remove("Name");
|
||||
settings.remove("patchImage");
|
||||
settings.remove("rename_firmware_files");
|
||||
settings.remove("sdPath");
|
||||
settings.remove("SplashFileName");
|
||||
settings.remove("startup_check_companion9x");
|
||||
settings.remove("wizardEnable");
|
||||
|
||||
// Delete settings that we do not want to carry over from 1.52
|
||||
settings.remove("dfu_location");
|
||||
|
||||
// Select the new default profile as current profile
|
||||
id( 0 );
|
||||
}
|
||||
|
||||
// Remove settings that have been made obsolete during companion2.0 development
|
||||
settings.remove("compilation-server");
|
||||
|
||||
// Load and store all variables. Use default values if setting values are missing
|
||||
QString _tempString; // Do not touch. Do not change the settings version before a new verson update!
|
||||
getset( _tempString, "settings_version" ,"210" ); // This is a version marker. Will be used to upgrade the settings later on.
|
||||
|
||||
getset( _recentFiles, "recentFileList" ,"" );
|
||||
getset( _mainWinGeo, "mainWindowGeometry" ,"" );
|
||||
getset( _mainWinState, "mainWindowState" ,"" );
|
||||
getset( _modelEditGeo, "modelEditGeometry" ,"" );
|
||||
|
||||
getset( _armMcu, "arm_mcu" ,"at91sam3s4-9x" );
|
||||
getset( _avrArguments, "avr_arguments" ,"" );
|
||||
getset( _avrPort, "avr_port" ,"" );
|
||||
getset( _avrdudeLocation, "avrdudeLocation" ,"" );
|
||||
getset( _dfuArguments, "dfu_arguments" ,"-a 0" );
|
||||
getset( _dfuLocation, "dfu_location" ,"" );
|
||||
getset( _locale, "locale" ,"" );
|
||||
getset( _mcu, "mcu" ,"m64" );
|
||||
getset( _programmer, "programmer" ,"usbasp" );
|
||||
getset( _sambaLocation, "samba_location" ,"" );
|
||||
getset( _sambaPort, "samba_port" ,"\\USBserial\\COM23" );
|
||||
getset( _lastSimulator, "last_simulator" ,"" );
|
||||
|
||||
getset( _backupDir, "backupPath" ,"" );
|
||||
getset( _gePath, "gePath" ,"" );
|
||||
getset( _eepromDir, "lastDir" ,"" );
|
||||
getset( _flashDir, "lastFlashDir" ,"" );
|
||||
getset( _imagesDir, "lastImagesDir" ,"" );
|
||||
getset( _logDir, "lastLogDir" ,"" );
|
||||
getset( _libDir, "libraryPath" ,"" );
|
||||
getset( _snapshotDir, "snapshotpath" ,"" );
|
||||
getset( _updatesDir, "lastUpdatesDir" ,"" );
|
||||
|
||||
getset( _outputDisplayDetails, "outputDisplayDetails" ,false );
|
||||
getset( _enableBackup, "enableBackup" ,false );
|
||||
getset( _backupOnFlash, "backupOnFlash" ,true );
|
||||
getset( _checkHardwareCompatibility, "checkHardwareCompatibility" ,true );
|
||||
|
||||
getset( _useCompanionNightlyBuilds, "useCompanionNightlyBuilds" ,false );
|
||||
getset( _useFirmwareNightlyBuilds, "useFirmwareNightlyBuilds" ,false );
|
||||
|
||||
getset( _jsSupport, "js_support" ,false );
|
||||
getset( _maximized, "maximized" ,false );
|
||||
getset( _showSplash, "show_splash" ,true );
|
||||
getset( _snapToClpbrd, "snapshot_to_clipboard" ,false );
|
||||
getset( _autoCheckApp, "startup_check_companion" ,true );
|
||||
getset( _autoCheckFw, "startup_check_fw" ,true );
|
||||
getset( _simuSW, "simuSW" ,false );
|
||||
getset( _useWizard, "useWizard" ,true );
|
||||
|
||||
getset( _backLight, "backLight" ,0 );
|
||||
getset( _embedSplashes, "embedded_splashes" ,0 );
|
||||
getset( _fwServerFails, "fwserver" ,0 );
|
||||
getset( _generalEditTab, "generalEditTab" ,0 );
|
||||
getset( _iconSize, "icon_size" ,2 );
|
||||
getset( _jsCtrl, "js_ctrl" ,0 );
|
||||
getset( _historySize, "history_size" ,10 );
|
||||
getset( _id, "profileId" ,0 );
|
||||
getset( _theme, "theme" ,1 );
|
||||
getset( _warningId, "warningId" ,0 );
|
||||
}
|
||||
@@ -1,385 +0,0 @@
|
||||
/*
|
||||
* Author - Kjell Kernen
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
// All temporary and permanent global variables are defined here to make
|
||||
// initialization and storage safe and visible.
|
||||
// Do not access variables in QSettings directly, it is not type safe!
|
||||
|
||||
|
||||
#ifndef COMPANION_APPDATA_H
|
||||
#define COMPANION_APPDATA_H
|
||||
#include <QByteArray>
|
||||
#include <QStringList>
|
||||
#include <QString>
|
||||
#include <QSettings>
|
||||
|
||||
#define COMPANY "OpenTX"
|
||||
#define PRODUCT "Companion 2.2"
|
||||
|
||||
#define MAX_PROFILES 15
|
||||
#define MAX_JOYSTICKS 8
|
||||
|
||||
class CompStoreObj
|
||||
{
|
||||
public:
|
||||
void clear (const QString tag1="", const QString tag2="", const QString tag3="");
|
||||
void store(const QByteArray newArray, QByteArray &array, const QString tag, const QString group1="", const QString group2="" );
|
||||
void store(const QStringList newSList, QStringList &stringList, const QString tag, const QString group1="", const QString group2="" );
|
||||
void store(const QString newString, QString &string, const QString tag, const QString group1="", const QString group2="" );
|
||||
void store(const bool newTruth, bool &truth, const QString tag, const QString group1="", const QString group2="" );
|
||||
void store(const int newNumber, int &number, const QString tag, const QString group1="", const QString group2="" );
|
||||
|
||||
// Retrieval functions
|
||||
void retrieve( QByteArray &array, const QString tag, const QString def, const QString group1="", const QString group2="" );
|
||||
void retrieve( QStringList &stringList, const QString tag, const QString def, const QString group1="", const QString group2="" );
|
||||
void retrieve( QString &string, const QString tag, const QString def, const QString group1="", const QString group2="" );
|
||||
void retrieve( bool &truth, const QString tag, const bool def, const QString group1="", const QString group2="" );
|
||||
void retrieve( int &number, const QString tag, const int def, const QString group1="", const QString group2="" );
|
||||
|
||||
// Retrieve and Store functions
|
||||
void getset( QByteArray &array, const QString tag, const QString def, const QString group1="", const QString group2="" );
|
||||
void getset( QStringList &stringList, const QString tag, const QString def, const QString group1="", const QString group2="" );
|
||||
void getset( QString &string, const QString tag, const QString def, const QString group1="", const QString group2="" );
|
||||
void getset( bool &truth, const QString tag, const bool def, const QString group1="", const QString group2="" );
|
||||
void getset( int &number, const QString tag, const int def, const QString group1="", const QString group2="" );
|
||||
};
|
||||
|
||||
class FwRevision: protected CompStoreObj
|
||||
{
|
||||
public:
|
||||
int get( const QString);
|
||||
void set( const QString, const int );
|
||||
void remove( const QString );
|
||||
};
|
||||
|
||||
class JStickData: protected CompStoreObj
|
||||
{
|
||||
private:
|
||||
int index;
|
||||
|
||||
int _stickAxe;
|
||||
int _stickMin;
|
||||
int _stickMed;
|
||||
int _stickMax;
|
||||
int _stickInv;
|
||||
|
||||
public:
|
||||
// All the get definitions
|
||||
int stick_axe();
|
||||
int stick_min();
|
||||
int stick_med();
|
||||
int stick_max();
|
||||
int stick_inv();
|
||||
|
||||
// All the set definitions
|
||||
void stick_axe(const int);
|
||||
void stick_min(const int);
|
||||
void stick_med(const int);
|
||||
void stick_max(const int);
|
||||
void stick_inv(const int);
|
||||
|
||||
JStickData();
|
||||
void remove();
|
||||
bool existsOnDisk();
|
||||
void init(int index);
|
||||
void flush();
|
||||
};
|
||||
|
||||
class Profile: protected CompStoreObj
|
||||
{
|
||||
private:
|
||||
// Class Internal Variable
|
||||
int index;
|
||||
|
||||
// Application Variables
|
||||
QString _fwName;
|
||||
QString _fwType;
|
||||
QString _name;
|
||||
QString _sdPath;
|
||||
int _volumeGain;
|
||||
QString _pBackupDir;
|
||||
QString _splashFile;
|
||||
bool _burnFirmware;
|
||||
bool _penableBackup;
|
||||
bool _renameFwFiles;
|
||||
int _channelOrder;
|
||||
int _defaultMode;
|
||||
|
||||
// Firmware Variables
|
||||
QString _beeper;
|
||||
QString _countryCode;
|
||||
QString _display;
|
||||
QString _haptic;
|
||||
QString _speaker;
|
||||
QString _stickPotCalib;
|
||||
QString _timeStamp;
|
||||
QString _trainerCalib;
|
||||
int _txCurrentCalibration;
|
||||
int _gsStickMode;
|
||||
int _ppmMultiplier;
|
||||
int _txVoltageCalibration;
|
||||
int _vBatWarn;
|
||||
int _vBatMin;
|
||||
int _vBatMax;
|
||||
|
||||
public:
|
||||
// All the get definitions
|
||||
QString fwName() const;
|
||||
QString fwType() const;
|
||||
QString name() const;
|
||||
QString sdPath() const;
|
||||
int volumeGain() const;
|
||||
QString pBackupDir() const;
|
||||
QString splashFile() const;
|
||||
bool burnFirmware() const;
|
||||
bool renameFwFiles() const;
|
||||
bool penableBackup() const;
|
||||
int channelOrder() const;
|
||||
int defaultMode() const;
|
||||
|
||||
QString beeper() const;
|
||||
QString countryCode() const;
|
||||
QString display() const;
|
||||
QString haptic() const;
|
||||
QString speaker() const;
|
||||
QString stickPotCalib() const;
|
||||
QString timeStamp() const;
|
||||
QString trainerCalib() const;
|
||||
int txCurrentCalibration() const;
|
||||
int gsStickMode() const;
|
||||
int ppmMultiplier() const;
|
||||
int txVoltageCalibration() const;
|
||||
int vBatWarn() const;
|
||||
int vBatMin() const;
|
||||
int vBatMax() const;
|
||||
|
||||
// All the set definitions
|
||||
void name (const QString);
|
||||
void fwName (const QString);
|
||||
void fwType (const QString);
|
||||
void volumeGain (const int);
|
||||
void sdPath (const QString);
|
||||
void pBackupDir (const QString);
|
||||
void splashFile (const QString);
|
||||
void burnFirmware (const bool);
|
||||
void renameFwFiles (const bool);
|
||||
void penableBackup (const bool);
|
||||
void channelOrder (const int);
|
||||
void defaultMode (const int);
|
||||
|
||||
void beeper (const QString);
|
||||
void countryCode (const QString);
|
||||
void display (const QString);
|
||||
void haptic (const QString);
|
||||
void speaker (const QString);
|
||||
void stickPotCalib (const QString);
|
||||
void timeStamp (const QString);
|
||||
void trainerCalib (const QString);
|
||||
void txCurrentCalibration (const int);
|
||||
void gsStickMode (const int);
|
||||
void ppmMultiplier (const int);
|
||||
void txVoltageCalibration (const int);
|
||||
void vBatWarn (const int);
|
||||
void vBatMin (const int);
|
||||
void vBatMax (const int);
|
||||
|
||||
Profile();
|
||||
Profile& operator=(const Profile&);
|
||||
void remove();
|
||||
bool existsOnDisk();
|
||||
void init(int newIndex);
|
||||
void initFwVariables();
|
||||
void flush();
|
||||
};
|
||||
|
||||
#define BOOL_PROPERTY(name, dflt) \
|
||||
public: \
|
||||
inline bool name() { return _ ## name; } \
|
||||
void name(const bool val) { store(val, _ ## name, # name); } \
|
||||
private: \
|
||||
bool _ ## name;
|
||||
|
||||
class AppData: protected CompStoreObj
|
||||
{
|
||||
BOOL_PROPERTY(enableBackup, false)
|
||||
BOOL_PROPERTY(outputDisplayDetails, false)
|
||||
BOOL_PROPERTY(backupOnFlash, true)
|
||||
BOOL_PROPERTY(checkHardwareCompatibility, true)
|
||||
BOOL_PROPERTY(useCompanionNightlyBuilds, false)
|
||||
BOOL_PROPERTY(useFirmwareNightlyBuilds, false)
|
||||
|
||||
// All the global variables
|
||||
public:
|
||||
Profile profile[MAX_PROFILES];
|
||||
JStickData joystick[MAX_JOYSTICKS];
|
||||
FwRevision fwRev;
|
||||
|
||||
private:
|
||||
QStringList _recentFiles;
|
||||
QByteArray _mainWinGeo;
|
||||
QByteArray _mainWinState;
|
||||
QByteArray _modelEditGeo;
|
||||
|
||||
QString _armMcu;
|
||||
QString _avrArguments;
|
||||
QString _avrPort;
|
||||
QString _avrdudeLocation;
|
||||
QString _dfuArguments;
|
||||
QString _dfuLocation;
|
||||
QString _locale;
|
||||
QString _mcu;
|
||||
QString _programmer;
|
||||
QString _sambaLocation;
|
||||
QString _sambaPort;
|
||||
QString _lastSimulator;
|
||||
|
||||
QString _backupDir;
|
||||
QString _gePath;
|
||||
QString _eepromDir;
|
||||
QString _flashDir;
|
||||
QString _imagesDir;
|
||||
QString _logDir;
|
||||
QString _libDir;
|
||||
QString _snapshotDir;
|
||||
QString _updatesDir;
|
||||
|
||||
bool _maximized;
|
||||
bool _jsSupport;
|
||||
bool _showSplash;
|
||||
bool _snapToClpbrd;
|
||||
bool _autoCheckApp;
|
||||
bool _autoCheckFw;
|
||||
bool _simuSW;
|
||||
bool _useWizard;
|
||||
|
||||
int _backLight;
|
||||
int _embedSplashes;
|
||||
int _fwServerFails;
|
||||
int _generalEditTab;
|
||||
int _iconSize;
|
||||
int _jsCtrl;
|
||||
int _historySize;
|
||||
int _id;
|
||||
int _theme;
|
||||
int _warningId;
|
||||
|
||||
public:
|
||||
// All the get definitions
|
||||
QStringList recentFiles();
|
||||
QByteArray mainWinGeo();
|
||||
QByteArray mainWinState();
|
||||
QByteArray modelEditGeo();
|
||||
|
||||
QString armMcu();
|
||||
QString avrArguments();
|
||||
QString avrPort();
|
||||
QString avrdudeLocation();
|
||||
QString dfuArguments();
|
||||
QString dfuLocation();
|
||||
QString lastFw();
|
||||
QString locale();
|
||||
QString mcu();
|
||||
QString programmer();
|
||||
QString sambaLocation();
|
||||
QString sambaPort();
|
||||
QString lastSimulator();
|
||||
|
||||
QString backupDir();
|
||||
QString gePath();
|
||||
QString eepromDir();
|
||||
QString flashDir();
|
||||
QString imagesDir();
|
||||
QString logDir();
|
||||
QString libDir();
|
||||
QString snapshotDir();
|
||||
QString updatesDir();
|
||||
|
||||
bool jsSupport();
|
||||
bool maximized();
|
||||
bool showSplash();
|
||||
bool snapToClpbrd();
|
||||
bool autoCheckApp();
|
||||
bool autoCheckFw();
|
||||
bool simuSW();
|
||||
bool useWizard();
|
||||
|
||||
int backLight();
|
||||
int embedSplashes();
|
||||
int fwServerFails();
|
||||
int generalEditTab();
|
||||
int iconSize();
|
||||
int historySize();
|
||||
int jsCtrl();
|
||||
int id();
|
||||
int theme();
|
||||
int warningId();
|
||||
|
||||
// All the set definitions
|
||||
void recentFiles (const QStringList x);
|
||||
void mainWinGeo (const QByteArray);
|
||||
void mainWinState (const QByteArray);
|
||||
void modelEditGeo (const QByteArray);
|
||||
|
||||
void armMcu (const QString);
|
||||
void avrArguments (const QString);
|
||||
void avrPort (const QString);
|
||||
void avrdudeLocation (const QString);
|
||||
void dfuArguments (const QString);
|
||||
void dfuLocation (const QString);
|
||||
void lastFw (const QString);
|
||||
void locale (const QString);
|
||||
void mcu (const QString);
|
||||
void programmer (const QString);
|
||||
void sambaLocation (const QString);
|
||||
void sambaPort (const QString);
|
||||
void lastSimulator (const QString);
|
||||
|
||||
void backupDir (const QString);
|
||||
void gePath (const QString);
|
||||
void eepromDir (const QString);
|
||||
void flashDir (const QString);
|
||||
void imagesDir (const QString);
|
||||
void logDir (const QString);
|
||||
void libDir (const QString);
|
||||
void snapshotDir (const QString);
|
||||
void updatesDir (const QString);
|
||||
|
||||
void maximized (const bool);
|
||||
void jsSupport (const bool);
|
||||
void showSplash (const bool);
|
||||
void snapToClpbrd (const bool);
|
||||
void autoCheckApp (const bool);
|
||||
void autoCheckFw (const bool);
|
||||
void simuSW (const bool);
|
||||
void useWizard (const bool);
|
||||
|
||||
void backLight (const int);
|
||||
void embedSplashes (const int);
|
||||
void fwServerFails (const int);
|
||||
void generalEditTab (const int);
|
||||
void iconSize (const int);
|
||||
void historySize (const int);
|
||||
void jsCtrl (const int);
|
||||
void modelEditTab (const int);
|
||||
void id (const int);
|
||||
void theme (const int);
|
||||
void warningId (const int);
|
||||
|
||||
// Constructor
|
||||
AppData();
|
||||
};
|
||||
|
||||
extern AppData g;
|
||||
|
||||
#endif // COMPANION_APPDATA_H
|
||||
@@ -1,522 +0,0 @@
|
||||
#include "apppreferencesdialog.h"
|
||||
#include "ui_apppreferencesdialog.h"
|
||||
#include "mainwindow.h"
|
||||
#include "appdata.h"
|
||||
#include "helpers.h"
|
||||
#include "firmwareinterface.h"
|
||||
#ifdef JOYSTICKS
|
||||
#include "joystick.h"
|
||||
#include "joystickdialog.h"
|
||||
#endif
|
||||
#include <QDesktopServices>
|
||||
#include <QtGui>
|
||||
|
||||
AppPreferencesDialog::AppPreferencesDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::AppPreferencesDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
updateLock=false;
|
||||
setWindowIcon(CompanionIcon("apppreferences.png"));
|
||||
|
||||
initSettings();
|
||||
connect(ui->downloadVerCB, SIGNAL(currentIndexChanged(int)), this, SLOT(baseFirmwareChanged()));
|
||||
connect(this, SIGNAL(accepted()), this, SLOT(writeValues()));
|
||||
|
||||
#ifndef JOYSTICKS
|
||||
ui->joystickCB->hide();
|
||||
ui->joystickCB->setDisabled(true);
|
||||
ui->joystickcalButton->hide();
|
||||
ui->joystickChkB->hide();
|
||||
ui->label_11->hide();
|
||||
#endif
|
||||
|
||||
shrink();
|
||||
}
|
||||
|
||||
AppPreferencesDialog::~AppPreferencesDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void AppPreferencesDialog::writeValues()
|
||||
{
|
||||
g.useCompanionNightlyBuilds(ui->useCompanionNightlyBuilds->isChecked());
|
||||
g.autoCheckApp(ui->autoCheckCompanion->isChecked());
|
||||
g.useFirmwareNightlyBuilds(ui->useFirmwareNightlyBuilds->isChecked());
|
||||
g.autoCheckFw(ui->autoCheckFirmware->isChecked());
|
||||
g.showSplash(ui->showSplash->isChecked());
|
||||
g.simuSW(ui->simuSW->isChecked());
|
||||
g.useWizard(ui->modelWizard_CB->isChecked());
|
||||
g.historySize(ui->historySize->value());
|
||||
g.backLight(ui->backLightColor->currentIndex());
|
||||
g.profile[g.id()].volumeGain(round(ui->volumeGain->value() * 10.0));
|
||||
g.libDir(ui->libraryPath->text());
|
||||
g.gePath(ui->ge_lineedit->text());
|
||||
g.embedSplashes(ui->splashincludeCB->currentIndex());
|
||||
g.enableBackup(ui->backupEnable->isChecked());
|
||||
|
||||
if (ui->joystickChkB ->isChecked() && ui->joystickCB->isEnabled()) {
|
||||
g.jsSupport(ui->joystickChkB ->isChecked());
|
||||
g.jsCtrl(ui->joystickCB ->currentIndex());
|
||||
}
|
||||
else {
|
||||
g.jsSupport(false);
|
||||
g.jsCtrl(0);
|
||||
}
|
||||
g.profile[g.id()].channelOrder(ui->channelorderCB->currentIndex());
|
||||
g.profile[g.id()].defaultMode(ui->stickmodeCB->currentIndex());
|
||||
g.profile[g.id()].renameFwFiles(ui->renameFirmware->isChecked());
|
||||
g.profile[g.id()].burnFirmware(ui->burnFirmware->isChecked());
|
||||
g.profile[g.id()].sdPath(ui->sdPath->text());
|
||||
g.profile[g.id()].pBackupDir(ui->profilebackupPath->text());
|
||||
g.profile[g.id()].penableBackup(ui->pbackupEnable->isChecked());
|
||||
g.profile[g.id()].splashFile(ui->SplashFileName->text());
|
||||
|
||||
// The profile name may NEVER be empty
|
||||
if (ui->profileNameLE->text().isEmpty())
|
||||
g.profile[g.id()].name(tr("My Radio"));
|
||||
else
|
||||
g.profile[g.id()].name(ui->profileNameLE->text());
|
||||
|
||||
// If a new fw type has been choosen, several things need to reset
|
||||
current_firmware_variant = getFirmwareVariant();
|
||||
QString id = current_firmware_variant->getId();
|
||||
if (g.profile[g.id()].fwType() != id) {
|
||||
g.profile[g.id()].fwName("");
|
||||
g.profile[g.id()].initFwVariables();
|
||||
g.profile[g.id()].fwType(id);
|
||||
}
|
||||
}
|
||||
|
||||
void AppPreferencesDialog::on_snapshotPathButton_clicked()
|
||||
{
|
||||
QString fileName = QFileDialog::getExistingDirectory(this,tr("Select your snapshot folder"), g.snapshotDir());
|
||||
if (!fileName.isEmpty()) {
|
||||
g.snapshotDir(fileName);
|
||||
g.snapToClpbrd(false);
|
||||
ui->snapshotPath->setText(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
void AppPreferencesDialog::initSettings()
|
||||
{
|
||||
ui->snapshotClipboardCKB->setChecked(g.snapToClpbrd());
|
||||
ui->burnFirmware->setChecked(g.profile[g.id()].burnFirmware());
|
||||
ui->snapshotPath->setText(g.snapshotDir());
|
||||
ui->snapshotPath->setReadOnly(true);
|
||||
if (ui->snapshotClipboardCKB->isChecked()) {
|
||||
ui->snapshotPath->setDisabled(true);
|
||||
ui->snapshotPathButton->setDisabled(true);
|
||||
}
|
||||
#if defined(ALLOW_NIGHTLY_BUILDS)
|
||||
ui->useCompanionNightlyBuilds->setChecked(g.useCompanionNightlyBuilds());
|
||||
ui->useFirmwareNightlyBuilds->setChecked(g.useFirmwareNightlyBuilds());
|
||||
#else
|
||||
ui->useCompanionNightlyBuilds->hide();
|
||||
ui->useFirmwareNightlyBuilds->hide();
|
||||
#endif
|
||||
ui->autoCheckCompanion->setChecked(g.autoCheckApp());
|
||||
ui->autoCheckFirmware->setChecked(g.autoCheckFw());
|
||||
ui->showSplash->setChecked(g.showSplash());
|
||||
ui->historySize->setValue(g.historySize());
|
||||
ui->backLightColor->setCurrentIndex(g.backLight());
|
||||
ui->volumeGain->setValue(g.profile[g.id()].volumeGain() / 10.0);
|
||||
|
||||
if (IS_TARANIS(GetCurrentFirmware()->getBoard())) {
|
||||
ui->backLightColor->setEnabled(false);
|
||||
}
|
||||
|
||||
ui->simuSW->setChecked(g.simuSW());
|
||||
ui->modelWizard_CB->setChecked(g.useWizard());
|
||||
ui->libraryPath->setText(g.libDir());
|
||||
ui->ge_lineedit->setText(g.gePath());
|
||||
|
||||
if (!g.backupDir().isEmpty()) {
|
||||
if (QDir(g.backupDir()).exists()) {
|
||||
ui->backupPath->setText(g.backupDir());
|
||||
ui->backupEnable->setEnabled(true);
|
||||
ui->backupEnable->setChecked(g.enableBackup());
|
||||
} else {
|
||||
ui->backupEnable->setDisabled(true);
|
||||
}
|
||||
} else {
|
||||
ui->backupEnable->setDisabled(true);
|
||||
}
|
||||
ui->splashincludeCB->setCurrentIndex(g.embedSplashes());
|
||||
|
||||
#ifdef JOYSTICKS
|
||||
ui->joystickChkB->setChecked(g.jsSupport());
|
||||
if (ui->joystickChkB->isChecked()) {
|
||||
QStringList joystickNames;
|
||||
joystickNames << tr("No joysticks found");
|
||||
joystick = new Joystick(0,false,0,0);
|
||||
ui->joystickcalButton->setDisabled(true);
|
||||
ui->joystickCB->setDisabled(true);
|
||||
|
||||
if ( joystick ) {
|
||||
if ( joystick->joystickNames.count() > 0 ) {
|
||||
joystickNames = joystick->joystickNames;
|
||||
ui->joystickCB->setEnabled(true);
|
||||
ui->joystickcalButton->setEnabled(true);
|
||||
}
|
||||
joystick->close();
|
||||
}
|
||||
ui->joystickCB->clear();
|
||||
ui->joystickCB->insertItems(0, joystickNames);
|
||||
ui->joystickCB->setCurrentIndex(g.jsCtrl());
|
||||
}
|
||||
else {
|
||||
ui->joystickCB->clear();
|
||||
ui->joystickCB->setDisabled(true);
|
||||
ui->joystickcalButton->setDisabled(true);
|
||||
}
|
||||
#endif
|
||||
// Profile Tab Inits
|
||||
ui->channelorderCB->setCurrentIndex(g.profile[g.id()].channelOrder());
|
||||
ui->stickmodeCB->setCurrentIndex(g.profile[g.id()].defaultMode());
|
||||
ui->renameFirmware->setChecked(g.profile[g.id()].renameFwFiles());
|
||||
ui->sdPath->setText(g.profile[g.id()].sdPath());
|
||||
if (!g.profile[g.id()].pBackupDir().isEmpty()) {
|
||||
if (QDir(g.profile[g.id()].pBackupDir()).exists()) {
|
||||
ui->profilebackupPath->setText(g.profile[g.id()].pBackupDir());
|
||||
ui->pbackupEnable->setEnabled(true);
|
||||
ui->pbackupEnable->setChecked(g.profile[g.id()].penableBackup());
|
||||
} else {
|
||||
ui->pbackupEnable->setDisabled(true);
|
||||
}
|
||||
} else {
|
||||
ui->pbackupEnable->setDisabled(true);
|
||||
}
|
||||
|
||||
ui->profileNameLE->setText(g.profile[g.id()].name());
|
||||
ui->SplashFileName->setText(g.profile[g.id()].splashFile());
|
||||
|
||||
displayImage( g.profile[g.id()].splashFile() );
|
||||
|
||||
QString hwSettings;
|
||||
if (g.profile[g.id()].stickPotCalib() == "" ) {
|
||||
hwSettings = tr("EMPTY: No radio settings stored in profile");
|
||||
}
|
||||
else {
|
||||
QString str = g.profile[g.id()].timeStamp();
|
||||
if (str.isEmpty())
|
||||
hwSettings = tr("AVAILABLE: Radio settings of unknown age");
|
||||
else
|
||||
hwSettings = tr("AVAILABLE: Radio settings stored %1").arg(str);
|
||||
}
|
||||
ui->lblGeneralSettings->setText(hwSettings);
|
||||
|
||||
Firmware * current_firmware = GetCurrentFirmware();
|
||||
|
||||
foreach(Firmware * firmware, firmwares) {
|
||||
ui->downloadVerCB->addItem(firmware->getName(), firmware->getId());
|
||||
if (current_firmware->getFirmwareBase() == firmware) {
|
||||
ui->downloadVerCB->setCurrentIndex(ui->downloadVerCB->count() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
baseFirmwareChanged();
|
||||
}
|
||||
|
||||
void AppPreferencesDialog::on_libraryPathButton_clicked()
|
||||
{
|
||||
QString fileName = QFileDialog::getExistingDirectory(this,tr("Select your library folder"), g.libDir());
|
||||
if (!fileName.isEmpty()) {
|
||||
g.libDir(fileName);
|
||||
ui->libraryPath->setText(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
void AppPreferencesDialog::on_snapshotClipboardCKB_clicked()
|
||||
{
|
||||
if (ui->snapshotClipboardCKB->isChecked()) {
|
||||
ui->snapshotPath->setDisabled(true);
|
||||
ui->snapshotPathButton->setDisabled(true);
|
||||
g.snapToClpbrd(true);
|
||||
}
|
||||
else {
|
||||
ui->snapshotPath->setEnabled(true);
|
||||
ui->snapshotPath->setReadOnly(true);
|
||||
ui->snapshotPathButton->setEnabled(true);
|
||||
g.snapToClpbrd(false);
|
||||
}
|
||||
}
|
||||
|
||||
void AppPreferencesDialog::on_backupPathButton_clicked()
|
||||
{
|
||||
QString fileName = QFileDialog::getExistingDirectory(this,tr("Select your Models and Settings backup folder"), g.backupDir());
|
||||
if (!fileName.isEmpty()) {
|
||||
g.backupDir(fileName);
|
||||
ui->backupPath->setText(fileName);
|
||||
ui->backupEnable->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void AppPreferencesDialog::on_ProfilebackupPathButton_clicked()
|
||||
{
|
||||
QString fileName = QFileDialog::getExistingDirectory(this,tr("Select your Models and Settings backup folder"), g.backupDir());
|
||||
if (!fileName.isEmpty()) {
|
||||
ui->profilebackupPath->setText(fileName);
|
||||
ui->pbackupEnable->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void AppPreferencesDialog::on_ge_pathButton_clicked()
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Select Google Earth executable"),ui->ge_lineedit->text());
|
||||
if (!fileName.isEmpty()) {
|
||||
ui->ge_lineedit->setText(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef JOYSTICKS
|
||||
void AppPreferencesDialog::on_joystickChkB_clicked() {
|
||||
if (ui->joystickChkB->isChecked()) {
|
||||
QStringList joystickNames;
|
||||
joystickNames << tr("No joysticks found");
|
||||
joystick = new Joystick(0,false,0,0);
|
||||
ui->joystickcalButton->setDisabled(true);
|
||||
ui->joystickCB->setDisabled(true);
|
||||
|
||||
if ( joystick ) {
|
||||
if ( joystick->joystickNames.count() > 0 ) {
|
||||
joystickNames = joystick->joystickNames;
|
||||
ui->joystickCB->setEnabled(true);
|
||||
ui->joystickcalButton->setEnabled(true);
|
||||
}
|
||||
joystick->close();
|
||||
}
|
||||
ui->joystickCB->clear();
|
||||
ui->joystickCB->insertItems(0, joystickNames);
|
||||
}
|
||||
else {
|
||||
ui->joystickCB->clear();
|
||||
ui->joystickCB->setDisabled(true);
|
||||
ui->joystickcalButton->setDisabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void AppPreferencesDialog::on_joystickcalButton_clicked() {
|
||||
joystickDialog * jd=new joystickDialog(this, ui->joystickCB->currentIndex());
|
||||
jd->exec();
|
||||
}
|
||||
#endif
|
||||
|
||||
// ******** Profile tab functions
|
||||
|
||||
void AppPreferencesDialog::on_sdPathButton_clicked()
|
||||
{
|
||||
QString fileName = QFileDialog::getExistingDirectory(this,tr("Select the folder replicating your SD structure"), g.profile[g.id()].sdPath());
|
||||
if (!fileName.isEmpty()) {
|
||||
ui->sdPath->setText(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
void AppPreferencesDialog::on_removeProfileButton_clicked()
|
||||
{
|
||||
if ( g.id() == 0 ) {
|
||||
QMessageBox::information(this, tr("Not possible to remove profile"), tr("The default profile can not be removed."));
|
||||
}
|
||||
else {
|
||||
g.profile[g.id()].remove();
|
||||
g.id( 0 );
|
||||
initSettings();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool AppPreferencesDialog::displayImage( QString fileName )
|
||||
{
|
||||
// Start by clearing the pixmap
|
||||
ui->imageLabel->setPixmap(QPixmap());
|
||||
|
||||
QImage image(fileName);
|
||||
if (image.isNull())
|
||||
return false;
|
||||
|
||||
// Use the firmware name to determine splash width
|
||||
int width = SPLASH_WIDTH;
|
||||
if (g.profile[g.id()].fwType().contains("taranis"))
|
||||
width = SPLASHX9D_WIDTH;
|
||||
|
||||
ui->imageLabel->setPixmap( makePixMap( image, g.profile[g.id()].fwType()));
|
||||
ui->imageLabel->setFixedSize(width, SPLASH_HEIGHT);
|
||||
return true;
|
||||
}
|
||||
|
||||
void AppPreferencesDialog::on_SplashSelect_clicked()
|
||||
{
|
||||
QString supportedImageFormats;
|
||||
for (int formatIndex = 0; formatIndex < QImageReader::supportedImageFormats().count(); formatIndex++) {
|
||||
supportedImageFormats += QLatin1String(" *.") + QImageReader::supportedImageFormats()[formatIndex];
|
||||
}
|
||||
|
||||
QString fileName = QFileDialog::getOpenFileName(this,
|
||||
tr("Open Image to load"), g.imagesDir(), tr("Images (%1)").arg(supportedImageFormats));
|
||||
|
||||
if (!fileName.isEmpty()){
|
||||
g.imagesDir(QFileInfo(fileName).dir().absolutePath());
|
||||
|
||||
displayImage(fileName);
|
||||
ui->SplashFileName->setText(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
void AppPreferencesDialog::on_clearImageButton_clicked()
|
||||
{
|
||||
ui->imageLabel->clear();
|
||||
ui->SplashFileName->clear();
|
||||
}
|
||||
|
||||
|
||||
void AppPreferencesDialog::showVoice(bool show)
|
||||
{
|
||||
ui->voiceLabel->setVisible(show);
|
||||
ui->voiceCombo->setVisible(show);
|
||||
QTimer::singleShot(0, this, SLOT(shrink()));
|
||||
}
|
||||
|
||||
void AppPreferencesDialog::baseFirmwareChanged()
|
||||
{
|
||||
QVariant selected_firmware = ui->downloadVerCB->itemData(ui->downloadVerCB->currentIndex());
|
||||
|
||||
foreach(Firmware * firmware, firmwares) {
|
||||
if (firmware->getId() == selected_firmware) {
|
||||
populateFirmwareOptions(firmware);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Firmware * AppPreferencesDialog::getFirmwareVariant()
|
||||
{
|
||||
QVariant selected_firmware = ui->downloadVerCB->itemData(ui->downloadVerCB->currentIndex());
|
||||
|
||||
foreach(Firmware * firmware, firmwares) {
|
||||
QString id = firmware->getId();
|
||||
if (id == selected_firmware) {
|
||||
foreach(QCheckBox *cb, optionsCheckBoxes) {
|
||||
if (cb->isChecked()) {
|
||||
id += QString("-") + cb->text();
|
||||
}
|
||||
}
|
||||
|
||||
if (voice && voice->isChecked()) {
|
||||
id += QString("-tts") + ui->voiceCombo->currentText();
|
||||
}
|
||||
|
||||
if (ui->langCombo->count()) {
|
||||
id += QString("-") + ui->langCombo->currentText();
|
||||
}
|
||||
|
||||
return GetFirmware(id);
|
||||
}
|
||||
}
|
||||
|
||||
// Should never occur...
|
||||
return default_firmware_variant;
|
||||
}
|
||||
|
||||
void AppPreferencesDialog::firmwareOptionChanged(bool state)
|
||||
{
|
||||
QCheckBox *cb = qobject_cast<QCheckBox*>(sender());
|
||||
if (cb == voice) {
|
||||
showVoice(voice->isChecked());
|
||||
}
|
||||
Firmware * firmware=NULL;
|
||||
if (cb && state) {
|
||||
QVariant selected_firmware = ui->downloadVerCB->itemData(ui->downloadVerCB->currentIndex());
|
||||
foreach(firmware, firmwares) {
|
||||
if (firmware->getId() == selected_firmware) {
|
||||
foreach(QList<Option> opts, firmware->opts) {
|
||||
foreach(Option opt, opts) {
|
||||
if (cb->text() == opt.name) {
|
||||
foreach(Option other, opts) {
|
||||
if (other.name != opt.name) {
|
||||
foreach(QCheckBox *ocb, optionsCheckBoxes) {
|
||||
if (ocb->text() == other.name) {
|
||||
ocb->setChecked(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AppPreferencesDialog::populateFirmwareOptions(const Firmware * firmware)
|
||||
{
|
||||
const Firmware * parent = firmware->getFirmwareBase();
|
||||
|
||||
updateLock = true;
|
||||
|
||||
QString id = current_firmware_variant->getId();
|
||||
ui->langCombo->clear();
|
||||
foreach(const char *lang, parent->languages) {
|
||||
ui->langCombo->addItem(lang);
|
||||
if (id.endsWith(lang)) {
|
||||
ui->langCombo->setCurrentIndex(ui->langCombo->count() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
voice = NULL; // we will search for a voice checkbox
|
||||
|
||||
int index = 0;
|
||||
QWidget * prevFocus = ui->voiceCombo;
|
||||
foreach(QList<Option> opts, parent->opts) {
|
||||
foreach(Option opt, opts) {
|
||||
if (index >= optionsCheckBoxes.size()) {
|
||||
QCheckBox * checkbox = new QCheckBox(ui->profileTab);
|
||||
ui->optionsLayout->addWidget(checkbox, optionsCheckBoxes.count()/5, optionsCheckBoxes.count()%5, 1, 1);
|
||||
optionsCheckBoxes.push_back(checkbox);
|
||||
connect(checkbox, SIGNAL(toggled(bool)), this, SLOT(firmwareOptionChanged(bool)));
|
||||
if (prevFocus) {
|
||||
QWidget::setTabOrder(prevFocus, checkbox);
|
||||
}
|
||||
}
|
||||
|
||||
QCheckBox *cb = optionsCheckBoxes.at(index++);
|
||||
if (cb) {
|
||||
cb->show();
|
||||
cb->setText(opt.name);
|
||||
cb->setToolTip(opt.tooltip);
|
||||
cb->setCheckState(id.contains(opt.name) ? Qt::Checked : Qt::Unchecked);
|
||||
if (opt.name == QString("voice")) {
|
||||
voice = cb;
|
||||
}
|
||||
prevFocus = cb;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (; index<optionsCheckBoxes.size(); index++) {
|
||||
QCheckBox *cb = optionsCheckBoxes.at(index);
|
||||
cb->hide();
|
||||
cb->setCheckState(Qt::Unchecked);
|
||||
}
|
||||
|
||||
ui->voiceCombo->clear();
|
||||
foreach(const char *lang, parent->ttslanguages) {
|
||||
ui->voiceCombo->addItem(lang);
|
||||
if (id.contains(QString("-tts%1").arg(lang))) {
|
||||
ui->voiceCombo->setCurrentIndex(ui->voiceCombo->count() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
showVoice(voice && voice->isChecked());
|
||||
|
||||
updateLock = false;
|
||||
QTimer::singleShot(0, this, SLOT(shrink()));
|
||||
}
|
||||
|
||||
void AppPreferencesDialog::shrink()
|
||||
{
|
||||
resize(0,0);
|
||||
}
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
#ifndef APPPREFERENCESDIALOG_H
|
||||
#define APPPREFERENCESDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QCheckBox>
|
||||
#include "eeprominterface.h"
|
||||
|
||||
namespace Ui {
|
||||
class AppPreferencesDialog;
|
||||
}
|
||||
|
||||
class Joystick;
|
||||
|
||||
class AppPreferencesDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AppPreferencesDialog(QWidget *parent = 0);
|
||||
~AppPreferencesDialog();
|
||||
Joystick *joystick;
|
||||
|
||||
private:
|
||||
QList<QCheckBox *> optionsCheckBoxes;
|
||||
bool updateLock;
|
||||
void showVoice(bool);
|
||||
void showVoice();
|
||||
void hideVoice();
|
||||
void populateLocale();
|
||||
void populateFirmwareOptions(const Firmware *);
|
||||
Firmware * getFirmwareVariant();
|
||||
QCheckBox * voice;
|
||||
|
||||
Ui::AppPreferencesDialog *ui;
|
||||
void initSettings();
|
||||
bool displayImage( QString fileName );
|
||||
void loadProfileString(QString profile, QString label);
|
||||
void loadFromProfile();
|
||||
|
||||
protected slots:
|
||||
void shrink();
|
||||
void baseFirmwareChanged();
|
||||
void firmwareOptionChanged(bool state);
|
||||
|
||||
void writeValues();
|
||||
void on_libraryPathButton_clicked();
|
||||
void on_snapshotPathButton_clicked();
|
||||
void on_snapshotClipboardCKB_clicked();
|
||||
void on_backupPathButton_clicked();
|
||||
void on_ProfilebackupPathButton_clicked();
|
||||
void on_ge_pathButton_clicked();
|
||||
|
||||
void on_sdPathButton_clicked();
|
||||
void on_removeProfileButton_clicked();
|
||||
void on_SplashSelect_clicked();
|
||||
void on_clearImageButton_clicked();
|
||||
|
||||
#ifdef JOYSTICKS
|
||||
void on_joystickChkB_clicked();
|
||||
void on_joystickcalButton_clicked();
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // APPPREFERENCESDIALOG_H
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,353 +0,0 @@
|
||||
#include "burnconfigdialog.h"
|
||||
#include "ui_burnconfigdialog.h"
|
||||
#include "eeprominterface.h"
|
||||
#include "helpers.h"
|
||||
#include "appdata.h"
|
||||
#include "progressdialog.h"
|
||||
#include "process_flash.h"
|
||||
|
||||
#if !defined WIN32 && defined __GNUC__
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
burnConfigDialog::burnConfigDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::burnConfigDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setWindowIcon(CompanionIcon("configure.png"));
|
||||
ui->avrdude_programmer->model()->sort(0);
|
||||
|
||||
getSettings();
|
||||
populateProgrammers();
|
||||
EEPROMInterface *eepromInterface = GetEepromInterface();
|
||||
if (IS_TARANIS(eepromInterface->getBoard())) {
|
||||
setWindowTitle(tr("DFU-UTIL Configuration"));
|
||||
ui->avrArgs->hide();
|
||||
ui->avrdude_location->hide();
|
||||
ui->avrdude_port->hide();
|
||||
ui->avrdude_programmer->hide();
|
||||
ui->label_av1->hide();
|
||||
ui->label_av2->hide();
|
||||
ui->label_av4->hide();
|
||||
ui->label_av5->hide();
|
||||
ui->pushButton->hide();
|
||||
ui->pushButton_3->hide();
|
||||
ui->pushButton_4->hide();
|
||||
ui->label_sb1->hide();
|
||||
ui->label_sb3->hide();
|
||||
ui->samba_location->hide();
|
||||
ui->samba_port->hide();
|
||||
ui->sb_browse->hide();
|
||||
}
|
||||
else if (IS_SKY9X(eepromInterface->getBoard())) {
|
||||
setWindowTitle(tr("SAM-BA Configuration"));
|
||||
ui->avrArgs->hide();
|
||||
ui->avrdude_location->hide();
|
||||
ui->avrdude_port->hide();
|
||||
ui->avrdude_programmer->hide();
|
||||
ui->label_av1->hide();
|
||||
ui->label_av2->hide();
|
||||
ui->label_av4->hide();
|
||||
ui->label_av5->hide();
|
||||
ui->pushButton->hide();
|
||||
ui->pushButton_3->hide();
|
||||
ui->pushButton_4->hide();
|
||||
ui->label_dfu1->hide();
|
||||
ui->dfu_location->hide();
|
||||
ui->dfu_browse->hide();
|
||||
}
|
||||
else {
|
||||
setWindowTitle(tr("AVRDUDE Configuration"));
|
||||
ui->label_sb1->hide();
|
||||
ui->label_sb3->hide();
|
||||
ui->samba_location->hide();
|
||||
ui->samba_port->hide();
|
||||
ui->sb_browse->hide();
|
||||
ui->label_dfu1->hide();
|
||||
ui->label_dfu2->hide();
|
||||
ui->dfu_location->hide();
|
||||
ui->dfu_browse->hide();
|
||||
}
|
||||
ui->label_av3->hide();
|
||||
ui->avrdude_mcu->hide();
|
||||
ui->label_sb2->hide();
|
||||
ui->arm_mcu->hide();
|
||||
ui->label_dfu2->hide();
|
||||
ui->dfuArgs->hide();
|
||||
|
||||
QTimer::singleShot(0, this, SLOT(shrink()));
|
||||
connect(this,SIGNAL(accepted()),this,SLOT(putSettings()));
|
||||
}
|
||||
|
||||
burnConfigDialog::~burnConfigDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void burnConfigDialog::getSettings()
|
||||
{
|
||||
avrLoc = g.avrdudeLocation();
|
||||
sambaLoc = g.sambaLocation();
|
||||
dfuLoc = g.dfuLocation();
|
||||
|
||||
#if defined WIN32 || !defined __GNUC__
|
||||
if ( avrLoc.isEmpty())
|
||||
avrLoc = QFileInfo("avrdude.exe").absoluteFilePath();
|
||||
if ( sambaLoc.isEmpty())
|
||||
sambaLoc = QFileInfo("sam-ba.exe").absoluteFilePath();
|
||||
if ( dfuLoc.isEmpty())
|
||||
dfuLoc = QFileInfo("dfu-util.exe").absoluteFilePath();
|
||||
#elif defined __APPLE__
|
||||
if ( avrLoc.isEmpty())
|
||||
avrLoc = "/usr/local/bin/avrdude";
|
||||
if ( sambaLoc.isEmpty())
|
||||
sambaLoc = "/usr/local/bin/sam-ba";
|
||||
if ( dfuLoc.isEmpty())
|
||||
dfuLoc = QFileInfo("/opt/local/bin/dfu-util").absoluteFilePath();
|
||||
#else
|
||||
if ( avrLoc.isEmpty())
|
||||
avrLoc = "/usr/bin/avrdude";
|
||||
if ( sambaLoc.isEmpty())
|
||||
sambaLoc = "/usr/bin/sam-ba";
|
||||
if ( dfuLoc.isEmpty())
|
||||
dfuLoc = QFileInfo("/usr/bin/dfu-util").absoluteFilePath();
|
||||
#endif
|
||||
|
||||
dfuArgs = g.dfuArguments().split(" ", QString::SkipEmptyParts);
|
||||
avrArgs = g.avrArguments().split(" ", QString::SkipEmptyParts);
|
||||
avrProgrammer = g.programmer();
|
||||
avrPort = g.avrPort();
|
||||
avrMCU = g.mcu();
|
||||
armMCU = g.armMcu();
|
||||
sambaPort = g.sambaPort();
|
||||
|
||||
ui->avrdude_location->setText(getAVRDUDE());
|
||||
ui->avrArgs->setText(avrArgs.join(" "));
|
||||
|
||||
ui->samba_location->setText(getSAMBA());
|
||||
ui->samba_port->setText(getSambaPort());
|
||||
|
||||
ui->dfu_location->setText(getDFU());
|
||||
ui->dfuArgs->setText(getDFUArgs().join(" "));
|
||||
|
||||
int idx1 = ui->avrdude_programmer->findText(getProgrammer());
|
||||
int idx2 = ui->avrdude_port->findText(getPort());
|
||||
int idx3 = ui->avrdude_mcu->findText(getMCU());
|
||||
int idx4 = ui->arm_mcu->findText(getArmMCU());
|
||||
if(idx1>=0) ui->avrdude_programmer->setCurrentIndex(idx1);
|
||||
if(idx2>=0) ui->avrdude_port->setCurrentIndex(idx2);
|
||||
if(idx3>=0) ui->avrdude_mcu->setCurrentIndex(idx3);
|
||||
if(idx4>=0) ui->arm_mcu->setCurrentIndex(idx4);
|
||||
QFile file;
|
||||
if (file.exists(avrLoc)) {
|
||||
ui->pushButton_3->setEnabled(true);
|
||||
} else {
|
||||
ui->pushButton_3->setDisabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void burnConfigDialog::putSettings()
|
||||
{
|
||||
g.avrdudeLocation( avrLoc );
|
||||
g.programmer( avrProgrammer);
|
||||
g.mcu( avrMCU );
|
||||
g.avrPort( avrPort );
|
||||
g.avrArguments( avrArgs.join(" ") );
|
||||
g.sambaLocation( sambaLoc );
|
||||
g.sambaPort( sambaPort );
|
||||
g.armMcu( armMCU );
|
||||
g.dfuLocation( dfuLoc );
|
||||
g.dfuArguments( dfuArgs.join(" ") );
|
||||
}
|
||||
|
||||
void burnConfigDialog::populateProgrammers()
|
||||
{
|
||||
QString fileName = QFileInfo(avrLoc).canonicalPath() + "/avrdude.conf"; //for windows
|
||||
if(!QFileInfo(fileName).exists()) fileName = "/etc/avrdude.conf"; //for linux
|
||||
if(!QFileInfo(fileName).exists()) fileName = "/etc/avrdude/avrdude.conf"; //for linux
|
||||
if(!QFileInfo(fileName).exists()) return; // not found avrdude.conf - returning
|
||||
|
||||
QFile file(fileName);
|
||||
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) return;
|
||||
|
||||
QStringList items;
|
||||
QString line = "";
|
||||
QString prevline = "";
|
||||
QTextStream in(&file);
|
||||
while (!in.atEnd())
|
||||
{
|
||||
prevline = line;
|
||||
line = in.readLine();
|
||||
|
||||
if(prevline.left(10).toLower()=="programmer")
|
||||
items << line.section('"',1,1);
|
||||
}
|
||||
file.close();
|
||||
|
||||
items.sort();
|
||||
|
||||
QString avrProgrammer_temp = avrProgrammer;
|
||||
ui->avrdude_programmer->clear();
|
||||
ui->avrdude_programmer->addItems(items);
|
||||
int idx1 = ui->avrdude_programmer->findText(avrProgrammer_temp);
|
||||
if(idx1>=0) ui->avrdude_programmer->setCurrentIndex(idx1);
|
||||
}
|
||||
|
||||
void burnConfigDialog::on_avrdude_programmer_currentIndexChanged(QString )
|
||||
{
|
||||
avrProgrammer = ui->avrdude_programmer->currentText();
|
||||
}
|
||||
|
||||
void burnConfigDialog::on_avrdude_mcu_currentIndexChanged(QString )
|
||||
{
|
||||
avrMCU = ui->avrdude_mcu->currentText();
|
||||
}
|
||||
|
||||
void burnConfigDialog::on_avrdude_location_editingFinished()
|
||||
{
|
||||
avrLoc = ui->avrdude_location->text();
|
||||
if (avrLoc.isEmpty()) {
|
||||
ui->pushButton_3->setDisabled(true);
|
||||
} else {
|
||||
QFile file;
|
||||
if (file.exists(avrLoc)) {
|
||||
ui->pushButton_3->setEnabled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void burnConfigDialog::on_avrArgs_editingFinished()
|
||||
{
|
||||
avrArgs = ui->avrArgs->text().split(" ", QString::SkipEmptyParts);
|
||||
}
|
||||
|
||||
void burnConfigDialog::on_avrdude_port_currentIndexChanged(QString )
|
||||
{
|
||||
avrPort = ui->avrdude_port->currentText();
|
||||
}
|
||||
|
||||
void burnConfigDialog::on_samba_location_editingFinished()
|
||||
{
|
||||
sambaLoc = ui->samba_location->text();
|
||||
}
|
||||
|
||||
void burnConfigDialog::on_samba_port_editingFinished()
|
||||
{
|
||||
sambaPort = ui->samba_port->text();
|
||||
}
|
||||
|
||||
void burnConfigDialog::on_arm_mcu_currentIndexChanged(QString )
|
||||
{
|
||||
armMCU = ui->arm_mcu->currentText();
|
||||
}
|
||||
|
||||
void burnConfigDialog::on_pushButton_clicked()
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Select Location"),ui->avrdude_location->text());
|
||||
|
||||
if(!fileName.isEmpty())
|
||||
{
|
||||
ui->avrdude_location->setText(fileName);
|
||||
avrLoc = fileName;
|
||||
}
|
||||
}
|
||||
|
||||
void burnConfigDialog::on_sb_browse_clicked()
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Select Location"),ui->samba_location->text());
|
||||
if(!fileName.isEmpty())
|
||||
{
|
||||
ui->samba_location->setText(fileName);
|
||||
sambaLoc = fileName;
|
||||
}
|
||||
}
|
||||
|
||||
void burnConfigDialog::on_dfu_browse_clicked()
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Select Location"),ui->dfu_location->text());
|
||||
|
||||
if(!fileName.isEmpty())
|
||||
{
|
||||
ui->dfu_location->setText(fileName);
|
||||
dfuLoc = fileName;
|
||||
}
|
||||
}
|
||||
|
||||
void burnConfigDialog::on_dfu_location_editingFinished()
|
||||
{
|
||||
dfuLoc = ui->dfu_location->text();
|
||||
}
|
||||
|
||||
void burnConfigDialog::on_dfuArgs_editingFinished()
|
||||
{
|
||||
dfuArgs = ui->dfuArgs->text().split(" ", QString::SkipEmptyParts);
|
||||
}
|
||||
|
||||
void burnConfigDialog::listAvrdudeProgrammers()
|
||||
{
|
||||
ProgressDialog progressDialog(this, tr("List available programmers"), CompanionIcon("list.png"), true);
|
||||
FlashProcess flashProcess(ui->avrdude_location->text(), QStringList() << "-c?", progressDialog.progress());
|
||||
flashProcess.run();
|
||||
}
|
||||
|
||||
// TODO choose better name when no merge in progress....
|
||||
void burnConfigDialog::on_pushButton_3_clicked()
|
||||
{
|
||||
listAvrdudeProgrammers();
|
||||
}
|
||||
|
||||
// TODO choose better name when no merge in progress....
|
||||
void burnConfigDialog::on_pushButton_4_clicked()
|
||||
{
|
||||
ProgressDialog progressDialog(this, tr("Avrdude help"), CompanionIcon("configure.png"), true);
|
||||
FlashProcess flashProcess(ui->avrdude_location->text(), QStringList() << "-?", progressDialog.progress());
|
||||
flashProcess.run();
|
||||
}
|
||||
|
||||
void burnConfigDialog::on_advCtrChkB_toggled(bool checked)
|
||||
{
|
||||
EEPROMInterface *eepromInterface = GetEepromInterface();
|
||||
if (checked) {
|
||||
if (IS_TARANIS(eepromInterface->getBoard())) {
|
||||
ui->label_dfu2->show();
|
||||
ui->dfuArgs->show();
|
||||
}
|
||||
else if (IS_SKY9X(eepromInterface->getBoard())) {
|
||||
ui->label_sb2->show();
|
||||
ui->arm_mcu->show();
|
||||
}
|
||||
else {
|
||||
ui->label_av3->show();
|
||||
ui->avrdude_mcu->show();
|
||||
QMessageBox::warning(this, tr("Companion"),
|
||||
tr("<b><u>WARNING!</u></b><br>Normally CPU type is automatically selected according to the chosen firmware.<br>If you change the CPU type the resulting eeprom could be inconsistent."),
|
||||
QMessageBox::Ok);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (IS_TARANIS(eepromInterface->getBoard())) {
|
||||
ui->label_dfu2->hide();
|
||||
ui->dfuArgs->hide();
|
||||
}
|
||||
else if (IS_SKY9X(eepromInterface->getBoard())) {
|
||||
ui->label_sb2->hide();
|
||||
ui->arm_mcu->hide();
|
||||
}
|
||||
else {
|
||||
ui->label_av3->hide();
|
||||
ui->avrdude_mcu->hide();
|
||||
}
|
||||
}
|
||||
QTimer::singleShot(0, this, SLOT(shrink()));
|
||||
}
|
||||
|
||||
|
||||
void burnConfigDialog::shrink()
|
||||
{
|
||||
resize(0,0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
#ifndef BURNCONFIGDIALOG_H_
|
||||
#define BURNCONFIGDIALOG_H_
|
||||
|
||||
#include <QDialog>
|
||||
#include <QtGui>
|
||||
|
||||
#define MEM_TYPE_EEPROM 1
|
||||
#define MEM_TYPE_FLASH 2
|
||||
|
||||
#define OPR_TYPE_READ 1
|
||||
#define OPR_TYPE_WRITE 2
|
||||
|
||||
namespace Ui {
|
||||
class burnConfigDialog;
|
||||
}
|
||||
|
||||
class burnConfigDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
burnConfigDialog(QWidget *parent = 0);
|
||||
~burnConfigDialog();
|
||||
|
||||
QString getAVRDUDE() {return avrLoc;}
|
||||
QString getSAMBA() {return sambaLoc;}
|
||||
QString getDFU() {return dfuLoc;}
|
||||
QStringList getAvrdudeArgs() { QStringList args = avrArgs; if (!avrPort.isEmpty()) args << "-P" << avrPort; return args; }
|
||||
QStringList getDFUArgs() {return dfuArgs;}
|
||||
QString getProgrammer() {return avrProgrammer;}
|
||||
QString getMCU() {return avrMCU;}
|
||||
QString getArmMCU() {return armMCU;}
|
||||
QString getPort() {return avrPort;}
|
||||
QString getSambaPort() {return sambaPort;}
|
||||
|
||||
void listAvrdudeProgrammers();
|
||||
|
||||
private:
|
||||
Ui::burnConfigDialog *ui;
|
||||
|
||||
void populateProgrammers();
|
||||
|
||||
QString avrLoc;
|
||||
QString sambaLoc;
|
||||
QString dfuLoc;
|
||||
QStringList avrArgs;
|
||||
QString avrProgrammer;
|
||||
QString avrMCU;
|
||||
QString armMCU;
|
||||
QString avrPort;
|
||||
QString sambaPort;
|
||||
QStringList dfuArgs;
|
||||
|
||||
private slots:
|
||||
void shrink();
|
||||
void on_avrArgs_editingFinished();
|
||||
void on_pushButton_4_clicked();
|
||||
void on_pushButton_3_clicked();
|
||||
void on_pushButton_clicked();
|
||||
void on_avrdude_location_editingFinished();
|
||||
void on_avrdude_programmer_currentIndexChanged(QString );
|
||||
void on_avrdude_mcu_currentIndexChanged(QString );
|
||||
void on_avrdude_port_currentIndexChanged(QString );
|
||||
void on_samba_location_editingFinished();
|
||||
void on_samba_port_editingFinished();
|
||||
void on_arm_mcu_currentIndexChanged(QString );
|
||||
void on_sb_browse_clicked();
|
||||
void on_dfu_browse_clicked();
|
||||
void on_dfu_location_editingFinished();
|
||||
void on_dfuArgs_editingFinished();
|
||||
void on_advCtrChkB_toggled(bool checked);
|
||||
void getSettings();
|
||||
void putSettings();
|
||||
};
|
||||
|
||||
#endif // BURNCONFIGDIALOG_H_
|
||||
@@ -1,867 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>burnConfigDialog</class>
|
||||
<widget class="QDialog" name="burnConfigDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>531</width>
|
||||
<height>422</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>531</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Programmer Configuration</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="companion.qrc">
|
||||
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="2" column="0">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
<property name="centerButtons">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="9" column="2">
|
||||
<widget class="QLineEdit" name="dfu_location">
|
||||
<property name="toolTip">
|
||||
<string>Location of sam-ba executable</string>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string>The location of the AVRDUDE executable.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">dfu-util</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="label_dfu1">
|
||||
<property name="text">
|
||||
<string>DFU-Util Location</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLineEdit" name="avrdude_location">
|
||||
<property name="toolTip">
|
||||
<string>Location of AVRDUDE executable</string>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string>The location of the AVRDUDE executable.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4" rowspan="2">
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="whatsThis">
|
||||
<string>Use this button to browse and look for the AVRDUDE executable file.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Browse...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_av2">
|
||||
<property name="text">
|
||||
<string>Programmer</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QComboBox" name="avrdude_programmer">
|
||||
<property name="whatsThis">
|
||||
<string>Programmer used for communicating with the controller.
|
||||
Please consult the programmer's documentation and the AVRDUDE documentation to select the appropriate programmer.</string>
|
||||
</property>
|
||||
<property name="insertPolicy">
|
||||
<enum>QComboBox::InsertAlphabetically</enum>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">c2n232i</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">dasa3</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">dasa</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">siprog</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">ponyser</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">89isp</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">frank-stk200</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">blaster</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">ere-isp-avr</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">atisp</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">dapa</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">xil</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">futurlec</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">abcmini</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">picoweb</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">sp12</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">alf</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">bascom</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">dt006</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">pony-stk200</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">stk200</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">bsd</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">pavr</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">dragon_pdi</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">dragon_dw</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">dragon_hvsp</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">dragon_pp</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">dragon_isp</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">dragon_jtag</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">jtag2pdi</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">jtag2avr32</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">jtagmkII_avr32</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">jtag2dw</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">jtag2isp</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">jtag2</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">jtag2fast</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">jtag2slow</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">jtagmkII</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">jtag1slow</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">jtag1</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">jtagmkI</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">avr911</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">avr109</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">butterfly</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">usbtiny</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">usbasp</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">avr910</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">stk600hvsp</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">stk600pp</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">stk600</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">stk500hvsp</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">stk500pp</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">stk500v2</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">mib510</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">stk500v1</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">stk500</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">buspirate</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">avrisp2</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">avrispmkII</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">avrispv2</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">avrisp</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">arduino</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="4">
|
||||
<widget class="QPushButton" name="pushButton_3">
|
||||
<property name="whatsThis">
|
||||
<string>List all available programmers.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>List Available</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QLineEdit" name="avrArgs">
|
||||
<property name="toolTip">
|
||||
<string>Extra arguments that will be passed to AVRDUDE on every call</string>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string>Extra arguments used in AVRDUDE.
|
||||
This can be used for providing extra information to AVRDUDE.
|
||||
|
||||
Please only use this if you know what you are doing. There are no error checks and you could cripple your controller.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_av5">
|
||||
<property name="text">
|
||||
<string>Extra Arguments</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="4">
|
||||
<widget class="QPushButton" name="pushButton_4">
|
||||
<property name="whatsThis">
|
||||
<string>Show AVRDUDE help</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Show Help</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QComboBox" name="avrdude_port">
|
||||
<property name="whatsThis">
|
||||
<string>Communication port to the programmer.
|
||||
</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">usb</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">com1</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">com2</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">com3</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">com4</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">com5</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">com6</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">com7</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">com8</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">com9</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">com10</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">com11</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">com12</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">com13</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">com14</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">com15</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">lpt1</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">lpt2</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">lpt3</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">lpt4</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">avrdoper</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">/dev/ttyUSB0</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">/dev/ttyUSB1</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_av4">
|
||||
<property name="text">
|
||||
<string>Port</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_av1">
|
||||
<property name="text">
|
||||
<string>AVRDUDE Location</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_av3">
|
||||
<property name="text">
|
||||
<string>MCU</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QComboBox" name="avrdude_mcu">
|
||||
<property name="toolTip">
|
||||
<string>CPU of your TX</string>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string>CPU present on your 9x radio
|
||||
Should be m64 for stock radios
|
||||
m2560 for v4.1 boards</string>
|
||||
</property>
|
||||
<property name="insertPolicy">
|
||||
<enum>QComboBox::InsertAlphabetically</enum>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">m64</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">m128</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">m2560</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="2">
|
||||
<widget class="QComboBox" name="arm_mcu">
|
||||
<property name="toolTip">
|
||||
<string>CPU of your TX</string>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string>CPU present on your 9x radio
|
||||
Should be m64 for stock radios
|
||||
m2560 for v4.1 boards</string>
|
||||
</property>
|
||||
<property name="insertPolicy">
|
||||
<enum>QComboBox::InsertAlphabetically</enum>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">at91sam3s4-9x</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>at91sam3s8-9xr</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_sb1">
|
||||
<property name="text">
|
||||
<string>SAM-BA Location</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="2">
|
||||
<widget class="QLineEdit" name="samba_location">
|
||||
<property name="toolTip">
|
||||
<string>Location of sam-ba executable</string>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string>The location of the AVRDUDE executable.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">sam-ba.exe</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_sb2">
|
||||
<property name="text">
|
||||
<string>ARM MCU</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_sb3">
|
||||
<property name="text">
|
||||
<string>Port</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="2">
|
||||
<widget class="QLineEdit" name="samba_port">
|
||||
<property name="toolTip">
|
||||
<string>sam-ba serial port</string>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string>The location of the AVRDUDE executable.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">\USBserial\COM23</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="label_dfu2">
|
||||
<property name="text">
|
||||
<string>Alternate device</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="2">
|
||||
<widget class="QLineEdit" name="dfuArgs">
|
||||
<property name="toolTip">
|
||||
<string>Extra arguments that will be passed to AVRDUDE on every call</string>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string>Extra arguments used in AVRDUDE.
|
||||
This can be used for providing extra information to AVRDUDE.
|
||||
|
||||
Please only use this if you know what you are doing. There are no error checks and you could cripple your controller.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="4">
|
||||
<widget class="QPushButton" name="sb_browse">
|
||||
<property name="whatsThis">
|
||||
<string>Use this button to browse and look for the AVRDUDE executable file.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Browse...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="4">
|
||||
<widget class="QPushButton" name="dfu_browse">
|
||||
<property name="whatsThis">
|
||||
<string>Use this button to browse and look for the AVRDUDE executable file.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Browse...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="2">
|
||||
<widget class="QCheckBox" name="advCtrChkB">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Use advanced controls</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>avrdude_location</tabstop>
|
||||
<tabstop>pushButton</tabstop>
|
||||
<tabstop>avrdude_programmer</tabstop>
|
||||
<tabstop>pushButton_3</tabstop>
|
||||
<tabstop>avrdude_mcu</tabstop>
|
||||
<tabstop>avrdude_port</tabstop>
|
||||
<tabstop>avrArgs</tabstop>
|
||||
<tabstop>pushButton_4</tabstop>
|
||||
<tabstop>samba_location</tabstop>
|
||||
<tabstop>sb_browse</tabstop>
|
||||
<tabstop>arm_mcu</tabstop>
|
||||
<tabstop>samba_port</tabstop>
|
||||
<tabstop>dfu_location</tabstop>
|
||||
<tabstop>dfu_browse</tabstop>
|
||||
<tabstop>dfuArgs</tabstop>
|
||||
<tabstop>advCtrChkB</tabstop>
|
||||
<tabstop>buttonBox</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="companion.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>burnConfigDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>burnConfigDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
@@ -1,168 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the examples of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <QApplication>
|
||||
#include <QTranslator>
|
||||
#include <QLocale>
|
||||
#include <QString>
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QSplashScreen>
|
||||
#include <QThread>
|
||||
#include <iostream>
|
||||
#if defined(JOYSTICKS) || defined(SIMU_AUDIO)
|
||||
#include <SDL.h>
|
||||
#undef main
|
||||
#endif
|
||||
#include "mainwindow.h"
|
||||
#include "version.h"
|
||||
#include "eeprominterface.h"
|
||||
#include "appdata.h"
|
||||
|
||||
#if defined WIN32 || !defined __GNUC__
|
||||
#include <windows.h>
|
||||
#define sleep(x) Sleep(x*1000)
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <QProxyStyle>
|
||||
|
||||
class MyProxyStyle : public QProxyStyle
|
||||
{
|
||||
public:
|
||||
void polish ( QWidget * w ) {
|
||||
QMenu* mn = dynamic_cast<QMenu*>(w);
|
||||
QPushButton* pb = dynamic_cast<QPushButton*>(w);
|
||||
if(!(mn || pb) && !w->testAttribute(Qt::WA_MacNormalSize))
|
||||
w->setAttribute(Qt::WA_MacSmallSize);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
Q_INIT_RESOURCE(companion);
|
||||
QApplication app(argc, argv);
|
||||
app.setApplicationName("OpenTX Companion");
|
||||
app.setOrganizationName("OpenTX");
|
||||
app.setOrganizationDomain("open-tx.org");
|
||||
app.setAttribute(Qt::AA_DontShowIconsInMenus, false);
|
||||
|
||||
QStringList strl = QApplication::arguments();
|
||||
if (strl.contains("--version")) {
|
||||
printf("%s\n", VERSION);
|
||||
fflush(stdout);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
app.setStyle(new MyProxyStyle);
|
||||
#endif
|
||||
|
||||
QTranslator companionTranslator;
|
||||
companionTranslator.load(":/companion_" + g.locale());
|
||||
QTranslator qtTranslator;
|
||||
qtTranslator.load((QString)"qt_" + g.locale().left(2), QLibraryInfo::location(QLibraryInfo::TranslationsPath));
|
||||
app.installTranslator(&companionTranslator);
|
||||
app.installTranslator(&qtTranslator);
|
||||
|
||||
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
|
||||
|
||||
#if defined(JOYSTICKS) || defined(SIMU_AUDIO)
|
||||
uint32_t sdlFlags = 0;
|
||||
#ifdef JOYSTICKS
|
||||
sdlFlags |= SDL_INIT_JOYSTICK;
|
||||
#endif
|
||||
#ifdef SIMU_AUDIO
|
||||
sdlFlags |= SDL_INIT_AUDIO;
|
||||
#endif
|
||||
if (SDL_Init(sdlFlags) < 0) {
|
||||
fprintf(stderr, "ERROR: couldn't initialize SDL: %s\n", SDL_GetError());
|
||||
}
|
||||
#endif
|
||||
|
||||
registerEEpromInterfaces();
|
||||
registerOpenTxFirmwares();
|
||||
registerSimulators();
|
||||
|
||||
if (g.profile[g.id()].fwType().isEmpty()){
|
||||
g.profile[g.id()].fwType(default_firmware_variant->getId());
|
||||
g.profile[g.id()].fwName("");
|
||||
}
|
||||
|
||||
QString splashScreen;
|
||||
if ( g.profile[g.id()].fwType().contains("taranis")) splashScreen = ":/images/splash-taranis.png";
|
||||
else if ( g.profile[g.id()].fwType().contains("9xrpro")) splashScreen = ":/images/splash-9xrpro.png";
|
||||
else if ( g.profile[g.id()].fwType().contains("9xr")) splashScreen = ":/images/splash-9xr.png";
|
||||
else splashScreen = ":/images/splash-9x.png";
|
||||
|
||||
QPixmap pixmap = QPixmap(splashScreen);
|
||||
QSplashScreen *splash = new QSplashScreen(pixmap);
|
||||
|
||||
current_firmware_variant = GetFirmware(g.profile[g.id()].fwType());
|
||||
|
||||
MainWindow *mainWin = new MainWindow();
|
||||
if (g.showSplash()) {
|
||||
splash->show();
|
||||
QTimer::singleShot(1000*SPLASH_TIME, splash, SLOT(close()));
|
||||
QTimer::singleShot(1000*SPLASH_TIME, mainWin, SLOT(show()));
|
||||
}
|
||||
else {
|
||||
mainWin->show();
|
||||
}
|
||||
|
||||
int result = app.exec();
|
||||
|
||||
delete splash;
|
||||
delete mainWin;
|
||||
|
||||
unregisterSimulators();
|
||||
unregisterOpenTxFirmwares();
|
||||
unregisterEEpromInterfaces();
|
||||
|
||||
#if defined(JOYSTICKS) || defined(SIMU_AUDIO)
|
||||
SDL_Quit();
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Encoding=UTF-8
|
||||
Name=Companion @VERSION@
|
||||
GenericName=Transmitter Companion App
|
||||
Comment=The Ultimate Transmitter Companion
|
||||
Icon=@COMPANION_NAME@
|
||||
Exec='@COMPANION_NAME@'
|
||||
Terminal=false
|
||||
StartupNotify=false
|
||||
Categories=Application
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,142 +0,0 @@
|
||||
#include "comparedialog.h"
|
||||
#include "ui_comparedialog.h"
|
||||
#include "helpers.h"
|
||||
#include <QPrinter>
|
||||
#include <QPrintDialog>
|
||||
|
||||
// #if !defined WIN32 && defined __GNUC__
|
||||
// #include <unistd.h>
|
||||
// #endif
|
||||
|
||||
class DragDropHeader {
|
||||
public:
|
||||
DragDropHeader():
|
||||
general_settings(false),
|
||||
models_count(0)
|
||||
{
|
||||
}
|
||||
bool general_settings;
|
||||
uint8_t models_count;
|
||||
uint8_t models[C9X_MAX_MODELS];
|
||||
};
|
||||
|
||||
CompareDialog::CompareDialog(QWidget * parent, Firmware * firmware):
|
||||
QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
|
||||
multimodelprinter(firmware),
|
||||
model1Valid(false),
|
||||
model2Valid(false),
|
||||
ui(new Ui::CompareDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
setWindowIcon(CompanionIcon("compare.png"));
|
||||
setAcceptDrops(true);
|
||||
|
||||
//setDragDropOverwriteMode(true);
|
||||
//setDropIndicatorShown(true);
|
||||
// TODO scroll to top ... ui->textEdit->scrollToAnchor("1");
|
||||
}
|
||||
|
||||
void CompareDialog::dragMoveEvent(QDragMoveEvent * event)
|
||||
{
|
||||
if (event->mimeData()->hasFormat("application/x-companion")) {
|
||||
event->acceptProposedAction();
|
||||
}
|
||||
else {
|
||||
event->ignore();
|
||||
}
|
||||
}
|
||||
|
||||
void CompareDialog::dragEnterEvent(QDragEnterEvent * event)
|
||||
{
|
||||
// accept just text/uri-list mime format
|
||||
if (event->mimeData()->hasFormat("application/x-companion")) {
|
||||
event->acceptProposedAction();
|
||||
}
|
||||
else {
|
||||
event->ignore();
|
||||
}
|
||||
}
|
||||
|
||||
void CompareDialog::dragLeaveEvent(QDragLeaveEvent * event)
|
||||
{
|
||||
event->accept();
|
||||
}
|
||||
|
||||
bool CompareDialog::handleDroppedModel(const QMimeData * mimeData, ModelData & model, QLabel * label)
|
||||
{
|
||||
if (mimeData->hasFormat("application/x-companion")) {
|
||||
QByteArray gmData = mimeData->data("application/x-companion");
|
||||
DragDropHeader * header = (DragDropHeader *)gmData.data();
|
||||
if (!header->general_settings) {
|
||||
char * gData = gmData.data() + sizeof(DragDropHeader);
|
||||
if (gData[0] == 'M') {
|
||||
ModelData * modeltemp = (ModelData *)(gData + 1);
|
||||
if (modeltemp->used) {
|
||||
memcpy(&model, modeltemp, sizeof(ModelData));
|
||||
QString name(model.name);
|
||||
if (!name.isEmpty())
|
||||
label->setText(name);
|
||||
else
|
||||
label->setText(tr("No name"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void CompareDialog::dropEvent(QDropEvent *event)
|
||||
{
|
||||
QLabel * child = qobject_cast<QLabel*>(childAt(event->pos()));
|
||||
if (!child) return;
|
||||
if (child->objectName().contains("label_1")) {
|
||||
model1Valid = handleDroppedModel(event->mimeData(), model1, ui->label_1);
|
||||
}
|
||||
else if (child->objectName().contains("label_2")) {
|
||||
model2Valid = handleDroppedModel(event->mimeData(), model2, ui->label_2);
|
||||
}
|
||||
event->accept();
|
||||
if (model1Valid && model2Valid) {
|
||||
multimodelprinter.setModel(0, model1);
|
||||
multimodelprinter.setModel(1, model2);
|
||||
ui->textEdit->setHtml(multimodelprinter.print(ui->textEdit->document()));
|
||||
}
|
||||
}
|
||||
|
||||
void CompareDialog::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
}
|
||||
|
||||
CompareDialog::~CompareDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void CompareDialog::on_printButton_clicked()
|
||||
{
|
||||
QPrinter printer;
|
||||
printer.setPageMargins(10.0, 10.0, 10.0, 10.0, printer.Millimeter);
|
||||
QPrintDialog * dialog = new QPrintDialog(&printer, this);
|
||||
dialog->setWindowTitle(tr("Print Document"));
|
||||
if (dialog->exec() != QDialog::Accepted)
|
||||
return;
|
||||
ui->textEdit->print(&printer);
|
||||
}
|
||||
|
||||
void CompareDialog::on_printFileButton_clicked()
|
||||
{
|
||||
QPrinter printer;
|
||||
QString filename = QFileDialog::getSaveFileName(this, tr("Select PDF output file"), QString(), "Pdf File(*.pdf)");
|
||||
printer.setPageMargins(10.0, 10.0, 10.0, 10.0, printer.Millimeter);
|
||||
printer.setOutputFormat(QPrinter::PdfFormat);
|
||||
printer.setOrientation(QPrinter::Landscape);
|
||||
printer.setColorMode(QPrinter::Color);
|
||||
if (!filename.isEmpty()) {
|
||||
if (QFileInfo(filename).suffix().isEmpty())
|
||||
filename.append(".pdf");
|
||||
printer.setOutputFileName(filename);
|
||||
ui->textEdit->print(&printer);
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
#ifndef _COMPAREDIALOG_H
|
||||
#define _COMPAREDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QLabel>
|
||||
#include "multimodelprinter.h"
|
||||
|
||||
namespace Ui {
|
||||
class CompareDialog;
|
||||
}
|
||||
|
||||
class CompareDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CompareDialog(QWidget *parent, Firmware * firmware);
|
||||
~CompareDialog();
|
||||
|
||||
protected:
|
||||
MultiModelPrinter multimodelprinter;
|
||||
ModelData model1;
|
||||
ModelData model2;
|
||||
bool model1Valid;
|
||||
bool model2Valid;
|
||||
Ui::CompareDialog * ui;
|
||||
|
||||
protected slots:
|
||||
void on_printButton_clicked();
|
||||
void on_printFileButton_clicked();
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent * event);
|
||||
bool handleDroppedModel(const QMimeData * mimeData, ModelData & model, QLabel * label);
|
||||
void dropEvent(QDropEvent *event);
|
||||
void dragMoveEvent(QDragMoveEvent *event);
|
||||
void dragEnterEvent(QDragEnterEvent *event);
|
||||
void dragLeaveEvent(QDragLeaveEvent *event);
|
||||
void printDiff();
|
||||
};
|
||||
|
||||
#endif // _COMPAREDIALOG_H
|
||||
@@ -1,148 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CompareDialog</class>
|
||||
<widget class="QDialog" name="CompareDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>580</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>780</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="acceptDrops">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Compare Models</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_1">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="acceptDrops">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">color:green;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Drag first model here</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="acceptDrops">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">color:red;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Drag second model here</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QTextEdit" name="textEdit">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="closeButton">
|
||||
<property name="text">
|
||||
<string>Close</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="printButton">
|
||||
<property name="text">
|
||||
<string>Print</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="printFileButton">
|
||||
<property name="text">
|
||||
<string>Print to file</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="companion.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>closeButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>CompareDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>739</x>
|
||||
<y>636</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>565</x>
|
||||
<y>623</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
@@ -1,41 +0,0 @@
|
||||
#ifndef _constants_h_
|
||||
#define _constants_h_
|
||||
|
||||
enum BoardEnum {
|
||||
BOARD_STOCK,
|
||||
BOARD_M128,
|
||||
BOARD_MEGA2560,
|
||||
BOARD_GRUVIN9X,
|
||||
BOARD_SKY9X,
|
||||
BOARD_9XRPRO,
|
||||
BOARD_AR9X,
|
||||
BOARD_TARANIS,
|
||||
BOARD_TARANIS_PLUS,
|
||||
BOARD_TARANIS_X9E,
|
||||
BOARD_FLAMENCO,
|
||||
BOARD_HORUS
|
||||
};
|
||||
|
||||
#define C9X_MAX_MODELS 60
|
||||
#define C9X_MAX_TIMERS 3
|
||||
#define C9X_MAX_FLIGHT_MODES 9
|
||||
#define C9X_MAX_MIXERS 64
|
||||
#define C9X_MAX_INPUTS 32
|
||||
#define C9X_MAX_EXPOS 64
|
||||
#define C9X_MAX_CURVES 32
|
||||
#define C9X_MAX_POINTS 17
|
||||
#define C9X_MAX_GVARS 9
|
||||
#define C9X_MAX_ENCODERS 2
|
||||
#define C9X_NUM_CHNOUT 32 // number of real output channels
|
||||
#define C9X_NUM_CSW 64 // number of custom switches
|
||||
#define C9X_MAX_CUSTOM_FUNCTIONS 64 // number of functions assigned to switches
|
||||
#define C9X_NUM_MODULES 2
|
||||
#define NUM_STICKS 4
|
||||
#define BOARD_9X_NUM_POTS 3
|
||||
#define C9X_NUM_POTS 8
|
||||
#define NUM_CAL_PPM 4
|
||||
#define NUM_CYC 3
|
||||
#define C9X_NUM_SWITCHES 32
|
||||
#define C9X_NUM_KEYS 32
|
||||
|
||||
#endif
|
||||
@@ -1,115 +0,0 @@
|
||||
#include "contributorsdialog.h"
|
||||
#include "ui_htmldialog.h"
|
||||
#include "helpers.h"
|
||||
|
||||
ContributorsDialog::ContributorsDialog(QWidget * parent):
|
||||
QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
|
||||
ui(new Ui::HtmlDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
setWindowTitle(tr("OpenTX Contributors"));
|
||||
setWindowIcon(CompanionIcon("contributors.png"));
|
||||
|
||||
QString str = "<html>" \
|
||||
"<head>" \
|
||||
" <style type=\"text/css\">" \
|
||||
" .normal { font-weight:normal;color:#000000;vertical-align:top;font-size:10px;text-align:left;font-family:arial,helvetica,sans-serif; }" \
|
||||
" .bold { font-weight:bold;color:#C00000;vertical-align:top;font-size:10px;text-align:left;font-family:arial,helvetica,sans-serif; }" \
|
||||
" .title { font-weight:bold;color:#000000;font-size:14px;text-align:left;font-family:arial,helvetica,sans-serif; }" \
|
||||
" </style>" \
|
||||
"</head>"
|
||||
"<body class=\"normal\">";
|
||||
|
||||
QFile credits(":/CREDITS.txt");
|
||||
if (credits.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
QStringList names;
|
||||
while (!credits.atEnd()) {
|
||||
QByteArray line = credits.readLine();
|
||||
if (line.trimmed() == "")
|
||||
break;
|
||||
names.append(line.trimmed());
|
||||
}
|
||||
str.append(formatTable(tr("Main Developers"), names, 3));
|
||||
|
||||
names.clear();
|
||||
while (!credits.atEnd()) {
|
||||
QByteArray line = credits.readLine();
|
||||
names.append(line.trimmed());
|
||||
}
|
||||
str.append(formatTable(tr("Other contributors"), names, 3));
|
||||
}
|
||||
|
||||
QFile donations(":/DONATIONS.txt");
|
||||
if (donations.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
QStringList names;
|
||||
while (!donations.atEnd()) {
|
||||
QByteArray line = donations.readLine();
|
||||
if (line.trimmed() == "")
|
||||
break;
|
||||
names.append(line.trimmed());
|
||||
}
|
||||
str.append(formatTable(tr("Companies and projects who have donated to OpenTX"), names, 3));
|
||||
|
||||
names.clear();
|
||||
while (!donations.atEnd()) {
|
||||
QByteArray line = donations.readLine();
|
||||
names.append(line);
|
||||
}
|
||||
str.append(formatTable(tr("People who have donated to OpenTX"), names, 6));
|
||||
}
|
||||
|
||||
str.append("<table><tr><td class=\"normal\"> </td></tr>" \
|
||||
" <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);
|
||||
ui->textEditor->setOpenExternalLinks(true);
|
||||
}
|
||||
|
||||
ContributorsDialog::~ContributorsDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
QString ContributorsDialog::formatTable(const QString & title, const QStringList & names, int columns)
|
||||
{
|
||||
const float cwidth = 100.0 / columns;
|
||||
QString str = "<table width=\"100%\" border=0 cellspacing=0 cellpadding=2>" \
|
||||
" <tr><td class=\"normal\"> </td></tr>" \
|
||||
" <tr><td class=\"title\">" + title + "</td></tr>" \
|
||||
"</table>";
|
||||
|
||||
str.append("<table width=\"100%\" border=0 cellspacing=0 cellpadding=2>");
|
||||
|
||||
int column = 0;
|
||||
foreach(QString name, names) {
|
||||
if (column == 0) {
|
||||
str.append("<tr>");
|
||||
}
|
||||
QString trclass = name.contains("monthly") ? "bold" : "normal";
|
||||
str.append(QString("<td width=\"%1%\" class=\"%2\">%3</td>").arg(cwidth).arg(trclass).arg(name.trimmed().replace("monthly", tr("monthly"))));
|
||||
if (++column == columns) {
|
||||
str.append("</tr>");
|
||||
column = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (column != 0) {
|
||||
str.append("</tr>");
|
||||
}
|
||||
|
||||
str.append("</table>");
|
||||
return str;
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
#ifndef CONTRIBUTORSDIALOG_H
|
||||
#define CONTRIBUTORSDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class HtmlDialog;
|
||||
}
|
||||
|
||||
class ContributorsDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ContributorsDialog(QWidget * parent = 0);
|
||||
~ContributorsDialog();
|
||||
|
||||
private:
|
||||
Ui::HtmlDialog * ui;
|
||||
QString formatTable(const QString & title, const QStringList & names, int colums);
|
||||
};
|
||||
|
||||
#endif // CONTRIBUTORSDIALOG_H
|
||||
@@ -1,45 +0,0 @@
|
||||
#include "converteeprom.h"
|
||||
#include "eeprominterface.h"
|
||||
#include "firmwareinterface.h"
|
||||
#include <QFile>
|
||||
|
||||
bool convertEEprom(const QString &sourceEEprom, const QString &destinationEEprom, const QString &firmwareFilename)
|
||||
{
|
||||
Firmware *currentFirmware = GetCurrentFirmware();
|
||||
FirmwareInterface firmware(firmwareFilename);
|
||||
if (!firmware.isValid())
|
||||
return false;
|
||||
|
||||
unsigned int version = firmware.getEEpromVersion();
|
||||
unsigned int variant = firmware.getEEpromVariant();
|
||||
|
||||
QFile sourceFile(sourceEEprom);
|
||||
int eeprom_size = sourceFile.size();
|
||||
if (!eeprom_size)
|
||||
return false;
|
||||
|
||||
if (!sourceFile.open(QIODevice::ReadOnly))
|
||||
return false;
|
||||
|
||||
QByteArray eeprom(eeprom_size, 0);
|
||||
long result = sourceFile.read(eeprom.data(), eeprom_size);
|
||||
sourceFile.close();
|
||||
|
||||
QSharedPointer<RadioData> radioData = QSharedPointer<RadioData>(new RadioData());
|
||||
std::bitset<NUM_ERRORS> errors((unsigned long long)LoadEeprom(*radioData, (uint8_t *)eeprom.data(), eeprom_size));
|
||||
if (!errors.test(NO_ERROR)
|
||||
|| !currentFirmware->saveEEPROM((uint8_t *)eeprom.data(), *radioData, variant, version)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
QFile destinationFile(destinationEEprom);
|
||||
if (!destinationFile.open(QIODevice::WriteOnly))
|
||||
return false;
|
||||
|
||||
result = destinationFile.write(eeprom.constData(), eeprom_size);
|
||||
destinationFile.close();
|
||||
if (result != eeprom_size)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
#ifndef CONVERTHEADER_H_
|
||||
#define CONVERTHEADER_H_
|
||||
|
||||
#include <QString>
|
||||
|
||||
bool convertEEprom(const QString &sourceEEprom, const QString &destinationEEprom, const QString &firmware);
|
||||
|
||||
#endif /* CONVERTHEADER_H_ */
|
||||
@@ -1,16 +0,0 @@
|
||||
#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
|
||||
@@ -1,267 +0,0 @@
|
||||
#include "customizesplashdialog.h"
|
||||
#include "ui_customizesplashdialog.h"
|
||||
#include "flashfirmwaredialog.h"
|
||||
#include "appdata.h"
|
||||
#include "helpers.h"
|
||||
#include "firmwareinterface.h"
|
||||
#include "splashlibrarydialog.h"
|
||||
|
||||
//*** Side Class ***
|
||||
|
||||
Side::Side(){
|
||||
imageLabel = 0;
|
||||
fileNameEdit = 0;
|
||||
saveButton = 0;
|
||||
loadFwButton=0;
|
||||
loadPictButton = 0;
|
||||
loadProfileButton = 0;
|
||||
saveToFileName = new QString("");
|
||||
source = new Source(UNDEFINED);
|
||||
format = new LCDFormat(LCDTARANIS);
|
||||
}
|
||||
|
||||
void Side::markSourceButton()
|
||||
{
|
||||
loadFwButton->setChecked(*source == FW ? true : false );
|
||||
loadPictButton->setChecked(*source == PICT ? true : false );
|
||||
loadProfileButton->setChecked(*source == PROFILE ? true : false );
|
||||
}
|
||||
|
||||
void Side::copyImage( Side side )
|
||||
{
|
||||
if ((*source!=UNDEFINED) && (*side.source!=UNDEFINED))
|
||||
imageLabel->setPixmap(*side.imageLabel->pixmap());
|
||||
}
|
||||
|
||||
bool Side::displayImage( QString fileName, Source pictSource )
|
||||
{
|
||||
QImage image;
|
||||
|
||||
if (fileName.isEmpty())
|
||||
return false;
|
||||
|
||||
// Determine which picture format to use
|
||||
if (pictSource == FW ){
|
||||
FirmwareInterface firmware(fileName);
|
||||
if (!firmware.hasSplash())
|
||||
return false;
|
||||
else
|
||||
image = firmware.getSplash();
|
||||
*format = (firmware.getSplashWidth()==WIDTH_TARANIS ? LCDTARANIS : LCD9X);
|
||||
}
|
||||
else {
|
||||
image.load(fileName);
|
||||
if (pictSource== PICT)
|
||||
*format = image.width()>WIDTH_9X ? LCDTARANIS : LCD9X;
|
||||
else if (pictSource == PROFILE)
|
||||
*format = (g.profile[g.id()].fwType().contains("taranis")) ? LCDTARANIS : LCD9X;
|
||||
}
|
||||
if (image.isNull()) {
|
||||
return false;
|
||||
}
|
||||
// Load image
|
||||
if (*format==LCDTARANIS) {
|
||||
imageLabel->setPixmap( makePixMap( image, "taranis" ));
|
||||
imageLabel->setFixedSize(WIDTH_TARANIS*2, HEIGHT_TARANIS*2);
|
||||
}
|
||||
else {
|
||||
imageLabel->setPixmap( makePixMap( image, "9x" ));
|
||||
imageLabel->setFixedSize(WIDTH_9X*2, HEIGHT_9X*2);
|
||||
}
|
||||
|
||||
switch (pictSource){
|
||||
case FW:
|
||||
fileNameEdit->setText(QObject::tr("FW: %1").arg(fileName));
|
||||
*saveToFileName = fileName;
|
||||
*source=FW;
|
||||
break;
|
||||
case PICT:
|
||||
fileNameEdit->setText(QObject::tr("Pict: %1").arg(fileName));
|
||||
*saveToFileName = fileName;
|
||||
*source=PICT;
|
||||
break;
|
||||
case PROFILE:
|
||||
fileNameEdit->setText(QObject::tr("Profile image"));
|
||||
*saveToFileName = fileName;
|
||||
*source=PROFILE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
saveButton->setEnabled(true);
|
||||
libraryButton->setEnabled(true);
|
||||
invertButton->setEnabled(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Side::refreshImage()
|
||||
{
|
||||
return displayImage( *saveToFileName, *source );
|
||||
}
|
||||
|
||||
bool Side::saveImage()
|
||||
{
|
||||
if (*source == FW )
|
||||
{
|
||||
FirmwareInterface firmware(*saveToFileName);
|
||||
if (!firmware.hasSplash()) {
|
||||
return false;
|
||||
}
|
||||
QImage image = imageLabel->pixmap()->toImage().scaled(firmware.getSplashWidth(), firmware.getSplashHeight());
|
||||
if (firmware.setSplash(image) && (firmware.save(*saveToFileName) > 0)) {
|
||||
g.flashDir( QFileInfo(*saveToFileName).dir().absolutePath() );
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (*source == PICT) {
|
||||
QImage image = imageLabel->pixmap()->toImage().scaled(imageLabel->width()/2, imageLabel->height()/2).convertToFormat(QImage::Format_Indexed8);
|
||||
if (image.save(*saveToFileName)) {
|
||||
g.imagesDir( QFileInfo(*saveToFileName).dir().absolutePath() );
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (*source == PROFILE) {
|
||||
QImage image = imageLabel->pixmap()->toImage().scaled(imageLabel->width()/2, imageLabel->height()/2).convertToFormat(QImage::Format_Indexed8);
|
||||
if (!image.save(*saveToFileName)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//*** customizeSplashDialog Class ***
|
||||
|
||||
customizeSplashDialog::customizeSplashDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::customizeSplashDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setWindowIcon(CompanionIcon("paintbrush.png"));
|
||||
ui->leftLibraryButton->setIcon(CompanionIcon("library.png"));
|
||||
ui->rightLibraryButton->setIcon(CompanionIcon("library.png"));
|
||||
|
||||
left.imageLabel = ui->leftImageLabel;
|
||||
right.imageLabel = ui->rightImageLabel;
|
||||
left.fileNameEdit = ui->leftFileNameEdit;
|
||||
right.fileNameEdit = ui->rightFileNameEdit;
|
||||
left.saveButton = ui->leftSaveButton;
|
||||
right.saveButton = ui->rightSaveButton;
|
||||
left.libraryButton = ui->leftLibraryButton;
|
||||
right.libraryButton = ui->rightLibraryButton;
|
||||
left.invertButton = ui->leftInvertButton;
|
||||
right.invertButton = ui->rightInvertButton;
|
||||
|
||||
left.loadFwButton = ui->leftLoadFwButton;
|
||||
right.loadFwButton = ui->rightLoadFwButton;
|
||||
left.loadPictButton = ui->leftLoadPictButton;
|
||||
right.loadPictButton = ui->rightLoadPictButton;
|
||||
left.loadProfileButton = ui->leftLoadProfileButton;
|
||||
right.loadProfileButton = ui->rightLoadProfileButton;
|
||||
|
||||
loadProfile(left);
|
||||
left.markSourceButton();
|
||||
|
||||
resize(0,0);
|
||||
}
|
||||
|
||||
customizeSplashDialog::~customizeSplashDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void customizeSplashDialog::on_copyRightToLeftButton_clicked() {
|
||||
left.copyImage(right);
|
||||
}
|
||||
void customizeSplashDialog::on_copyLeftToRightButton_clicked() {
|
||||
right.copyImage(left);
|
||||
}
|
||||
|
||||
|
||||
void customizeSplashDialog::on_leftLoadFwButton_clicked() {loadFirmware(left);}
|
||||
void customizeSplashDialog::on_rightLoadFwButton_clicked() {loadFirmware(right);}
|
||||
void customizeSplashDialog::loadFirmware(Side side)
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Open Firmware File"), g.flashDir(), FLASH_FILES_FILTER);
|
||||
if (!fileName.isEmpty()) {
|
||||
if (!side.displayImage( fileName, FW ))
|
||||
QMessageBox::critical(this, tr("Error"), tr("Can not load embedded image from firmware file %1.").arg(fileName));
|
||||
else
|
||||
g.flashDir( QFileInfo(fileName).dir().absolutePath() );
|
||||
}
|
||||
side.markSourceButton();
|
||||
}
|
||||
|
||||
void customizeSplashDialog::on_leftLoadPictButton_clicked() {loadPicture(left);}
|
||||
void customizeSplashDialog::on_rightLoadPictButton_clicked() {loadPicture(right);}
|
||||
void customizeSplashDialog::loadPicture(Side side)
|
||||
{
|
||||
QString supportedImageFormats;
|
||||
for (int formatIndex = 0; formatIndex < QImageReader::supportedImageFormats().count(); formatIndex++) {
|
||||
supportedImageFormats += QLatin1String(" *.") + QImageReader::supportedImageFormats()[formatIndex];
|
||||
}
|
||||
QString fileName = QFileDialog::getOpenFileName(this,
|
||||
tr("Open Image to load"), g.imagesDir(), tr("Images (%1)").arg(supportedImageFormats));
|
||||
|
||||
if (!fileName.isEmpty()) {
|
||||
if (!side.displayImage( fileName, PICT ))
|
||||
QMessageBox::critical(this, tr("Error"), tr("Cannot load the image file %1.").arg(fileName));
|
||||
else
|
||||
g.imagesDir( QFileInfo(fileName).dir().absolutePath() );
|
||||
}
|
||||
side.markSourceButton();
|
||||
}
|
||||
|
||||
void customizeSplashDialog::on_leftLoadProfileButton_clicked() {loadProfile(left);}
|
||||
void customizeSplashDialog::on_rightLoadProfileButton_clicked() {loadProfile(right);}
|
||||
void customizeSplashDialog::loadProfile(Side side)
|
||||
{
|
||||
QString fileName=g.profile[g.id()].splashFile();
|
||||
|
||||
if (!fileName.isEmpty()) {
|
||||
if (!side.displayImage( fileName, PROFILE ))
|
||||
QMessageBox::critical(this, tr("Error"), tr("Cannot load profile image %1.").arg(fileName));
|
||||
}
|
||||
side.markSourceButton();
|
||||
}
|
||||
|
||||
void customizeSplashDialog::on_leftLibraryButton_clicked(){libraryButton_clicked(left);}
|
||||
void customizeSplashDialog::on_rightLibraryButton_clicked(){libraryButton_clicked(right);}
|
||||
void customizeSplashDialog::libraryButton_clicked( Side side )
|
||||
{
|
||||
QString fileName;
|
||||
SplashLibraryDialog *ld = new SplashLibraryDialog(this,&fileName);
|
||||
ld->exec();
|
||||
if (!fileName.isEmpty()) {
|
||||
if (!side.displayImage( fileName, UNDEFINED ))
|
||||
QMessageBox::critical(this, tr("Error"), tr("Cannot load the library image %1.").arg(fileName));
|
||||
}
|
||||
}
|
||||
|
||||
void customizeSplashDialog::on_leftSaveButton_clicked(){saveButton_clicked(left);}
|
||||
void customizeSplashDialog::on_rightSaveButton_clicked(){saveButton_clicked(right);}
|
||||
void customizeSplashDialog::saveButton_clicked( Side side )
|
||||
{
|
||||
if (side.saveImage()){
|
||||
QMessageBox::information(this, tr("File Saved"), tr("The image was saved to the file %1").arg(*side.saveToFileName));
|
||||
if ( !side.refreshImage()){
|
||||
QMessageBox::critical(this, tr("Image Refresh Error"), tr("Failed to refresh image from file %1").arg(*side.saveToFileName));
|
||||
}
|
||||
}
|
||||
else
|
||||
QMessageBox::critical(this, tr("File Save Error"), tr("Failed to write image to %1").arg(*side.saveToFileName));
|
||||
}
|
||||
|
||||
void customizeSplashDialog::on_leftInvertButton_clicked(){invertButton_clicked(left);}
|
||||
void customizeSplashDialog::on_rightInvertButton_clicked(){invertButton_clicked(right);}
|
||||
void customizeSplashDialog::invertButton_clicked(Side side)
|
||||
{
|
||||
QImage image = side.imageLabel->pixmap()->toImage();
|
||||
image.invertPixels();
|
||||
side.imageLabel->setPixmap(QPixmap::fromImage(image));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
#ifndef CUSTOMIZESPLASHDIALOG_H
|
||||
#define CUSTOMIZESPLASHDIALOG_H
|
||||
|
||||
#include <QtGui>
|
||||
#include <QDialog>
|
||||
#include "firmwareinterface.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class customizeSplashDialog;
|
||||
}
|
||||
|
||||
const int WIDTH_TARANIS = 212;
|
||||
const int HEIGHT_TARANIS = 64;
|
||||
const int WIDTH_9X = 128;
|
||||
const int HEIGHT_9X = 64;
|
||||
|
||||
enum Source {FW, PICT, PROFILE, UNDEFINED};
|
||||
enum LCDFormat {LCD9X, LCDTARANIS};
|
||||
|
||||
class Side
|
||||
{
|
||||
public:
|
||||
Side();
|
||||
void markSourceButton();
|
||||
void copyImage( Side );
|
||||
bool displayImage( QString fileName, Source source );
|
||||
bool saveImage();
|
||||
bool refreshImage();
|
||||
|
||||
QLabel *imageLabel;
|
||||
QLineEdit *fileNameEdit;
|
||||
QPushButton *saveButton;
|
||||
QPushButton *invertButton;
|
||||
QToolButton *libraryButton;
|
||||
QPushButton *loadFwButton;
|
||||
QPushButton *loadPictButton;
|
||||
QPushButton *loadProfileButton;
|
||||
|
||||
QString *saveToFileName;
|
||||
|
||||
private:
|
||||
Source *source;
|
||||
LCDFormat *format;
|
||||
};
|
||||
|
||||
class customizeSplashDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
Side left;
|
||||
Side right;
|
||||
|
||||
public:
|
||||
explicit customizeSplashDialog(QWidget *parent = 0);
|
||||
~customizeSplashDialog();
|
||||
|
||||
private slots:
|
||||
void on_leftLoadFwButton_clicked();
|
||||
void on_leftLoadPictButton_clicked();
|
||||
void on_leftLoadProfileButton_clicked();
|
||||
void on_leftLibraryButton_clicked();
|
||||
void on_leftSaveButton_clicked();
|
||||
void on_leftInvertButton_clicked();
|
||||
|
||||
void on_rightLoadFwButton_clicked();
|
||||
void on_rightLoadPictButton_clicked();
|
||||
void on_rightLoadProfileButton_clicked();
|
||||
void on_rightLibraryButton_clicked();
|
||||
void on_rightSaveButton_clicked();
|
||||
void on_rightInvertButton_clicked();
|
||||
|
||||
void on_copyRightToLeftButton_clicked();
|
||||
void on_copyLeftToRightButton_clicked();
|
||||
|
||||
private:
|
||||
void loadFirmware( Side );
|
||||
void loadPicture( Side );
|
||||
void loadProfile( Side );
|
||||
void libraryButton_clicked( Side );
|
||||
void saveButton_clicked( Side );
|
||||
void invertButton_clicked( Side );
|
||||
|
||||
Ui::customizeSplashDialog *ui;
|
||||
enum sideEnum { LEFT, RIGHT };
|
||||
};
|
||||
|
||||
#endif // CUSTOMIZESPLASHDIALOG_H
|
||||
@@ -1,667 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>customizeSplashDialog</class>
|
||||
<widget class="QDialog" name="customizeSplashDialog">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1087</width>
|
||||
<height>298</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Transmitter Splash Screen Editor</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_13">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="Line" name="line_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<item>
|
||||
<widget class="Line" name="line_13">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_11">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_11">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="leftFileNameEdit">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>424</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>426</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_12">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_11">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="leftImageLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>424</width>
|
||||
<height>128</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>424</width>
|
||||
<height>128</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Panel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QPushButton" name="leftInvertButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Invert</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="leftLibraryButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Open Splash Library</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QPushButton" name="leftLoadProfileButton">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Load Profile</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="leftLoadFwButton">
|
||||
<property name="text">
|
||||
<string>Load FW</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="leftLoadPictButton">
|
||||
<property name="text">
|
||||
<string>Load Pict</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="leftSaveButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_9">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<item>
|
||||
<widget class="QToolButton" name="copyRightToLeftButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="arrowType">
|
||||
<enum>Qt::LeftArrow</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="copyLeftToRightButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="arrowType">
|
||||
<enum>Qt::RightArrow</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
<item>
|
||||
<widget class="Line" name="line_14">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_12">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_9">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="rightFileNameEdit">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>426</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>424</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_10">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_12">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_8">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="rightImageLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>424</width>
|
||||
<height>128</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>424</width>
|
||||
<height>128</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Panel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_8">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<widget class="QPushButton" name="rightInvertButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Invert</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="rightLibraryButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Open Splash Library</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QPushButton" name="rightLoadProfileButton">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Load Profile</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="rightLoadFwButton">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Load FW</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="rightLoadPictButton">
|
||||
<property name="text">
|
||||
<string>Load Pict</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="rightSaveButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_10">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>leftFileNameEdit</tabstop>
|
||||
<tabstop>leftInvertButton</tabstop>
|
||||
<tabstop>leftLibraryButton</tabstop>
|
||||
<tabstop>leftLoadProfileButton</tabstop>
|
||||
<tabstop>leftLoadFwButton</tabstop>
|
||||
<tabstop>leftLoadPictButton</tabstop>
|
||||
<tabstop>leftSaveButton</tabstop>
|
||||
<tabstop>copyLeftToRightButton</tabstop>
|
||||
<tabstop>copyRightToLeftButton</tabstop>
|
||||
<tabstop>rightFileNameEdit</tabstop>
|
||||
<tabstop>rightInvertButton</tabstop>
|
||||
<tabstop>rightLibraryButton</tabstop>
|
||||
<tabstop>rightLoadProfileButton</tabstop>
|
||||
<tabstop>rightLoadFwButton</tabstop>
|
||||
<tabstop>rightLoadPictButton</tabstop>
|
||||
<tabstop>rightSaveButton</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="companion.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -1,100 +0,0 @@
|
||||
#include "downloaddialog.h"
|
||||
#include "ui_downloaddialog.h"
|
||||
#include <QMessageBox>
|
||||
#include <QtGui>
|
||||
#include <QTime>
|
||||
#include "helpers.h"
|
||||
|
||||
downloadDialog::downloadDialog(QWidget *parent, QString src, QString tgt):
|
||||
QDialog(parent),
|
||||
ui(new Ui::downloadDialog),
|
||||
file(NULL)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setWindowIcon(CompanionIcon("fwpreferences.png"));
|
||||
ui->progressBar->setValue(1);
|
||||
ui->progressBar->setMinimum(0);
|
||||
ui->progressBar->setMaximum(0);
|
||||
|
||||
if (tgt.isEmpty()) {
|
||||
setWindowTitle(src);
|
||||
return; // just show wait dialog.
|
||||
}
|
||||
|
||||
file = new QFile(tgt);
|
||||
if (!file->open(QIODevice::WriteOnly)) {
|
||||
QMessageBox::critical(this, "Companion",
|
||||
tr("Unable to save the file %1: %2.")
|
||||
.arg(tgt).arg(file->errorString()));
|
||||
QTimer::singleShot(0, this, SLOT(fileError()));
|
||||
}
|
||||
else {
|
||||
reply = qnam.get(QNetworkRequest(QUrl(src)));
|
||||
connect(reply, SIGNAL(finished()), this, SLOT(httpFinished()));
|
||||
connect(reply, SIGNAL(readyRead()), this, SLOT(httpReadyRead()));
|
||||
connect(reply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(updateDataReadProgress(qint64,qint64)));
|
||||
}
|
||||
}
|
||||
|
||||
downloadDialog::~downloadDialog()
|
||||
{
|
||||
delete ui;
|
||||
delete file;
|
||||
}
|
||||
|
||||
void downloadDialog::httpFinished()
|
||||
{
|
||||
file->flush();
|
||||
file->close();
|
||||
|
||||
bool ok = true;
|
||||
if (reply->error()) {
|
||||
file->remove();
|
||||
QMessageBox::information(this, tr("Companion"),
|
||||
tr("Download failed: %1.")
|
||||
.arg(reply->errorString()));
|
||||
ok = false;
|
||||
}
|
||||
|
||||
reply->deleteLater();
|
||||
reply = 0;
|
||||
delete file;
|
||||
file = NULL;
|
||||
|
||||
if (ok)
|
||||
accept();
|
||||
else
|
||||
reject();
|
||||
}
|
||||
|
||||
void downloadDialog::httpReadyRead()
|
||||
{
|
||||
if (file) {
|
||||
file->write(reply->readAll());
|
||||
}
|
||||
}
|
||||
|
||||
void downloadDialog::updateDataReadProgress(qint64 bytesRead, qint64 totalBytes)
|
||||
{
|
||||
ui->progressBar->setMaximum(totalBytes);
|
||||
ui->progressBar->setValue(bytesRead);
|
||||
}
|
||||
|
||||
void downloadDialog::fileError()
|
||||
{
|
||||
delete file;
|
||||
file = NULL;
|
||||
reject();
|
||||
}
|
||||
|
||||
#if 0
|
||||
void downloadDialog::closeEvent( QCloseEvent * event)
|
||||
{
|
||||
// Delay closing 2 seconds to avoid unpleasant flashing download dialogs
|
||||
QTime closeTime= QTime::currentTime().addSecs(2);
|
||||
while( QTime::currentTime() < closeTime )
|
||||
QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
|
||||
|
||||
event->accept();
|
||||
}
|
||||
#endif
|
||||
@@ -1,41 +0,0 @@
|
||||
#ifndef DOWNLOADDIALOG_H
|
||||
#define DOWNLOADDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
#include <QNetworkRequest>
|
||||
#include <QFile>
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class downloadDialog;
|
||||
}
|
||||
|
||||
class downloadDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit downloadDialog(QWidget *parent = 0, QString src = "", QString tgt = "");
|
||||
~downloadDialog();
|
||||
|
||||
private slots:
|
||||
void fileError();
|
||||
void httpFinished();
|
||||
void httpReadyRead();
|
||||
void updateDataReadProgress(qint64 bytesRead, qint64 totalBytes);
|
||||
|
||||
private:
|
||||
#if 0
|
||||
void closeEvent( QCloseEvent * event);
|
||||
#endif
|
||||
Ui::downloadDialog *ui;
|
||||
|
||||
QNetworkAccessManager qnam;
|
||||
QNetworkReply *reply;
|
||||
QFile *file;
|
||||
|
||||
};
|
||||
|
||||
#endif // DOWNLOADDIALOG_H
|
||||
@@ -1,86 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>downloadDialog</class>
|
||||
<widget class="QDialog" name="downloadDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>562</width>
|
||||
<height>82</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Downloading: </string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QProgressBar" name="progressBar">
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="companion.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>downloadDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>downloadDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
@@ -1,745 +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 eeprom_importexport_h
|
||||
#define eeprom_importexport_h
|
||||
|
||||
#include "customdebug.h"
|
||||
|
||||
#define DIM(arr) (sizeof((arr))/sizeof((arr)[0]))
|
||||
|
||||
class DataField {
|
||||
public:
|
||||
DataField(const char *name=""):
|
||||
name(name)
|
||||
{
|
||||
}
|
||||
virtual const char *getName() { return name; }
|
||||
virtual ~DataField() { }
|
||||
virtual void ExportBits(QBitArray & output) = 0;
|
||||
virtual void ImportBits(QBitArray & input) = 0;
|
||||
virtual unsigned int size() = 0;
|
||||
|
||||
QBitArray bytesToBits(QByteArray bytes)
|
||||
{
|
||||
QBitArray bits(bytes.count()*8);
|
||||
// Convert from QByteArray to QBitArray
|
||||
for (int i=0; i<bytes.count(); ++i)
|
||||
for (int b=0; b<8; ++b)
|
||||
bits.setBit(i*8+b, bytes.at(i)&(1<<b));
|
||||
return bits;
|
||||
}
|
||||
|
||||
QByteArray bitsToBytes(QBitArray bits, int offset=0)
|
||||
{
|
||||
QByteArray bytes;
|
||||
bytes.resize((offset+bits.count()+7)/8);
|
||||
bytes.fill(0);
|
||||
// Convert from QBitArray to QByteArray
|
||||
for (int b=0; b<bits.count(); ++b)
|
||||
bytes[(b+offset)/8] = ( bytes.at((b+offset)/8) | ((bits[b]?1:0)<<((b+offset)%8)));
|
||||
return bytes;
|
||||
}
|
||||
|
||||
int Export(QByteArray & output)
|
||||
{
|
||||
QBitArray result;
|
||||
ExportBits(result);
|
||||
output = bitsToBytes(result);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Import(QByteArray & input)
|
||||
{
|
||||
QBitArray bits = bytesToBits(input);
|
||||
ImportBits(bits);
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual int Dump(int level=0, int offset=0)
|
||||
{
|
||||
QBitArray bits;
|
||||
ExportBits(bits);
|
||||
QByteArray bytes = bitsToBytes(bits);
|
||||
int result = (offset+bits.count()) % 8;
|
||||
for (int i=0; i<level; i++) printf(" ");
|
||||
if (bits.count() % 8 == 0)
|
||||
printf("%s (%dbytes) ", getName(), bytes.count());
|
||||
else
|
||||
printf("%s (%dbits) ", getName(), bits.count());
|
||||
for (int i=0; i<bytes.count(); i++) {
|
||||
unsigned char c = bytes[i];
|
||||
if ((i==0 && offset) || (i==bytes.count()-1 && result!=0))
|
||||
printf("(%02x) ", c);
|
||||
else
|
||||
printf("%02x ", c);
|
||||
}
|
||||
printf("\n"); fflush(stdout);
|
||||
return result;
|
||||
}
|
||||
|
||||
protected:
|
||||
const char *name;
|
||||
};
|
||||
|
||||
class ProxyField: public DataField {
|
||||
public:
|
||||
ProxyField():
|
||||
DataField("Proxy")
|
||||
{
|
||||
}
|
||||
|
||||
virtual DataField * getField() = 0;
|
||||
|
||||
};
|
||||
|
||||
template<class container, int N>
|
||||
class BaseUnsignedField: public DataField {
|
||||
public:
|
||||
explicit BaseUnsignedField(container & field):
|
||||
DataField("Unsigned"),
|
||||
field(field),
|
||||
min(0),
|
||||
max(UINT_MAX)
|
||||
{
|
||||
}
|
||||
|
||||
BaseUnsignedField(container & field, const char *name):
|
||||
DataField(name),
|
||||
field(field),
|
||||
min(0),
|
||||
max(UINT_MAX)
|
||||
{
|
||||
}
|
||||
|
||||
BaseUnsignedField(container & field, unsigned int min, unsigned int max, const char *name="Unsigned"):
|
||||
DataField(name),
|
||||
field(field),
|
||||
min(min),
|
||||
max(max)
|
||||
{
|
||||
}
|
||||
|
||||
virtual void ExportBits(QBitArray & output)
|
||||
{
|
||||
container value = field;
|
||||
if (value > max) value = max;
|
||||
if (value < min) value = min;
|
||||
|
||||
output.resize(N);
|
||||
for (int i=0; i<N; i++) {
|
||||
if (value & (1<<i))
|
||||
output.setBit(i);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void ImportBits(QBitArray & input)
|
||||
{
|
||||
field = 0;
|
||||
for (int i=0; i<N; i++) {
|
||||
if (input[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()
|
||||
{
|
||||
return N;
|
||||
}
|
||||
|
||||
protected:
|
||||
container & field;
|
||||
container min;
|
||||
container max;
|
||||
|
||||
private:
|
||||
BaseUnsignedField();
|
||||
};
|
||||
|
||||
template <int N>
|
||||
class UnsignedField : public BaseUnsignedField<unsigned int, N>
|
||||
{
|
||||
public:
|
||||
explicit UnsignedField(unsigned int & field):
|
||||
BaseUnsignedField<unsigned int, N>(field)
|
||||
{
|
||||
}
|
||||
|
||||
UnsignedField(unsigned int & field, const char *name):
|
||||
BaseUnsignedField<unsigned int, N>(field, name)
|
||||
{
|
||||
}
|
||||
|
||||
UnsignedField(unsigned int & field, unsigned int min, unsigned int max, const char *name="Unsigned"):
|
||||
BaseUnsignedField<unsigned int, N>(field, min, max, name)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template<int N>
|
||||
class BoolField: public DataField {
|
||||
public:
|
||||
explicit BoolField(bool & field):
|
||||
DataField("Bool"),
|
||||
field(field)
|
||||
{
|
||||
}
|
||||
|
||||
virtual void ExportBits(QBitArray & output)
|
||||
{
|
||||
output.resize(N);
|
||||
if (field) {
|
||||
output.setBit(0);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void ImportBits(QBitArray & input)
|
||||
{
|
||||
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()
|
||||
{
|
||||
return N;
|
||||
}
|
||||
|
||||
protected:
|
||||
bool & field;
|
||||
|
||||
private:
|
||||
BoolField();
|
||||
};
|
||||
|
||||
template<int N>
|
||||
class SignedField: public DataField {
|
||||
public:
|
||||
SignedField(int & field):
|
||||
DataField("Signed"),
|
||||
field(field),
|
||||
min(INT_MIN),
|
||||
max(INT_MAX)
|
||||
{
|
||||
}
|
||||
|
||||
SignedField(int & field, const char *name):
|
||||
DataField(name),
|
||||
field(field),
|
||||
min(INT_MIN),
|
||||
max(INT_MAX)
|
||||
{
|
||||
}
|
||||
|
||||
SignedField(int & field, int min, int max, const char *name="Signed"):
|
||||
DataField(name),
|
||||
field(field),
|
||||
min(min),
|
||||
max(max)
|
||||
{
|
||||
}
|
||||
|
||||
virtual void ExportBits(QBitArray & output)
|
||||
{
|
||||
int value = field;
|
||||
if (value > max) value = max;
|
||||
if (value < min) value = min;
|
||||
|
||||
output.resize(N);
|
||||
for (int i=0; i<N; i++) {
|
||||
if (((unsigned int)value) & (1<<i))
|
||||
output.setBit(i);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void ImportBits(QBitArray & input)
|
||||
{
|
||||
unsigned int value = 0;
|
||||
for (int i=0; i<N; i++) {
|
||||
if (input[i])
|
||||
value |= (1<<i);
|
||||
}
|
||||
|
||||
if (input[N-1]) {
|
||||
for (unsigned int i=N; i<8*sizeof(int); i++) {
|
||||
value |= (1<<i);
|
||||
}
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
return N;
|
||||
}
|
||||
|
||||
protected:
|
||||
int & field;
|
||||
int min;
|
||||
int max;
|
||||
};
|
||||
|
||||
template<int N>
|
||||
class SpareBitsField: public UnsignedField<N> {
|
||||
public:
|
||||
SpareBitsField():
|
||||
UnsignedField<N>(spare, 0, 0, "Spare"),
|
||||
spare(0)
|
||||
{
|
||||
}
|
||||
protected:
|
||||
unsigned int spare;
|
||||
};
|
||||
|
||||
template<int N>
|
||||
class CharField: public DataField {
|
||||
public:
|
||||
CharField(char *field, bool truncate=true):
|
||||
DataField("Char"),
|
||||
field(field),
|
||||
truncate(truncate)
|
||||
{
|
||||
}
|
||||
|
||||
virtual void ExportBits(QBitArray & output)
|
||||
{
|
||||
output.resize(N*8);
|
||||
int b = 0;
|
||||
int len = truncate ? strlen(field) : N;
|
||||
for (int i=0; i<N; i++) {
|
||||
int idx = (i>=len ? 0 : field[i]);
|
||||
for (int j=0; j<8; j++, b++) {
|
||||
if (idx & (1<<j))
|
||||
output.setBit(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtual void ImportBits(QBitArray & input)
|
||||
{
|
||||
unsigned int b = 0;
|
||||
for (int i=0; i<N; i++) {
|
||||
int8_t idx = 0;
|
||||
for (int j=0; j<8; j++) {
|
||||
if (input[b++])
|
||||
idx |= (1<<j);
|
||||
}
|
||||
field[i] = idx;
|
||||
}
|
||||
eepromImportDebug() << QString("\timported %1<%2>: '%3'").arg(name).arg(N).arg(field);
|
||||
}
|
||||
|
||||
virtual unsigned int size()
|
||||
{
|
||||
return 8*N;
|
||||
}
|
||||
|
||||
protected:
|
||||
char * field;
|
||||
bool truncate;
|
||||
};
|
||||
|
||||
int8_t char2idx(char c);
|
||||
char idx2char(int8_t idx);
|
||||
|
||||
template<int N>
|
||||
class ZCharField: public DataField {
|
||||
public:
|
||||
ZCharField(char *field):
|
||||
DataField("ZChar"),
|
||||
field(field)
|
||||
{
|
||||
}
|
||||
|
||||
virtual void ExportBits(QBitArray & output)
|
||||
{
|
||||
output.resize(N*8);
|
||||
int b = 0;
|
||||
int len = strlen(field);
|
||||
for (int i=0; i<N; i++) {
|
||||
int idx = i>=len ? 0 : char2idx(field[i]);
|
||||
for (int j=0; j<8; j++, b++) {
|
||||
if (idx & (1<<j))
|
||||
output.setBit(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtual void ImportBits(QBitArray & input)
|
||||
{
|
||||
unsigned int b = 0;
|
||||
for (int i=0; i<N; i++) {
|
||||
int8_t idx = 0;
|
||||
for (int j=0; j<8; j++) {
|
||||
if (input[b++])
|
||||
idx |= (1<<j);
|
||||
}
|
||||
field[i] = idx2char(idx);
|
||||
}
|
||||
|
||||
field[N] = '\0';
|
||||
for (int i=N-1; i>=0; i--) {
|
||||
if (field[i] == ' ')
|
||||
field[i] = '\0';
|
||||
else
|
||||
break;
|
||||
}
|
||||
eepromImportDebug() << QString("\timported %1<%2>: '%3'").arg(name).arg(N).arg(field);
|
||||
}
|
||||
|
||||
virtual unsigned int size()
|
||||
{
|
||||
return 8*N;
|
||||
}
|
||||
|
||||
protected:
|
||||
char * field;
|
||||
};
|
||||
|
||||
class StructField: public DataField {
|
||||
public:
|
||||
StructField(const char *name="Struct"):
|
||||
DataField(name)
|
||||
{
|
||||
}
|
||||
|
||||
~StructField() {
|
||||
foreach(DataField *field, fields) {
|
||||
delete field;
|
||||
}
|
||||
}
|
||||
|
||||
inline void Append(DataField *field) {
|
||||
//eepromImportDebug() << QString("StructField(%1) appending field: %2").arg(name).arg(field->getName());
|
||||
fields.append(field);
|
||||
}
|
||||
|
||||
virtual void ExportBits(QBitArray & output)
|
||||
{
|
||||
int offset = 0;
|
||||
output.resize(size());
|
||||
foreach(DataField *field, fields) {
|
||||
QBitArray bits;
|
||||
field->ExportBits(bits);
|
||||
for (int i=0; i<bits.size(); i++)
|
||||
output[offset++] = bits[i];
|
||||
}
|
||||
}
|
||||
|
||||
virtual void ImportBits(QBitArray & input)
|
||||
{
|
||||
eepromImportDebug() << QString("\timporting %1[%2]:").arg(name).arg(fields.size());
|
||||
int offset = 0;
|
||||
foreach(DataField *field, fields) {
|
||||
unsigned int size = field->size();
|
||||
QBitArray bits(size);
|
||||
for (unsigned int i=0; i<size; i++) {
|
||||
bits[i] = input[offset++];
|
||||
}
|
||||
field->ImportBits(bits);
|
||||
}
|
||||
}
|
||||
|
||||
virtual unsigned int size()
|
||||
{
|
||||
unsigned int result = 0;
|
||||
foreach(DataField *field, fields) {
|
||||
result += field->size();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
virtual int Dump(int level=0, int offset=0)
|
||||
{
|
||||
for (int i=0; i<level; i++) printf(" ");
|
||||
printf("%s (%d bytes)\n", getName(), size()/8);
|
||||
foreach(DataField *field, fields) {
|
||||
offset = field->Dump(level+1, offset);
|
||||
}
|
||||
return offset;
|
||||
}
|
||||
|
||||
protected:
|
||||
QList<DataField *> fields;
|
||||
};
|
||||
|
||||
class TransformedField: public DataField {
|
||||
public:
|
||||
TransformedField(DataField & field):
|
||||
DataField(),
|
||||
field(field)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~TransformedField()
|
||||
{
|
||||
}
|
||||
|
||||
virtual void ExportBits(QBitArray & output)
|
||||
{
|
||||
beforeExport();
|
||||
field.ExportBits(output);
|
||||
}
|
||||
|
||||
virtual void ImportBits(QBitArray & input)
|
||||
{
|
||||
eepromImportDebug() << QString("\timporting TransformedField %1:").arg(field.getName());
|
||||
field.ImportBits(input);
|
||||
afterImport();
|
||||
}
|
||||
|
||||
|
||||
virtual const char *getName()
|
||||
{
|
||||
return field.getName();
|
||||
}
|
||||
|
||||
virtual unsigned int size()
|
||||
{
|
||||
return field.size();
|
||||
}
|
||||
|
||||
virtual void beforeExport() = 0;
|
||||
|
||||
virtual void afterImport() = 0;
|
||||
|
||||
virtual int Dump(int level=0, int offset=0)
|
||||
{
|
||||
beforeExport();
|
||||
return field.Dump(level, offset);
|
||||
}
|
||||
|
||||
protected:
|
||||
DataField & field;
|
||||
};
|
||||
|
||||
class ConversionTable {
|
||||
|
||||
public:
|
||||
bool exportValue(const int before, int &after)
|
||||
{
|
||||
after = 0;
|
||||
|
||||
for (std::list<ConversionTuple>::iterator it=exportTable.begin(); it!=exportTable.end(); it++) {
|
||||
ConversionTuple tuple = *it;
|
||||
if (before == tuple.a) {
|
||||
after = tuple.b;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool importValue(const int before, int &after)
|
||||
{
|
||||
after = 0;
|
||||
|
||||
for (std::list<ConversionTuple>::iterator it=importTable.begin(); it!=importTable.end(); it++) {
|
||||
ConversionTuple tuple = *it;
|
||||
if (before == tuple.b) {
|
||||
after = tuple.a;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
class ConversionTuple {
|
||||
public:
|
||||
ConversionTuple(const int a, const int b):
|
||||
a(a),
|
||||
b(b)
|
||||
{
|
||||
}
|
||||
|
||||
int a;
|
||||
int b;
|
||||
};
|
||||
|
||||
void addConversion(const int a, const int b)
|
||||
{
|
||||
ConversionTuple conversion(a, b);
|
||||
importTable.push_back(conversion);
|
||||
exportTable.push_back(conversion);
|
||||
}
|
||||
|
||||
void addImportConversion(const int a, const int b)
|
||||
{
|
||||
importTable.push_back(ConversionTuple(a, b));
|
||||
}
|
||||
|
||||
void addExportConversion(const int a, const int b)
|
||||
{
|
||||
exportTable.push_back(ConversionTuple(a, b));
|
||||
}
|
||||
|
||||
std::list<ConversionTuple> importTable;
|
||||
std::list<ConversionTuple> exportTable;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
class ConversionField: public TransformedField {
|
||||
public:
|
||||
ConversionField(int & field, ConversionTable *table, const char *name, const QString & error = ""):
|
||||
TransformedField(internalField),
|
||||
internalField(_field, name),
|
||||
field(field),
|
||||
_field(0),
|
||||
table(table),
|
||||
shift(0),
|
||||
scale(1),
|
||||
min(INT_MIN),
|
||||
max(INT_MAX),
|
||||
exportFunc(NULL),
|
||||
importFunc(NULL),
|
||||
error(error)
|
||||
{
|
||||
}
|
||||
|
||||
ConversionField(unsigned int & field, ConversionTable *table, const char *name, const QString & error = ""):
|
||||
TransformedField(internalField),
|
||||
internalField((unsigned int &)_field, name),
|
||||
field((int &)field),
|
||||
_field(0),
|
||||
table(table),
|
||||
shift(0),
|
||||
scale(0),
|
||||
min(INT_MIN),
|
||||
max(INT_MAX),
|
||||
exportFunc(NULL),
|
||||
importFunc(NULL),
|
||||
error(error)
|
||||
{
|
||||
}
|
||||
|
||||
ConversionField(int & field, int (*exportFunc)(int), int (*importFunc)(int)):
|
||||
TransformedField(internalField),
|
||||
internalField(_field),
|
||||
field(field),
|
||||
_field(0),
|
||||
table(NULL),
|
||||
shift(0),
|
||||
scale(0),
|
||||
min(INT_MIN),
|
||||
max(INT_MAX),
|
||||
exportFunc(exportFunc),
|
||||
importFunc(importFunc),
|
||||
error("")
|
||||
{
|
||||
}
|
||||
|
||||
ConversionField(int & field, int shift, int scale=0, int min=INT_MIN, int max=INT_MAX, const char *name = "Signed shifted"):
|
||||
TransformedField(internalField),
|
||||
internalField(_field, name),
|
||||
field(field),
|
||||
_field(0),
|
||||
table(NULL),
|
||||
shift(shift),
|
||||
scale(scale),
|
||||
min(min),
|
||||
max(max),
|
||||
exportFunc(NULL),
|
||||
importFunc(NULL),
|
||||
error("")
|
||||
{
|
||||
}
|
||||
|
||||
ConversionField(unsigned int & field, int shift, int scale=0):
|
||||
TransformedField(internalField),
|
||||
internalField((unsigned int &)_field),
|
||||
field((int &)field),
|
||||
_field(0),
|
||||
table(NULL),
|
||||
shift(shift),
|
||||
scale(scale),
|
||||
min(INT_MIN),
|
||||
max(INT_MAX),
|
||||
exportFunc(NULL),
|
||||
importFunc(NULL),
|
||||
error("")
|
||||
{
|
||||
}
|
||||
|
||||
virtual void beforeExport()
|
||||
{
|
||||
_field = field;
|
||||
|
||||
if (scale) {
|
||||
_field /= scale;
|
||||
}
|
||||
|
||||
if (table) {
|
||||
if (table->exportValue(_field, _field))
|
||||
return;
|
||||
if (!error.isEmpty())
|
||||
EEPROMWarnings.push_back(error);
|
||||
}
|
||||
|
||||
if (shift) {
|
||||
if (_field < min) _field = min + shift;
|
||||
else if (_field > max) _field = max + shift;
|
||||
else _field += shift;
|
||||
}
|
||||
|
||||
if (exportFunc) {
|
||||
_field = exportFunc(_field);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void afterImport()
|
||||
{
|
||||
field = _field;
|
||||
|
||||
if (table) {
|
||||
if (table->importValue(field, field))
|
||||
return;
|
||||
}
|
||||
|
||||
if (shift) {
|
||||
field -= shift;
|
||||
}
|
||||
|
||||
if (importFunc) {
|
||||
field = importFunc(field);
|
||||
}
|
||||
|
||||
if (scale) {
|
||||
field *= scale;
|
||||
}
|
||||
eepromImportDebug() << QString("\timported ConversionField<%1>:").arg(internalField.getName()) << QString(" before: %1, after: %2").arg(_field).arg(field);
|
||||
}
|
||||
|
||||
protected:
|
||||
T internalField;
|
||||
int & field;
|
||||
int _field;
|
||||
ConversionTable * table;
|
||||
int shift;
|
||||
int scale;
|
||||
int min;
|
||||
int max;
|
||||
int (*exportFunc)(int);
|
||||
int (*importFunc)(int);
|
||||
const QString error;
|
||||
};
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,733 +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 <stdio.h>
|
||||
#include <inttypes.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <algorithm>
|
||||
#include "eeprominterface.h"
|
||||
#include "file.h"
|
||||
|
||||
RleFile::RleFile():
|
||||
eeprom(NULL),
|
||||
eeprom_size(0),
|
||||
eeFs(NULL),
|
||||
eeFsArm(NULL),
|
||||
eepromFatHeader(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
#define EEPROM_SIZE (4*1024*1024/8)
|
||||
#define EEPROM_BLOCK_SIZE (4*1024)
|
||||
#define EEPROM_MARK 0x84697771 /* thanks ;) */
|
||||
#define EEPROM_ZONE_SIZE (8*1024)
|
||||
#define EEPROM_FAT_SIZE 128
|
||||
#define EEPROM_MAX_ZONES (EEPROM_SIZE / EEPROM_ZONE_SIZE)
|
||||
#define EEPROM_MAX_FILES (EEPROM_MAX_ZONES - 1)
|
||||
#define FIRST_FILE_AVAILABLE (1+MAX_MODELS)
|
||||
|
||||
void RleFile::EeFsCreate(uint8_t *eeprom, int size, BoardEnum board, unsigned int version)
|
||||
{
|
||||
this->eeprom = eeprom;
|
||||
this->eeprom_size = size;
|
||||
this->board = board;
|
||||
this->version = version;
|
||||
|
||||
if (IS_SKY9X(board)) {
|
||||
memset(eeprom, 0xFF, size);
|
||||
if (version >= 217) {
|
||||
memset(eeprom, 0, EEPROM_FAT_SIZE);
|
||||
eepromFatHeader = (EepromHeader *)(eeprom + EEPROM_FAT_SIZE);
|
||||
eepromFatHeader->mark = EEPROM_MARK;
|
||||
eepromFatHeader->index = 1;
|
||||
for (int i=0; i<EEPROM_MAX_FILES; i++) {
|
||||
eepromFatHeader->files[i].exists = 0;
|
||||
eepromFatHeader->files[i].zoneIndex = i+1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (IS_TARANIS(board)) {
|
||||
eeFsArm = (EeFsArm *)eeprom;
|
||||
eeFsVersion = 5;
|
||||
eeFsSize = 8+4*62;
|
||||
eeFsBlockSize = 64;
|
||||
eeFsFirstBlock = 1;
|
||||
eeFsBlocksOffset = eeFsSize - eeFsBlockSize;
|
||||
eeFsBlocksMax = 1 + (EESIZE_TARANIS-eeFsSize)/eeFsBlockSize;
|
||||
eeFsLinkSize = sizeof(int16_t);
|
||||
memset(eeprom, 0, size);
|
||||
eeFsArm->version = eeFsVersion;
|
||||
eeFsArm->mySize = eeFsSize;
|
||||
eeFsArm->freeList = 0;
|
||||
eeFsArm->bs = 64;
|
||||
for (unsigned int i=eeFsFirstBlock; i<eeFsBlocksMax-1; i++)
|
||||
EeFsSetLink(i, i+1);
|
||||
EeFsSetLink(eeFsBlocksMax-1, 0);
|
||||
eeFsArm->freeList = eeFsFirstBlock;
|
||||
// EeFsFlush();
|
||||
}
|
||||
else {
|
||||
eeFs = (EeFs *)eeprom;
|
||||
eeFsVersion = (IS_2560(board) || board==BOARD_M128) ? 5 : 4;
|
||||
eeFsBlockSize = 16;
|
||||
eeFsLinkSize = 1;
|
||||
|
||||
if (eeFsVersion == 5) {
|
||||
eeFsSize = 4+3*36;
|
||||
eeFsFirstBlock = 1;
|
||||
eeFsBlocksOffset = 112 - 16;
|
||||
eeFsBlocksMax = 1 + (4096-112)/16;
|
||||
}
|
||||
else {
|
||||
eeFsSize = 4+3*20;
|
||||
eeFsFirstBlock = 4;
|
||||
eeFsBlocksOffset = 0;
|
||||
eeFsBlocksMax = 2048/16;
|
||||
}
|
||||
|
||||
memset(eeprom, 0, size);
|
||||
eeFs->version = eeFsVersion;
|
||||
eeFs->mySize = eeFsSize;
|
||||
eeFs->freeList = 0;
|
||||
eeFs->bs = eeFsBlockSize;
|
||||
for (unsigned int i=eeFsFirstBlock; i<eeFsBlocksMax-1; i++)
|
||||
EeFsSetLink(i, i+1);
|
||||
EeFsSetLink(eeFsBlocksMax-1, 0);
|
||||
eeFs->freeList = eeFsFirstBlock;
|
||||
// EeFsFlush();
|
||||
}
|
||||
}
|
||||
|
||||
PACK(struct EepromFileHeader
|
||||
{
|
||||
uint16_t fileIndex;
|
||||
uint16_t size;
|
||||
});
|
||||
|
||||
bool RleFile::searchFat()
|
||||
{
|
||||
eepromFatHeader = NULL;
|
||||
uint32_t bestFatIndex = 0;
|
||||
for (int i=0; i<EEPROM_ZONE_SIZE/EEPROM_FAT_SIZE; i++) {
|
||||
EepromHeader * header = (EepromHeader *)(eeprom+i*EEPROM_FAT_SIZE);
|
||||
if (header->mark == EEPROM_MARK && (int)header->index >= bestFatIndex) {
|
||||
eepromFatHeader = header;
|
||||
bestFatIndex = header->index;
|
||||
}
|
||||
}
|
||||
return (eepromFatHeader != NULL);
|
||||
}
|
||||
|
||||
bool RleFile::EeFsOpen(uint8_t *eeprom, int size, BoardEnum board)
|
||||
{
|
||||
this->eeprom = eeprom;
|
||||
this->eeprom_size = size;
|
||||
this->board = board;
|
||||
|
||||
if (IS_SKY9X(board)) {
|
||||
searchFat();
|
||||
return 1;
|
||||
}
|
||||
else if (IS_TARANIS(board)) {
|
||||
eeFsArm = (EeFsArm *)eeprom;
|
||||
eeFsVersion = eeFsArm->version;
|
||||
eeFsSize = 8+4*62;
|
||||
eeFsBlockSize = 64;
|
||||
eeFsLinkSize = sizeof(int16_t);
|
||||
eeFsFirstBlock = 1;
|
||||
eeFsBlocksOffset = eeFsSize - eeFsBlockSize;
|
||||
eeFsBlocksMax = 1 + (EESIZE_TARANIS-eeFsSize)/eeFsBlockSize;
|
||||
return eeFsArm->mySize == eeFsSize;
|
||||
}
|
||||
else {
|
||||
eeFs = (EeFs *)eeprom;
|
||||
eeFsVersion = eeFs->version;
|
||||
eeFsBlockSize = 16;
|
||||
eeFsLinkSize = 1;
|
||||
if (eeFsVersion == 5) {
|
||||
eeFsSize = 4+3*36;
|
||||
eeFsFirstBlock = 1;
|
||||
eeFsBlocksOffset = 112 - 16;
|
||||
eeFsBlocksMax = 1 + (4096-112)/16;
|
||||
}
|
||||
else if (eeFsVersion == 4) {
|
||||
eeFsSize = 4+3*20;
|
||||
eeFsFirstBlock = 4;
|
||||
eeFsBlocksOffset = 0;
|
||||
eeFsBlocksMax = 2048/16;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return eeFs->mySize == eeFsSize;
|
||||
}
|
||||
}
|
||||
|
||||
void RleFile::eeprom_read_block (void *pointer_ram, unsigned int pointer_eeprom, size_t size)
|
||||
{
|
||||
memcpy(pointer_ram, &eeprom[pointer_eeprom], size);
|
||||
}
|
||||
|
||||
void RleFile::eeprom_write_block(const void *pointer_ram, unsigned int pointer_eeprom, size_t size)
|
||||
{
|
||||
memcpy(&eeprom[pointer_eeprom], pointer_ram, size);
|
||||
}
|
||||
|
||||
uint8_t RleFile::EeFsRead(unsigned int blk, unsigned int ofs)
|
||||
{
|
||||
uint8_t ret;
|
||||
eeprom_read_block(&ret, blk*eeFsBlockSize+ofs+eeFsBlocksOffset, 1);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void RleFile::EeFsWrite(unsigned int blk, unsigned int ofs, uint8_t val)
|
||||
{
|
||||
eeprom_write_block(&val, blk*eeFsBlockSize+ofs+eeFsBlocksOffset, 1);
|
||||
}
|
||||
|
||||
unsigned int RleFile::EeFsGetLink(unsigned int blk)
|
||||
{
|
||||
if (IS_ARM(board)) {
|
||||
int16_t ret;
|
||||
eeprom_read_block((uint8_t *)&ret, blk*eeFsBlockSize+eeFsBlocksOffset, eeFsLinkSize);
|
||||
return ret;
|
||||
}
|
||||
else {
|
||||
return EeFsRead(blk, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void RleFile::EeFsSetLink(unsigned int blk, unsigned int val)
|
||||
{
|
||||
if (IS_ARM(board)) {
|
||||
int16_t s_link = val;
|
||||
eeprom_write_block((uint8_t *)&s_link, (blk*eeFsBlockSize)+eeFsBlocksOffset, eeFsLinkSize);
|
||||
}
|
||||
else {
|
||||
EeFsWrite(blk, 0, val);
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t RleFile::EeFsGetDat(unsigned int blk, unsigned int ofs)
|
||||
{
|
||||
return EeFsRead(blk, ofs+eeFsLinkSize);
|
||||
}
|
||||
|
||||
void RleFile::EeFsSetDat(unsigned int blk, unsigned int ofs, const uint8_t *buf, unsigned int len)
|
||||
{
|
||||
eeprom_write_block(buf, blk*eeFsBlockSize+ofs+eeFsLinkSize+eeFsBlocksOffset, len);
|
||||
}
|
||||
|
||||
unsigned int RleFile::EeFsGetFree()
|
||||
{
|
||||
unsigned int ret = 0;
|
||||
unsigned int i;
|
||||
if (IS_ARM(board))
|
||||
i = eeFsArm->freeList;
|
||||
else
|
||||
i = eeFs->freeList;
|
||||
|
||||
while (i) {
|
||||
ret += eeFsBlockSize-eeFsLinkSize;
|
||||
i = EeFsGetLink(i);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* free one or more blocks
|
||||
*/
|
||||
void RleFile::EeFsFree(unsigned int blk)
|
||||
{
|
||||
unsigned int i = blk;
|
||||
while (EeFsGetLink(i)) i = EeFsGetLink(i);
|
||||
if (IS_ARM(board)) {
|
||||
EeFsSetLink(i, eeFsArm->freeList);
|
||||
eeFsArm->freeList = blk; //chain in front
|
||||
}
|
||||
else {
|
||||
EeFsSetLink(i, eeFs->freeList);
|
||||
eeFs->freeList = blk; //chain in front
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* alloc one block from freelist
|
||||
*/
|
||||
unsigned int RleFile::EeFsAlloc()
|
||||
{
|
||||
unsigned int ret = (IS_ARM(board) ? eeFsArm->freeList : eeFs->freeList);
|
||||
if (ret) {
|
||||
if (IS_ARM(board))
|
||||
eeFsArm->freeList = EeFsGetLink(ret);
|
||||
else
|
||||
eeFs->freeList = EeFsGetLink(ret);
|
||||
EeFsSetLink(ret, 0);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
unsigned int RleFile::size(unsigned int id)
|
||||
{
|
||||
return IS_ARM(board) ? eeFsArm->files[id].size : eeFs->files[id].size;
|
||||
}
|
||||
|
||||
unsigned int RleFile::openRd(unsigned int i_fileId)
|
||||
{
|
||||
if (IS_SKY9X(board)) {
|
||||
if (eepromFatHeader) {
|
||||
m_fileId = eepromFatHeader->files[i_fileId].zoneIndex;
|
||||
if (eepromFatHeader->files[i_fileId].exists) {
|
||||
eeprom_read_block(&m_size, m_fileId*(1<<13)+sizeof(uint16_t), sizeof(uint16_t));
|
||||
}
|
||||
else {
|
||||
m_size = 0;
|
||||
}
|
||||
m_pos = sizeof(EepromFileHeader);
|
||||
}
|
||||
else {
|
||||
m_fileId = get_current_block_number(i_fileId * 2, &m_size);
|
||||
m_pos = sizeof(t_eeprom_header);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
m_fileId = i_fileId;
|
||||
m_pos = 0;
|
||||
m_currBlk = (IS_ARM(board) ? eeFsArm->files[m_fileId].startBlk : eeFs->files[m_fileId].startBlk);
|
||||
m_ofs = 0;
|
||||
m_zeroes = 0;
|
||||
m_bRlc = 0;
|
||||
m_err = ERR_NONE; //error reasons
|
||||
if (IS_ARM(board))
|
||||
return eeFsArm->files[m_fileId].typ;
|
||||
else
|
||||
return eeFs->files[m_fileId].typ;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int RleFile::read(uint8_t *buf, unsigned int i_len)
|
||||
{
|
||||
unsigned int len = IS_ARM(board) ? eeFsArm->files[m_fileId].size : eeFs->files[m_fileId].size;
|
||||
len -= m_pos;
|
||||
if (i_len > len) i_len = len;
|
||||
len = i_len;
|
||||
while(len) {
|
||||
if (!m_currBlk) break;
|
||||
*buf++ = EeFsGetDat(m_currBlk, m_ofs++);
|
||||
if (m_ofs >= (eeFsBlockSize-(IS_ARM(board)? 2 : 1))) {
|
||||
m_ofs = 0;
|
||||
m_currBlk = EeFsGetLink(m_currBlk);
|
||||
}
|
||||
len--;
|
||||
}
|
||||
m_pos += i_len - len;
|
||||
return i_len - len;
|
||||
}
|
||||
|
||||
// G: Read runlength (RLE) compressed bytes into buf.
|
||||
unsigned int RleFile::readRlc12(uint8_t *buf, unsigned int i_len, bool rlc2)
|
||||
{
|
||||
memset(buf, 0, i_len);
|
||||
|
||||
if (IS_SKY9X(board)) {
|
||||
int len;
|
||||
if (eepromFatHeader) {
|
||||
len = std::min((int)i_len, (int)m_size + (int)sizeof(EepromFileHeader) - (int)m_pos);
|
||||
eeprom_read_block(buf, (m_fileId << 13) + m_pos, len);
|
||||
m_pos += len;
|
||||
}
|
||||
else {
|
||||
len = std::min((int)i_len, (int)m_size + (int)sizeof(t_eeprom_header) - (int)m_pos);
|
||||
if (len > 0) {
|
||||
eeprom_read_block(buf, (m_fileId << 12) + m_pos, len);
|
||||
m_pos += len;
|
||||
}
|
||||
}
|
||||
return len;
|
||||
}
|
||||
else {
|
||||
unsigned int i=0;
|
||||
for( ; 1; ) {
|
||||
uint8_t ln = std::min<uint16_t>(m_zeroes, i_len-i);
|
||||
memset(&buf[i], 0, ln);
|
||||
i += ln;
|
||||
m_zeroes -= ln;
|
||||
if(m_zeroes) break;
|
||||
|
||||
ln = std::min<uint16_t>(m_bRlc, i_len-i);
|
||||
uint8_t lr = read(&buf[i], ln);
|
||||
i += lr ;
|
||||
m_bRlc -= lr;
|
||||
if(m_bRlc) break;
|
||||
|
||||
if (read(&m_bRlc, 1) !=1) break; //read how many bytes to read
|
||||
|
||||
if (!(m_bRlc & 0x7f)) {
|
||||
qDebug() << "RLC decoding error!";
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (rlc2) {
|
||||
if(m_bRlc&0x80){ // if contains high byte
|
||||
m_zeroes =(m_bRlc>>4) & 0x7;
|
||||
m_bRlc = m_bRlc & 0x0f;
|
||||
}
|
||||
else if(m_bRlc&0x40){
|
||||
m_zeroes = m_bRlc & 0x3f;
|
||||
m_bRlc = 0;
|
||||
}
|
||||
//else m_bRlc
|
||||
}
|
||||
else {
|
||||
if(m_bRlc&0x80){ // if contains high byte
|
||||
m_zeroes = m_bRlc & 0x7f;
|
||||
m_bRlc = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int importRlc(QByteArray & dst, QByteArray & src, unsigned int rlcVersion)
|
||||
{
|
||||
uint8_t *buf = (uint8_t *)src.data();
|
||||
unsigned int len = src.size();
|
||||
uint8_t zeroes = 0;
|
||||
uint8_t bRlc = 0;
|
||||
|
||||
dst.resize(0);
|
||||
|
||||
for( ; 1; ) {
|
||||
for (int i=0; i<zeroes; i++)
|
||||
dst.append((char)0);
|
||||
zeroes = 0;
|
||||
|
||||
if (len == 0)
|
||||
return dst.size();
|
||||
|
||||
for (int i=0; i<bRlc; i++) {
|
||||
dst.append(*buf++);
|
||||
if (--len == 0)
|
||||
return dst.size();
|
||||
}
|
||||
|
||||
bRlc = *buf++;
|
||||
--len;
|
||||
|
||||
if (!(bRlc & 0x7f)) {
|
||||
qDebug() << "RLC decoding error!";
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (rlcVersion == 2) {
|
||||
if (bRlc&0x80){ // if contains high byte
|
||||
zeroes = (bRlc>>4) & 0x07;
|
||||
bRlc = bRlc & 0x0f;
|
||||
}
|
||||
else if (bRlc&0x40){
|
||||
zeroes = bRlc & 0x3f;
|
||||
bRlc = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (bRlc&0x80){ // if contains high byte
|
||||
zeroes = bRlc & 0x7f;
|
||||
bRlc = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return dst.size();
|
||||
}
|
||||
|
||||
unsigned int RleFile::write1(uint8_t b)
|
||||
{
|
||||
return write(&b, 1);
|
||||
}
|
||||
|
||||
unsigned int RleFile::write(const uint8_t *buf, unsigned int i_len)
|
||||
{
|
||||
unsigned int len = i_len;
|
||||
if (!m_currBlk && m_pos==0)
|
||||
{
|
||||
if (IS_ARM(board))
|
||||
eeFsArm->files[m_fileId].startBlk = m_currBlk = EeFsAlloc();
|
||||
else
|
||||
eeFs->files[m_fileId].startBlk = m_currBlk = EeFsAlloc();
|
||||
}
|
||||
while (len)
|
||||
{
|
||||
if (!m_currBlk) {
|
||||
m_err = ERR_FULL;
|
||||
return 0;
|
||||
}
|
||||
if (m_ofs >= eeFsBlockSize-eeFsLinkSize) {
|
||||
m_ofs = 0;
|
||||
if (!EeFsGetLink(m_currBlk) ){
|
||||
EeFsSetLink(m_currBlk, EeFsAlloc());
|
||||
}
|
||||
m_currBlk = EeFsGetLink(m_currBlk);
|
||||
}
|
||||
if (!m_currBlk) {
|
||||
m_err = ERR_FULL;
|
||||
return 0;
|
||||
}
|
||||
uint8_t l = eeFsBlockSize-eeFsLinkSize-m_ofs; if(l>len) l=len;
|
||||
EeFsSetDat(m_currBlk, m_ofs, buf, l);
|
||||
buf +=l;
|
||||
m_ofs +=l;
|
||||
len -=l;
|
||||
}
|
||||
m_pos += i_len - len;
|
||||
return i_len - len;
|
||||
}
|
||||
|
||||
void RleFile::create(unsigned int i_fileId, unsigned int typ)
|
||||
{
|
||||
openRd(i_fileId); //internal use
|
||||
if (IS_ARM(board)) {
|
||||
eeFsArm->files[i_fileId].typ = typ;
|
||||
eeFsArm->files[i_fileId].size = 0;
|
||||
}
|
||||
else {
|
||||
eeFs->files[i_fileId].typ = typ;
|
||||
eeFs->files[i_fileId].size = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void RleFile::closeTrunc()
|
||||
{
|
||||
unsigned int fri=0;
|
||||
if (IS_ARM(board))
|
||||
eeFsArm->files[m_fileId].size = m_pos;
|
||||
else
|
||||
eeFs->files[m_fileId].size = m_pos;
|
||||
if (m_currBlk && ( fri = EeFsGetLink(m_currBlk))) EeFsSetLink(m_currBlk, 0);
|
||||
if(fri) EeFsFree( fri ); //chain in
|
||||
}
|
||||
|
||||
unsigned int RleFile::writeRlc1(unsigned int i_fileId, unsigned int typ, const uint8_t *buf, unsigned int i_len)
|
||||
{
|
||||
create(i_fileId, typ);
|
||||
bool state0 = true;
|
||||
uint8_t cnt = 0;
|
||||
uint16_t i;
|
||||
|
||||
//RLE compression:
|
||||
//rb = read byte
|
||||
//if (rb | 0x80) write rb & 0x7F zeros
|
||||
//else write rb bytes
|
||||
for (i=0; i<=i_len; i++)
|
||||
{
|
||||
bool nst0 = (buf[i] == 0);
|
||||
if (nst0 && !state0 && buf[i+1]!=0) nst0 = false ;
|
||||
if (nst0 != state0 || cnt>=0x7f || i==i_len) {
|
||||
if (state0) {
|
||||
if(cnt>0) {
|
||||
cnt |= 0x80;
|
||||
if (write(&cnt,1)!=1) goto error;
|
||||
cnt=0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (cnt>0) {
|
||||
if (write(&cnt,1) !=1) goto error;
|
||||
uint8_t ret=write(&buf[i-cnt],cnt);
|
||||
if (ret!=cnt) { cnt-=ret; goto error;}
|
||||
cnt=0;
|
||||
}
|
||||
}
|
||||
state0 = nst0;
|
||||
}
|
||||
cnt++;
|
||||
}
|
||||
if(0){
|
||||
error:
|
||||
i_len = i - (cnt & 0x7f);
|
||||
}
|
||||
closeTrunc();
|
||||
return i_len;
|
||||
}
|
||||
|
||||
/*
|
||||
* Write runlength (RLE) compressed bytes
|
||||
*/
|
||||
unsigned int RleFile::writeRlc2(unsigned int i_fileId, unsigned int typ, const uint8_t *buf, unsigned int i_len)
|
||||
{
|
||||
if (IS_SKY9X(board)) {
|
||||
openRd(i_fileId);
|
||||
if (eepromFatHeader) {
|
||||
eepromFatHeader->files[i_fileId].exists = 1;
|
||||
eeprom_write_block(buf, (m_fileId << 13) + m_pos, i_len);
|
||||
{
|
||||
EepromFileHeader header;
|
||||
header.fileIndex = i_fileId;
|
||||
header.size = i_len;
|
||||
eeprom_write_block(&header, (m_fileId << 13), sizeof(header));
|
||||
}
|
||||
}
|
||||
else {
|
||||
eeprom_write_block(buf, (m_fileId << 12) + m_pos, i_len);
|
||||
t_eeprom_header header;
|
||||
header.sequence_no = 1;
|
||||
header.data_size = i_len;
|
||||
header.flags = 0;
|
||||
header.hcsum = byte_checksum((uint8_t *) &header, 7);
|
||||
eeprom_write_block(&header, (m_fileId << 12), sizeof(header));
|
||||
}
|
||||
return i_len;
|
||||
}
|
||||
else {
|
||||
create(i_fileId, typ);
|
||||
bool run0 = buf[0] == 0;
|
||||
uint8_t cnt = 1;
|
||||
uint8_t cnt0 = 0;
|
||||
uint16_t i = 0;
|
||||
if (i_len==0) goto close;
|
||||
|
||||
//RLE compression:
|
||||
//rb = read byte
|
||||
//if (rb | 0x80) write rb & 0x7F zeros
|
||||
//else write rb bytes
|
||||
for (i=1; 1; i++) { // !! laeuft ein byte zu weit !!
|
||||
bool cur0 = buf[i] == 0;
|
||||
if (i==i_len || cur0 != run0 || cnt==0x3f || (cnt0 && cnt==0xf)) {
|
||||
if (run0){
|
||||
assert(cnt0==0);
|
||||
if (cnt<8 && i!=i_len)
|
||||
cnt0 = cnt; //aufbew fuer spaeter
|
||||
else {
|
||||
if (write1(cnt|0x40)!=1) goto error;//-cnt&0x3f
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (cnt0) {
|
||||
if (write1(0x80 | (cnt0<<4) | cnt)!=1) goto error;//-cnt0xx-cnt
|
||||
cnt0 = 0;
|
||||
}
|
||||
else {
|
||||
if (write1(cnt)!=1) goto error;//-cnt
|
||||
}
|
||||
uint8_t ret = write(&buf[i-cnt], cnt);
|
||||
if (ret != cnt) { cnt-=ret; goto error;}//-cnt
|
||||
}
|
||||
cnt=0;
|
||||
if (i==i_len) break;
|
||||
run0 = cur0;
|
||||
}
|
||||
cnt++;
|
||||
}
|
||||
if (0) {
|
||||
error:
|
||||
i-=cnt+cnt0;
|
||||
}
|
||||
|
||||
close:
|
||||
closeTrunc();
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t RleFile::byte_checksum( uint8_t *p, unsigned int size )
|
||||
{
|
||||
uint32_t csum ;
|
||||
|
||||
csum = 0 ;
|
||||
while( size )
|
||||
{
|
||||
csum += *p++ ;
|
||||
size -= 1 ;
|
||||
}
|
||||
return csum ;
|
||||
}
|
||||
|
||||
uint32_t RleFile::ee32_check_header( struct t_eeprom_header *hptr )
|
||||
{
|
||||
uint8_t csum ;
|
||||
|
||||
csum = byte_checksum( ( uint8_t *) hptr, 7 ) ;
|
||||
if ( csum == hptr->hcsum )
|
||||
{
|
||||
return 1 ;
|
||||
}
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
// Pass in an even block number, this and the next block will be checked
|
||||
// to see which is the most recent, the block_no of the most recent
|
||||
// is returned, with the corresponding data size if required
|
||||
// and the sequence number if required
|
||||
uint32_t RleFile::get_current_block_number( uint32_t block_no, uint16_t *p_size)
|
||||
{
|
||||
struct t_eeprom_header b0 ;
|
||||
struct t_eeprom_header b1 ;
|
||||
// uint32_t sequence_no ;
|
||||
uint16_t size ;
|
||||
|
||||
eeprom_read_block( ( uint8_t *)&b0, block_no << 12, sizeof(b0) ) ; // Sequence # 0
|
||||
eeprom_read_block( ( uint8_t *)&b1, (block_no+1) << 12, sizeof(b1) ) ; // Sequence # 1
|
||||
|
||||
if ( ee32_check_header( &b0 ) == 0 )
|
||||
{
|
||||
b0.sequence_no = 0 ;
|
||||
b0.data_size = 0 ;
|
||||
b0.flags = 0 ;
|
||||
}
|
||||
|
||||
size = b0.data_size ;
|
||||
// sequence_no = b0.sequence_no ;
|
||||
if ( ee32_check_header( &b0 ) == 0 )
|
||||
{
|
||||
if ( ee32_check_header( &b1 ) != 0 )
|
||||
{
|
||||
size = b1.data_size ;
|
||||
// sequence_no = b1.sequence_no ;
|
||||
block_no += 1 ;
|
||||
}
|
||||
else
|
||||
{
|
||||
size = 0 ;
|
||||
// sequence_no = 1 ;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ee32_check_header( &b1 ) != 0 )
|
||||
{
|
||||
if ( b1.sequence_no > b0.sequence_no )
|
||||
{
|
||||
size = b1.data_size ;
|
||||
// sequence_no = b1.sequence_no ;
|
||||
block_no += 1 ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( size == 0xFFFF )
|
||||
{
|
||||
size = 0 ;
|
||||
}
|
||||
if ( p_size )
|
||||
{
|
||||
*p_size = size ;
|
||||
}
|
||||
|
||||
return block_no ;
|
||||
}
|
||||
@@ -1,168 +0,0 @@
|
||||
// TODO should be rle
|
||||
|
||||
/*
|
||||
* 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 file_h
|
||||
#define file_h
|
||||
|
||||
#include "eeprominterface.h"
|
||||
|
||||
#define ERR_NONE 0
|
||||
#define ERR_FULL 1
|
||||
#define ERR_TMO 2
|
||||
|
||||
PACK(struct DirEnt {
|
||||
uint8_t startBlk;
|
||||
uint16_t size:12;
|
||||
uint16_t typ:4;
|
||||
});
|
||||
|
||||
PACK(struct DirEntArm {
|
||||
uint16_t startBlk;
|
||||
uint16_t size:12;
|
||||
uint16_t typ:4;
|
||||
});
|
||||
|
||||
PACK(struct EeFs{
|
||||
uint8_t version;
|
||||
uint8_t mySize;
|
||||
uint8_t freeList;
|
||||
uint8_t bs;
|
||||
DirEnt files[36];
|
||||
});
|
||||
|
||||
PACK(struct EeFsArm {
|
||||
uint8_t version;
|
||||
uint16_t mySize;
|
||||
uint16_t freeList;
|
||||
uint8_t bs;
|
||||
uint8_t spare[2];
|
||||
DirEntArm files[62];
|
||||
});
|
||||
|
||||
struct t_eeprom_header
|
||||
{
|
||||
uint32_t sequence_no ; // sequence # to decide which block is most recent
|
||||
uint16_t data_size ; // # bytes in data area
|
||||
uint8_t flags ;
|
||||
uint8_t hcsum ;
|
||||
};
|
||||
|
||||
PACK(struct EepromHeaderFile
|
||||
{
|
||||
uint8_t zoneIndex:7;
|
||||
uint8_t exists:1;
|
||||
});
|
||||
|
||||
PACK(struct EepromHeader
|
||||
{
|
||||
uint32_t mark;
|
||||
uint32_t index;
|
||||
EepromHeaderFile files[63];
|
||||
});
|
||||
|
||||
class RleFile
|
||||
{
|
||||
uint8_t m_fileId; //index of file in directory = filename
|
||||
unsigned int m_pos; //over all filepos
|
||||
unsigned int m_currBlk; //current block.id
|
||||
unsigned int m_ofs; //offset inside of the current block
|
||||
uint8_t m_zeroes; //control byte for run length decoder
|
||||
uint8_t m_bRlc; //control byte for run length decoder
|
||||
unsigned int m_err; //error reasons
|
||||
uint16_t m_size;
|
||||
|
||||
BoardEnum board;
|
||||
unsigned int version;
|
||||
uint8_t *eeprom;
|
||||
unsigned int eeprom_size;
|
||||
EeFs *eeFs;
|
||||
EeFsArm *eeFsArm;
|
||||
unsigned int eeFsVersion;
|
||||
unsigned int eeFsBlockSize;
|
||||
unsigned int eeFsSize;
|
||||
unsigned int eeFsFirstBlock;
|
||||
unsigned int eeFsBlocksOffset;
|
||||
unsigned int eeFsBlocksMax;
|
||||
unsigned int eeFsLinkSize;
|
||||
|
||||
EepromHeader * eepromFatHeader;
|
||||
|
||||
void eeprom_read_block (void *pointer_ram, unsigned int pointer_eeprom, size_t size);
|
||||
void eeprom_write_block(const void *pointer_ram, unsigned int pointer_eeprom, size_t size);
|
||||
|
||||
uint8_t EeFsRead(unsigned int blk, unsigned int ofs);
|
||||
void EeFsWrite(unsigned int blk, unsigned int ofs, uint8_t val);
|
||||
|
||||
unsigned int EeFsGetLink(unsigned int blk);
|
||||
void EeFsSetLink(unsigned int blk, unsigned int val);
|
||||
uint8_t EeFsGetDat(unsigned int blk, unsigned int ofs);
|
||||
void EeFsSetDat(unsigned int blk, unsigned int ofs, const uint8_t *buf, unsigned int len);
|
||||
unsigned int EeFsGetFree();
|
||||
void EeFsFree(unsigned int blk); // free one or more blocks
|
||||
unsigned int EeFsAlloc(); // alloc one block from freelist
|
||||
bool searchFat();
|
||||
|
||||
public:
|
||||
|
||||
RleFile();
|
||||
|
||||
void EeFsCreate(uint8_t *eeprom, int size, BoardEnum board, unsigned int version);
|
||||
|
||||
bool EeFsOpen(uint8_t *eeprom, int size, BoardEnum board);
|
||||
|
||||
///open file for reading, no close necessary
|
||||
///for writing use writeRlc() or create()
|
||||
unsigned int openRd(unsigned int i_fileId);
|
||||
/// create a new file with given fileId,
|
||||
/// !!! if this file already exists, then all blocks are reused
|
||||
/// and all contents will be overwritten.
|
||||
/// after writing closeTrunc has to be called
|
||||
void create(unsigned int i_fileId, unsigned int typ);
|
||||
/// close file and truncate the blockchain if to long.
|
||||
void closeTrunc();
|
||||
|
||||
///open file, write to file and close it.
|
||||
///If file existed before, then contents is overwritten.
|
||||
///If file was larger before, then unused blocks are freed
|
||||
unsigned int writeRlc1(unsigned int i_fileId, unsigned int typ, const uint8_t *buf, unsigned int i_len);
|
||||
unsigned int writeRlc2(unsigned int i_fileId, unsigned int typ, const uint8_t *buf, unsigned int i_len);
|
||||
|
||||
unsigned int read(uint8_t *buf, unsigned int i_len);
|
||||
unsigned int write1(uint8_t b);
|
||||
unsigned int write(const uint8_t *buf, unsigned int i_len);
|
||||
|
||||
///return size of compressed file without block overhead
|
||||
unsigned int size(unsigned int id);
|
||||
///read from opened file and decode rlc-coded data
|
||||
unsigned int readRlc12(uint8_t *buf, unsigned int i_len, bool rlc2);
|
||||
inline unsigned int readRlc1(uint8_t *buf, unsigned int i_len)
|
||||
{
|
||||
return readRlc12(buf, i_len, false);
|
||||
}
|
||||
inline unsigned int readRlc2(uint8_t *buf, unsigned int i_len)
|
||||
{
|
||||
return readRlc12(buf, i_len, true);
|
||||
}
|
||||
|
||||
uint8_t byte_checksum(uint8_t *p, unsigned int size);
|
||||
unsigned int ee32_check_header(struct t_eeprom_header *hptr);
|
||||
unsigned int get_current_block_number(unsigned int block_no, uint16_t *p_size);
|
||||
};
|
||||
|
||||
unsigned int importRlc(QByteArray & dst, QByteArray & src, unsigned int rlcVersion=2);
|
||||
|
||||
#endif
|
||||
@@ -1,367 +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 <QtGui>
|
||||
#include "hexinterface.h"
|
||||
#include "splash.h"
|
||||
#include "firmwareinterface.h"
|
||||
#include "helpers.h"
|
||||
|
||||
#define FW_MARK "FW"
|
||||
#define VERS_MARK "VERS"
|
||||
#define DATE_MARK "DATE"
|
||||
#define TIME_MARK "TIME"
|
||||
#define EEPR_MARK "EEPR"
|
||||
|
||||
int getFileType(const QString &fullFileName)
|
||||
{
|
||||
QString suffix = QFileInfo(fullFileName).suffix().toUpper();
|
||||
if (suffix == "HEX")
|
||||
return FILE_TYPE_HEX;
|
||||
else if (suffix == "BIN")
|
||||
return FILE_TYPE_BIN;
|
||||
else if (suffix == "EEPM")
|
||||
return FILE_TYPE_EEPM;
|
||||
else if (suffix == "EEPE")
|
||||
return FILE_TYPE_EEPE;
|
||||
else if (suffix == "XML")
|
||||
return FILE_TYPE_XML;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
FirmwareInterface::FirmwareInterface(const QString &filename):
|
||||
flash(MAX_FSIZE, 0),
|
||||
flashSize(0),
|
||||
versionId(0),
|
||||
eepromVersion(0),
|
||||
eepromVariant(0),
|
||||
splashOffset(0),
|
||||
splashSize(0),
|
||||
splashWidth(0),
|
||||
splashHeight(0),
|
||||
isValidFlag(false)
|
||||
{
|
||||
if (!filename.isEmpty()) {
|
||||
QFile file(filename);
|
||||
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { // reading HEX TEXT file
|
||||
QTextStream inputStream(&file);
|
||||
flashSize = HexInterface(inputStream).load((uint8_t *)flash.data(), MAX_FSIZE);
|
||||
file.close();
|
||||
if (flashSize == 0) {
|
||||
file.open(QIODevice::ReadOnly);
|
||||
flashSize = file.read((char *)flash.data(), MAX_FSIZE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (flashSize > 0) {
|
||||
flavour = seekLabel(FW_MARK);
|
||||
version = seekLabel(VERS_MARK);
|
||||
if (version.startsWith("opentx-")) {
|
||||
// old version format
|
||||
int index = version.lastIndexOf('-');
|
||||
flavour = version.mid(0, index);
|
||||
version = version.mid(index+1);
|
||||
}
|
||||
date = seekLabel(DATE_MARK);
|
||||
time = seekLabel(TIME_MARK);
|
||||
eepromId = seekLabel(EEPR_MARK);
|
||||
|
||||
if (eepromId.contains('-')) {
|
||||
QStringList list = eepromId.split('-');
|
||||
eepromVersion = list[0].toInt();
|
||||
eepromVariant = list[1].toInt();
|
||||
}
|
||||
else {
|
||||
eepromVersion = eepromId.toInt();
|
||||
}
|
||||
|
||||
versionId = version2index(version);
|
||||
SeekSplash();
|
||||
isValidFlag = !version.isEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
QString FirmwareInterface::seekString(const QString & string)
|
||||
{
|
||||
QString result = "";
|
||||
|
||||
int start = flash.indexOf(string);
|
||||
if (start > 0) {
|
||||
start += string.length();
|
||||
int end = -1;
|
||||
for (int i=start; i<start+50; i++) {
|
||||
char c = flash.at(i);
|
||||
if (c == '\0' || c == '\036') {
|
||||
end = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (end > 0) {
|
||||
result = flash.mid(start, (end - start)).trimmed();
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
QString FirmwareInterface::seekLabel(const QString & label)
|
||||
{
|
||||
QString result = seekString(label + "\037\033:");
|
||||
if (!result.isEmpty())
|
||||
return result;
|
||||
|
||||
return seekString(label + ":");
|
||||
}
|
||||
|
||||
QString FirmwareInterface::getFlavour() const
|
||||
{
|
||||
if (flavour == "opentx-x9dp")
|
||||
return "opentx-taranis-plus";
|
||||
else if (flavour == "opentx-x9d")
|
||||
return "opentx-taranis";
|
||||
else
|
||||
return flavour;
|
||||
}
|
||||
|
||||
bool FirmwareInterface::isHardwareCompatible(const FirmwareInterface &previousFirmware) const
|
||||
{
|
||||
QString newFlavour = getFlavour();
|
||||
if (newFlavour.isEmpty())
|
||||
return true;
|
||||
|
||||
QString previousFlavour = previousFirmware.getFlavour();
|
||||
if (previousFlavour.isEmpty())
|
||||
return true;
|
||||
|
||||
return (newFlavour == previousFlavour);
|
||||
}
|
||||
|
||||
bool FirmwareInterface::SeekSplash(QByteArray splash)
|
||||
{
|
||||
int start = flash.indexOf(splash);
|
||||
if (start>0) {
|
||||
splashOffset = start;
|
||||
splashSize = splash.size();
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool FirmwareInterface::SeekSplash(QByteArray sps, QByteArray spe, int size)
|
||||
{
|
||||
int start = 0;
|
||||
while (start>=0) {
|
||||
start = flash.indexOf(sps, start+1);
|
||||
if (start>0) {
|
||||
int end = start + sps.size() + size;
|
||||
if (end == flash.indexOf(spe, end)) {
|
||||
splashOffset = start + sps.size();
|
||||
splashSize = end - start - sps.size();
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
qDebug() << flash.indexOf(spe, start) << end << sps.size() << spe;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#define OTX_SPS_9X "SPS\0\200\100"
|
||||
#define OTX_SPS_TARANIS "SPS\0\324\100"
|
||||
#define OTX_SPS_SIZE 6
|
||||
#define OTX_SPE "SPE"
|
||||
#define OTX_SPE_SIZE 4
|
||||
|
||||
void FirmwareInterface::SeekSplash(void)
|
||||
{
|
||||
splashSize = 0;
|
||||
splashOffset = 0;
|
||||
splashWidth = SPLASH_WIDTH;
|
||||
splashHeight = SPLASH_HEIGHT;
|
||||
splash_format = QImage::Format_Mono;
|
||||
|
||||
if (SeekSplash(QByteArray((const char *)gr9x_splash, sizeof(gr9x_splash))) || SeekSplash(QByteArray((const char *)gr9xv4_splash, sizeof(gr9xv4_splash)))) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (SeekSplash(QByteArray((const char *)er9x_splash, sizeof(er9x_splash)))) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (SeekSplash(QByteArray((const char *)opentx_splash, sizeof(opentx_splash)))) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (SeekSplash(QByteArray((const char *)opentxtaranis_splash, sizeof(opentxtaranis_splash)))) {
|
||||
splashWidth = SPLASHX9D_WIDTH;
|
||||
splashHeight = SPLASHX9D_HEIGHT;
|
||||
splash_format = QImage::Format_Indexed8;
|
||||
return;
|
||||
}
|
||||
|
||||
if (SeekSplash(QByteArray((const char *)ersky9x_splash, sizeof(ersky9x_splash)))) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (SeekSplash(QByteArray(OTX_SPS_9X, OTX_SPS_SIZE), QByteArray(OTX_SPE, OTX_SPE_SIZE), 1024)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (SeekSplash(QByteArray(OTX_SPS_TARANIS, OTX_SPS_SIZE), QByteArray(OTX_SPE, OTX_SPE_SIZE), 6784)) {
|
||||
splashWidth = SPLASHX9D_WIDTH;
|
||||
splashHeight = SPLASHX9D_HEIGHT;
|
||||
splash_format = QImage::Format_Indexed8;
|
||||
return;
|
||||
}
|
||||
|
||||
if (SeekSplash(QByteArray(ERSKY9X_SPS, sizeof(ERSKY9X_SPS)), QByteArray(ERSKY9X_SPE, sizeof(ERSKY9X_SPE)), 1030)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (SeekSplash(QByteArray(ERSPLASH_MARKER, sizeof(ERSPLASH_MARKER)))) {
|
||||
splashOffset += sizeof(ERSPLASH_MARKER);
|
||||
splashSize = sizeof(er9x_splash);
|
||||
}
|
||||
}
|
||||
|
||||
bool FirmwareInterface::setSplash(const QImage & newsplash)
|
||||
{
|
||||
if (splashOffset == 0 || splashSize == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
char b[SPLASH_SIZE_MAX] = {0};
|
||||
QColor color;
|
||||
QByteArray splash;
|
||||
if (splash_format == QImage::Format_Indexed8) {
|
||||
for (unsigned int y=0; y<splashHeight; y++) {
|
||||
unsigned int idx = (y/2)*splashWidth;
|
||||
for (unsigned int x=0; x<splashWidth; x++, idx++) {
|
||||
QRgb gray = qGray(newsplash.pixel(x, y));
|
||||
uint8_t z = ((255-gray)*15)/255;
|
||||
if (y & 1) z <<= 4;
|
||||
b[idx] |= z;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
QColor black = QColor(0,0,0);
|
||||
QImage blackNwhite = newsplash.convertToFormat(QImage::Format_MonoLSB);
|
||||
for (uint y=0; y<splashHeight; y++) {
|
||||
for (uint x=0; x<splashWidth; x++) {
|
||||
color = QColor(blackNwhite.pixel(x,y));
|
||||
b[splashWidth*(y/8) + x] |= ((color==black ? 1: 0)<<(y % 8));
|
||||
}
|
||||
}
|
||||
}
|
||||
splash.clear();
|
||||
splash.append(b, splashSize);
|
||||
flash.replace(splashOffset, splashSize, splash);
|
||||
return true;
|
||||
}
|
||||
|
||||
int FirmwareInterface::getSplashWidth()
|
||||
{
|
||||
return splashWidth;
|
||||
}
|
||||
|
||||
uint FirmwareInterface::getSplashHeight()
|
||||
{
|
||||
return splashHeight;
|
||||
}
|
||||
|
||||
QImage::Format FirmwareInterface::getSplashFormat()
|
||||
{
|
||||
return splash_format;
|
||||
}
|
||||
|
||||
QImage FirmwareInterface::getSplash()
|
||||
{
|
||||
if (splashOffset == 0 || splashSize == 0) {
|
||||
return QImage(); // empty image
|
||||
}
|
||||
|
||||
if (splash_format == QImage::Format_Indexed8) {
|
||||
QImage image(splashWidth, splashHeight, QImage::Format_RGB888);
|
||||
if (splashOffset > 0) {
|
||||
for (unsigned int y=0; y<splashHeight; y++) {
|
||||
unsigned int idx = (y/2)*splashWidth;
|
||||
for (unsigned int x=0; x<splashWidth; x++, idx++) {
|
||||
uint8_t byte = flash.at(splashOffset+idx);
|
||||
unsigned int z = (y & 1) ? (byte >> 4) : (byte & 0x0F);
|
||||
z = 255-(z*255)/15;
|
||||
QRgb rgb = qRgb(z, z, z);
|
||||
image.setPixel(x, y, rgb);
|
||||
}
|
||||
}
|
||||
}
|
||||
return image;
|
||||
}
|
||||
else {
|
||||
QImage image(splashWidth, splashHeight, QImage::Format_Mono);
|
||||
if (splashOffset > 0) {
|
||||
for (unsigned int y=0; y<splashHeight; y++) {
|
||||
for(unsigned int x=0; x<splashWidth; x++) {
|
||||
image.setPixel(x, y, (flash.at(splashOffset+(splashWidth*(y/8)+x)) & (1<<(y % 8))) ? 0 : 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return image;
|
||||
}
|
||||
}
|
||||
|
||||
bool FirmwareInterface::hasSplash()
|
||||
{
|
||||
return (splashOffset > 0 ? true : false);
|
||||
}
|
||||
|
||||
bool FirmwareInterface::isValid()
|
||||
{
|
||||
return isValidFlag;
|
||||
}
|
||||
|
||||
unsigned int FirmwareInterface::save(QString fileName)
|
||||
{
|
||||
uint8_t binflash[MAX_FSIZE];
|
||||
memcpy(&binflash, flash.constData(), flashSize);
|
||||
QFile file(fileName);
|
||||
|
||||
int fileType = getFileType(fileName);
|
||||
|
||||
if (fileType == FILE_TYPE_HEX) {
|
||||
if (!file.open(QIODevice::ReadWrite | QIODevice::Truncate | QIODevice::Text)) { //reading HEX TEXT file
|
||||
return -1;
|
||||
}
|
||||
QTextStream outputStream(&file);
|
||||
HexInterface hex=HexInterface(outputStream);
|
||||
hex.save(binflash, flashSize);
|
||||
}
|
||||
else {
|
||||
if (!file.open(QIODevice::ReadWrite | QIODevice::Truncate)) { //reading HEX TEXT file
|
||||
return -1;
|
||||
}
|
||||
file.write((char*)binflash, flashSize);
|
||||
}
|
||||
|
||||
file.close();
|
||||
|
||||
return flashSize;
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
/*
|
||||
* Author - Romolo Manfredini <romolo.manfredini@gmail.com>
|
||||
*
|
||||
* 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 FIRMWAREINTERFACE_H_
|
||||
#define FIRMWAREINTERFACE_H_
|
||||
|
||||
#include <QString>
|
||||
#include <QImage>
|
||||
#include <QByteArray>
|
||||
|
||||
#define MAX_FSIZE (512*1024)
|
||||
#define SPLASH_WIDTH (128)
|
||||
#define SPLASH_HEIGHT (64)
|
||||
#define SPLASHX9D_WIDTH (212)
|
||||
#define SPLASHX9D_HEIGHT (64)
|
||||
#define SPLASH_SIZE_MAX (SPLASHX9D_WIDTH*SPLASHX9D_HEIGHT/2)
|
||||
#define ERSPLASH_MARKER "Splash"
|
||||
#define ERSPLASH_OFFSET (10)
|
||||
#define ERSKY9X_SPS "SPS"
|
||||
#define ERSKY9X_SPE "SPE"
|
||||
#define ERSKY9X_OFFSET (7)
|
||||
|
||||
#define FILE_TYPE_BIN 1
|
||||
#define FILE_TYPE_HEX 2
|
||||
#define FILE_TYPE_EEPE 3
|
||||
#define FILE_TYPE_EEPM 4
|
||||
#define FILE_TYPE_XML 5
|
||||
|
||||
int getFileType(const QString &fullFileName);
|
||||
|
||||
class FirmwareInterface
|
||||
{
|
||||
public:
|
||||
FirmwareInterface(const QString &filename);
|
||||
inline QString getDate() { return date; }
|
||||
inline QString getTime() { return time; }
|
||||
int getSize() { return flashSize; }
|
||||
QString getFlavour() const;
|
||||
bool isHardwareCompatible(const FirmwareInterface &previousFirmware) const;
|
||||
inline QString getVersion() { return version; }
|
||||
unsigned int getVersionId() { return versionId; }
|
||||
inline int getEEpromVersion() { return eepromVersion; }
|
||||
inline int getEEpromVariant() { return eepromVariant; }
|
||||
inline QString getEEpromId() { return eepromId; }
|
||||
QImage getSplash();
|
||||
bool setSplash(const QImage & newsplash);
|
||||
bool hasSplash();
|
||||
int getSplashWidth();
|
||||
uint getSplashHeight();
|
||||
QImage::Format getSplashFormat();
|
||||
unsigned int save(QString fileName);
|
||||
bool isValid();
|
||||
|
||||
private:
|
||||
QByteArray flash;
|
||||
uint flashSize;
|
||||
QString seekString(const QString & string);
|
||||
QString seekLabel(const QString & label);
|
||||
void SeekSplash();
|
||||
bool SeekSplash(QByteArray sps, QByteArray spe, int size);
|
||||
bool SeekSplash(QByteArray splash);
|
||||
QString filename;
|
||||
QString date;
|
||||
QString time;
|
||||
QString flavour;
|
||||
QString version;
|
||||
int versionId;
|
||||
QString eepromId;
|
||||
int eepromVersion;
|
||||
int eepromVariant;
|
||||
QByteArray splash;
|
||||
uint splashOffset;
|
||||
uint splashSize;
|
||||
uint splashWidth;
|
||||
uint splashHeight;
|
||||
QImage::Format splash_format;
|
||||
bool isValidFlag;
|
||||
};
|
||||
|
||||
#endif /* FIRMWAREINTERFACE_H_ */
|
||||
@@ -1,471 +0,0 @@
|
||||
#include <algorithm>
|
||||
#include "er9xeeprom.h"
|
||||
#include "helpers.h"
|
||||
#include <QObject>
|
||||
|
||||
RawSwitch er9xToSwitch(int8_t sw)
|
||||
{
|
||||
uint8_t swa = abs(sw);
|
||||
if (swa == 0)
|
||||
return RawSwitch(SWITCH_TYPE_NONE);
|
||||
else if (swa <= 9)
|
||||
return RawSwitch(SWITCH_TYPE_SWITCH, sw);
|
||||
else if (swa <= 21)
|
||||
return RawSwitch(SWITCH_TYPE_VIRTUAL, sw > 0 ? sw-9 : sw+9);
|
||||
else if (sw == 22)
|
||||
return RawSwitch(SWITCH_TYPE_ON);
|
||||
else if (sw == -22)
|
||||
return RawSwitch(SWITCH_TYPE_OFF);
|
||||
else if (swa <= 22+9)
|
||||
return RawSwitch(SWITCH_TYPE_SWITCH, sw > 0 ? sw-22 : sw+22);
|
||||
else
|
||||
return RawSwitch(SWITCH_TYPE_VIRTUAL, sw > 0 ? sw-22-9 : sw+22+9);
|
||||
}
|
||||
|
||||
t_Er9xTrainerMix::t_Er9xTrainerMix()
|
||||
{
|
||||
memset(this, 0, sizeof(t_Er9xTrainerMix));
|
||||
}
|
||||
|
||||
t_Er9xTrainerMix::operator TrainerMix()
|
||||
{
|
||||
TrainerMix c9x;
|
||||
c9x.src = srcChn;
|
||||
c9x.swtch = er9xToSwitch(swtch);
|
||||
c9x.weight = (25 * studWeight) / 8;
|
||||
c9x.mode = mode;
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Er9xTrainerData::t_Er9xTrainerData()
|
||||
{
|
||||
memset(this, 0, sizeof(t_Er9xTrainerData));
|
||||
}
|
||||
|
||||
t_Er9xTrainerData::operator TrainerData ()
|
||||
{
|
||||
TrainerData c9x;
|
||||
for (int i=0; i<NUM_STICKS; i++) {
|
||||
c9x.calib[i] = calib[i];
|
||||
c9x.mix[i] = mix[i];
|
||||
}
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Er9xGeneral::t_Er9xGeneral()
|
||||
{
|
||||
memset(this, 0, sizeof(t_Er9xGeneral));
|
||||
}
|
||||
|
||||
Er9xGeneral::operator GeneralSettings ()
|
||||
{
|
||||
GeneralSettings result;
|
||||
result.version = myVers;
|
||||
for (int i=0; i<NUM_STICKSnPOTS; i++) {
|
||||
result.calibMid[i] = calibMid[i];
|
||||
result.calibSpanNeg[i] = calibSpanNeg[i];
|
||||
result.calibSpanPos[i] = calibSpanPos[i];
|
||||
}
|
||||
|
||||
result.currModel = currModel;
|
||||
result.contrast = contrast;
|
||||
result.vBatWarn = vBatWarn;
|
||||
result.txVoltageCalibration = txVoltageCalibration;
|
||||
result.trainer = trainer;
|
||||
result.blightinv=blightinv;
|
||||
result.stickScroll=stickScroll;
|
||||
result.crosstrim=crosstrim;
|
||||
result.hideNameOnSplash=hideNameOnSplash;
|
||||
result.enablePpmsim=enablePpmsim;
|
||||
|
||||
result.view = std::min((uint8_t)4, view);
|
||||
result.disableThrottleWarning = disableThrottleWarning;
|
||||
result.switchWarning = disableSwitchWarning ? 0 : -1;
|
||||
result.disableMemoryWarning = disableMemoryWarning;
|
||||
|
||||
switch (beeperVal) {
|
||||
case 0:
|
||||
result.beeperMode = GeneralSettings::BEEPER_QUIET;
|
||||
break;
|
||||
case 1:
|
||||
result.beeperMode = GeneralSettings::BEEPER_NOKEYS;
|
||||
break;
|
||||
default:
|
||||
result.beeperMode = GeneralSettings::BEEPER_ALL;
|
||||
result.beeperLength = beeperVal - 4;
|
||||
break;
|
||||
}
|
||||
|
||||
result.disableAlarmWarning = disableAlarmWarning;
|
||||
result.stickMode = std::max((uint8_t)0, std::min(stickMode, (uint8_t)3));
|
||||
result.inactivityTimer = inactivityTimer + 10;
|
||||
result.minuteBeep = minuteBeep;
|
||||
result.preBeep = preBeep;
|
||||
result.flashBeep = flashBeep;
|
||||
result.splashMode = disableSplashScreen;
|
||||
result.disablePotScroll=(disablePotScroll==1);
|
||||
result.disableBG=(disableBG==1);
|
||||
result.frskyinternalalarm = frskyinternalalarm;
|
||||
|
||||
result.backlightMode = 0;
|
||||
if (lightSw == 22) {
|
||||
result.backlightMode = 4;
|
||||
}
|
||||
else if (lightAutoOff) {
|
||||
result.backlightMode |= 1;
|
||||
result.backlightDelay = lightAutoOff;
|
||||
}
|
||||
else if (lightOnStickMove) {
|
||||
result.backlightMode |= 2;
|
||||
result.backlightDelay = lightOnStickMove;
|
||||
}
|
||||
|
||||
result.templateSetup = templateSetup;
|
||||
result.PPM_Multiplier = PPM_Multiplier;
|
||||
getEEPROMString(result.ownerName, ownerName, sizeof(ownerName));
|
||||
result.speakerPitch = speakerPitch;
|
||||
result.hapticStrength = hapticStrength - 3;
|
||||
result.speakerMode = speakerMode;
|
||||
result.switchWarningStates =switchWarningStates;
|
||||
return result;
|
||||
}
|
||||
|
||||
t_Er9xLimitData::t_Er9xLimitData()
|
||||
{
|
||||
memset(this, 0, sizeof(t_Er9xLimitData));
|
||||
}
|
||||
|
||||
t_Er9xLimitData::operator LimitData ()
|
||||
{
|
||||
LimitData c9x;
|
||||
c9x.min = 10*(min-100);
|
||||
c9x.max = 10*(max+100);
|
||||
c9x.revert = revert;
|
||||
c9x.offset = offset;
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Er9xMixData::t_Er9xMixData()
|
||||
{
|
||||
memset(this, 0, sizeof(t_Er9xMixData));
|
||||
}
|
||||
|
||||
t_Er9xMixData::operator MixData ()
|
||||
{
|
||||
MixData c9x;
|
||||
c9x.destCh = destCh;
|
||||
if (abs(weight)>125) {
|
||||
int gvar;
|
||||
if (weight>0) {
|
||||
gvar=weight-125;
|
||||
} else {
|
||||
gvar=weight+131;
|
||||
}
|
||||
gvar+=10000;
|
||||
c9x.weight=gvar;
|
||||
} else {
|
||||
c9x.weight = weight;
|
||||
}
|
||||
if (abs(sOffset)>125) {
|
||||
int gvar;
|
||||
if (sOffset>0) {
|
||||
gvar=sOffset-125;
|
||||
} else {
|
||||
gvar=sOffset+131;
|
||||
}
|
||||
gvar+=10000;
|
||||
c9x.sOffset=gvar;
|
||||
} else {
|
||||
c9x.sOffset=sOffset;
|
||||
}
|
||||
c9x.swtch = er9xToSwitch(swtch);
|
||||
|
||||
if (srcRaw == 0) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_NONE);
|
||||
}
|
||||
else if (srcRaw <= 7) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_STICK, srcRaw-1);
|
||||
}
|
||||
else if (srcRaw == 8) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_MAX);
|
||||
}
|
||||
else if (srcRaw == 9) {
|
||||
if (swtch < 0) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_SWITCH, swtch < -3 ? -swtch-3 : -swtch);
|
||||
c9x.weight = -weight;
|
||||
}
|
||||
else if (swtch > 0) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_SWITCH, swtch > 3 ? swtch-3 : swtch);
|
||||
}
|
||||
else {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_MAX);
|
||||
}
|
||||
if (mltpx != MLTPX_REP)
|
||||
c9x.swtch = RawSwitch(SWITCH_TYPE_NONE);
|
||||
}
|
||||
else if (srcRaw <= 12) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_CYC, srcRaw-10);
|
||||
}
|
||||
else if (srcRaw <= 20) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_PPM, srcRaw-13);
|
||||
}
|
||||
else if (srcRaw <=37) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-21);
|
||||
}
|
||||
else {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_GVAR, srcRaw-38);
|
||||
}
|
||||
|
||||
if (differential==1) {
|
||||
c9x.curve.type = CurveReference::CURVE_REF_DIFF;
|
||||
c9x.curve.value = differential;
|
||||
}
|
||||
else if (curve > 6) {
|
||||
c9x.curve.type = CurveReference::CURVE_REF_CUSTOM;
|
||||
c9x.curve.value = curve - 6;
|
||||
}
|
||||
else if (curve > 0) {
|
||||
c9x.curve.type = CurveReference::CURVE_REF_FUNC;
|
||||
c9x.curve.value = curve;
|
||||
}
|
||||
|
||||
// c9x.lateOffset=lateOffset;
|
||||
c9x.delayUp = delayUp;
|
||||
c9x.delayDown = delayDown;
|
||||
c9x.speedUp = speedUp;
|
||||
c9x.speedDown = speedDown;
|
||||
c9x.carryTrim = carryTrim;
|
||||
c9x.mltpx = (MltpxValue)mltpx;
|
||||
c9x.mixWarn = mixWarn;
|
||||
// c9x.enableFmTrim=enableFmTrim;
|
||||
return c9x;
|
||||
}
|
||||
|
||||
RawSource er9xToSource(int8_t value)
|
||||
{
|
||||
if (value == 0) {
|
||||
return RawSource(SOURCE_TYPE_NONE);
|
||||
}
|
||||
else if (value <= 7) {
|
||||
return RawSource(SOURCE_TYPE_STICK, value - 1);
|
||||
}
|
||||
else if (value == 8) {
|
||||
return RawSource(SOURCE_TYPE_MAX);
|
||||
}
|
||||
else if (value == 9) {
|
||||
return RawSource(SOURCE_TYPE_MAX);
|
||||
}
|
||||
else if (value <= 12) {
|
||||
return RawSource(SOURCE_TYPE_CYC, value-10);
|
||||
}
|
||||
else if (value <= 20) {
|
||||
return RawSource(SOURCE_TYPE_PPM, value-13);
|
||||
}
|
||||
else if (value <= 36) {
|
||||
return RawSource(SOURCE_TYPE_CH, value-21);
|
||||
}
|
||||
else {
|
||||
return RawSource(SOURCE_TYPE_TELEMETRY, value-36);
|
||||
}
|
||||
}
|
||||
|
||||
Er9xLogicalSwitchData::operator LogicalSwitchData ()
|
||||
{
|
||||
LogicalSwitchData c9x;
|
||||
c9x.func = func;
|
||||
c9x.val1 = v1;
|
||||
c9x.val2 = v2;
|
||||
|
||||
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val1 = er9xToSource(v1).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val2 = er9xToSource(v2).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
|
||||
c9x.val1 = er9xToSwitch(v1).toValue();
|
||||
c9x.val2 = er9xToSwitch(v2).toValue();
|
||||
}
|
||||
|
||||
return c9x;
|
||||
}
|
||||
|
||||
|
||||
t_Er9xSafetySwData::t_Er9xSafetySwData()
|
||||
{
|
||||
memset(this, 0, sizeof(t_Er9xSafetySwData));
|
||||
}
|
||||
|
||||
t_Er9xFrSkyChannelData::t_Er9xFrSkyChannelData()
|
||||
{
|
||||
memset(this, 0, sizeof(t_Er9xFrSkyChannelData));
|
||||
}
|
||||
|
||||
t_Er9xFrSkyChannelData::operator FrSkyChannelData ()
|
||||
{
|
||||
FrSkyChannelData c9x;
|
||||
c9x.ratio = ratio;
|
||||
c9x.alarms[0].value = alarms_value[0];
|
||||
c9x.alarms[0].level = alarms_level & 3;
|
||||
c9x.alarms[0].greater = alarms_greater & 1;
|
||||
c9x.alarms[1].value = alarms_value[1];
|
||||
c9x.alarms[1].level = (alarms_level >> 2) & 3;
|
||||
c9x.alarms[1].greater = (alarms_greater >> 1) & 1;
|
||||
if (type==2) {
|
||||
c9x.type = 0;
|
||||
c9x.multiplier=1;
|
||||
} else {
|
||||
c9x.type = type;
|
||||
}
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Er9xFrSkyData::t_Er9xFrSkyData()
|
||||
{
|
||||
memset(this, 0, sizeof(t_Er9xFrSkyData));
|
||||
}
|
||||
|
||||
t_Er9xFrSkyData::operator FrSkyData ()
|
||||
{
|
||||
FrSkyData c9x;
|
||||
c9x.channels[0] = channels[0];
|
||||
c9x.channels[1] = channels[1];
|
||||
return c9x;
|
||||
}
|
||||
|
||||
RawSwitch getEr9xTimerMode(int mode)
|
||||
{
|
||||
/*
|
||||
if (mode <= -33)
|
||||
return TimerMode(TMRMODE_FIRST_NEG_SWITCH+(mode+33));
|
||||
else if (mode <= -1)
|
||||
return TimerMode(TMRMODE_FIRST_NEG_SWITCH+(mode+1));
|
||||
else if (mode < 16)
|
||||
return TimerMode(mode);
|
||||
else if (mode < 16+21)
|
||||
return TimerMode(TMRMODE_FIRST_SWITCH+(mode-16));
|
||||
else
|
||||
return TimerMode(TMRMODE_FIRST_SWITCH+(mode-16-21));
|
||||
*/
|
||||
return RawSwitch();
|
||||
}
|
||||
|
||||
t_Er9xModelData::operator ModelData ()
|
||||
{
|
||||
ModelData c9x;
|
||||
c9x.used = true;
|
||||
getEEPROMString(c9x.name, name, sizeof(name));
|
||||
c9x.timers[0].mode = getEr9xTimerMode(tmrMode);
|
||||
c9x.timers[0].val = tmrVal;
|
||||
switch(protocol) {
|
||||
case 1:
|
||||
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
|
||||
break;
|
||||
case 2:
|
||||
c9x.moduleData[0].protocol = PULSES_DSM2;
|
||||
break;
|
||||
case 3:
|
||||
c9x.moduleData[0].protocol = PULSES_PPM16;
|
||||
break;
|
||||
default:
|
||||
c9x.moduleData[0].protocol = PULSES_PPM;
|
||||
break;
|
||||
}
|
||||
c9x.moduleData[0].ppmFrameLength=ppmFrameLength;
|
||||
c9x.moduleData[0].channelsCount = 8 + 2 * ppmNCH;
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.trimInc = trimInc-2;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.customFn[0].func = FuncInstantTrim;
|
||||
if (trimSw) {
|
||||
c9x.customFn[0].swtch = er9xToSwitch(trimSw);
|
||||
}
|
||||
c9x.beepANACenter = beepANACenter;
|
||||
c9x.moduleData[0].ppmPulsePol = pulsePol;
|
||||
c9x.extendedLimits = extendedLimits;
|
||||
c9x.swashRingData.elevatorWeight = swashInvertELE ? -100 : 100;
|
||||
c9x.swashRingData.aileronWeight = swashInvertAIL ? -100 : 100;
|
||||
c9x.swashRingData.collectiveWeight = swashInvertCOL ? -100 : 100;
|
||||
c9x.swashRingData.type = swashType;
|
||||
c9x.swashRingData.collectiveSource = er9xToSource(swashCollectiveSource);
|
||||
c9x.swashRingData.value = swashRingValue;
|
||||
|
||||
for (int i=0; i<ER9X_MAX_MIXERS; i++) {
|
||||
Er9xMixData mix = mixData[i];
|
||||
c9x.mixData[i] = mix;
|
||||
}
|
||||
|
||||
for (int i=0; i<ER9X_NUM_CHNOUT; i++)
|
||||
c9x.limitData[i] = limitData[i];
|
||||
|
||||
// expoData
|
||||
int e = 0;
|
||||
for (int ch = 0; ch < 4 && e < C9X_MAX_EXPOS; ch++) {
|
||||
for (int dr = 0, pos = 0; dr < 3 && e < C9X_MAX_EXPOS; dr++, pos++) {
|
||||
if ((dr == 0 && !expoData[ch].drSw1) || (dr == 1 && !expoData[ch].drSw2))
|
||||
dr = 2;
|
||||
if (dr == 2 && !expoData[ch].expo[0][0][0] && !expoData[ch].expo[0][0][1] && !expoData[ch].expo[0][1][0] && !expoData[ch].expo[0][1][1])
|
||||
break;
|
||||
if (expoData[ch].drSw1 && !expoData[ch].drSw2) {
|
||||
c9x.expoData[e].swtch = er9xToSwitch(dr == 0 ? expoData[ch].drSw1 : 0);
|
||||
pos = dr == 0 ? 1 : 0;
|
||||
}
|
||||
else {
|
||||
c9x.expoData[e].swtch = er9xToSwitch(dr == 0 ? -expoData[ch].drSw1 : (dr == 1 ? -expoData[ch].drSw2 : 0));
|
||||
}
|
||||
c9x.expoData[e].chn = ch;
|
||||
if (expoData[ch].expo[pos][0][0]) {
|
||||
c9x.expoData[e].curve.type = CurveReference::CURVE_REF_EXPO;
|
||||
c9x.expoData[e].curve.value = expoData[ch].expo[pos][0][0];
|
||||
}
|
||||
c9x.expoData[e].weight = 100 + expoData[ch].expo[pos][1][0];
|
||||
if (expoData[ch].expo[pos][0][0] == expoData[ch].expo[pos][0][1] && expoData[ch].expo[pos][1][0] == expoData[ch].expo[pos][1][1]) {
|
||||
c9x.expoData[e++].mode = 3;
|
||||
}
|
||||
else {
|
||||
c9x.expoData[e].mode = 2;
|
||||
if (e < C9X_MAX_EXPOS - 1) {
|
||||
c9x.expoData[e + 1].swtch = c9x.expoData[e].swtch;
|
||||
c9x.expoData[++e].chn = ch;
|
||||
c9x.expoData[e].mode = 1;
|
||||
if (expoData[ch].expo[pos][0][1]) {
|
||||
c9x.expoData[e].curve.type = CurveReference::CURVE_REF_EXPO;
|
||||
c9x.expoData[e].curve.value = expoData[ch].expo[pos][0][1];
|
||||
}
|
||||
c9x.expoData[e++].weight = 100 + expoData[ch].expo[pos][1][1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=0; i<NUM_STICKS; i++)
|
||||
c9x.flightModeData[0].trim[i] = trim[i];
|
||||
|
||||
for (int i=0; i<ER9X_MAX_CURVE5; i++) {
|
||||
c9x.curves[i].count = 5;
|
||||
for (int j = 0; j < 5; j++) {
|
||||
c9x.curves[i].points[j].x = -100 + 50 * i;
|
||||
c9x.curves[i].points[j].y = curves5[i][j];
|
||||
}
|
||||
}
|
||||
for (int i=0; i<ER9X_MAX_CURVE9; i++) {
|
||||
c9x.curves[ER9X_MAX_CURVE5 + i].count = 9;
|
||||
for (int j = 0; j < 9; j++) {
|
||||
c9x.curves[ER9X_MAX_CURVE5 + i].points[j].x = -100 + 25 * i;
|
||||
c9x.curves[ER9X_MAX_CURVE5 + i].points[j].y = curves9[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=0; i<ER9X_NUM_CSW; i++)
|
||||
c9x.logicalSw[i] = logicalSw[i];
|
||||
|
||||
// for (int i=0; i<ER9X_NUM_CHNOUT; i++)
|
||||
// c9x.safetySw[i] = safetySw[i];
|
||||
|
||||
c9x.frsky = frsky;
|
||||
c9x.frsky.usrProto=FrSkyUsrProto;
|
||||
return c9x;
|
||||
}
|
||||
|
||||
@@ -1,260 +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 er9xeeprom_h
|
||||
#define er9xeeprom_h
|
||||
|
||||
#include <inttypes.h>
|
||||
#include "eeprominterface.h"
|
||||
|
||||
//eeprom data
|
||||
#define ER9X_MAX_MIXERS 32
|
||||
#define ER9X_MAX_CURVE5 8
|
||||
#define ER9X_MAX_CURVE9 8
|
||||
#define ER9X_MAX_CSFUNC 13
|
||||
|
||||
#define MDVERS 10
|
||||
|
||||
#define ER9X_NUM_CHNOUT 16 //number of real outputchannels CH1-CH8
|
||||
#define ER9X_NUM_CSW 12 //number of custom switches
|
||||
#define NUM_STICKSnPOTS 7 //number of sticks and pots
|
||||
#define ER9X_MAX_GVARS 7
|
||||
|
||||
#define ER9X_MAX_MODES 4
|
||||
|
||||
PACK(typedef struct t_Er9xTrainerMix {
|
||||
uint8_t srcChn:3; //0-7 = ch1-8
|
||||
int8_t swtch:5;
|
||||
int8_t studWeight:6;
|
||||
uint8_t mode:2; // off, add-mode, subst-mode
|
||||
|
||||
operator TrainerMix();
|
||||
t_Er9xTrainerMix();
|
||||
}) Er9xTrainerMix; //
|
||||
|
||||
PACK(typedef struct t_Er9xTrainerData {
|
||||
int16_t calib[4];
|
||||
Er9xTrainerMix mix[4];
|
||||
|
||||
operator TrainerData();
|
||||
t_Er9xTrainerData();
|
||||
}) Er9xTrainerData;
|
||||
|
||||
PACK(typedef struct t_Er9xGeneral {
|
||||
uint8_t myVers;
|
||||
int16_t calibMid[NUM_STICKSnPOTS];
|
||||
int16_t calibSpanNeg[NUM_STICKSnPOTS];
|
||||
int16_t calibSpanPos[NUM_STICKSnPOTS];
|
||||
uint16_t chkSum;
|
||||
uint8_t currModel; //0..15
|
||||
uint8_t contrast;
|
||||
uint8_t vBatWarn;
|
||||
int8_t txVoltageCalibration;
|
||||
int8_t lightSw;
|
||||
Er9xTrainerData trainer;
|
||||
uint8_t view;
|
||||
uint8_t disableThrottleWarning:1;
|
||||
uint8_t disableSwitchWarning:1;
|
||||
uint8_t disableMemoryWarning:1;
|
||||
uint8_t beeperVal:3;
|
||||
uint8_t reserveWarning:1;
|
||||
uint8_t disableAlarmWarning:1;
|
||||
uint8_t stickMode;
|
||||
int8_t inactivityTimer;
|
||||
uint8_t throttleReversed:1;
|
||||
uint8_t minuteBeep:1;
|
||||
uint8_t preBeep:1;
|
||||
uint8_t flashBeep:1;
|
||||
uint8_t disableSplashScreen:1;
|
||||
uint8_t disablePotScroll:1;
|
||||
uint8_t disableBG:1;
|
||||
uint8_t frskyinternalalarm:1;
|
||||
uint8_t spare_filter ; // No longer needed, left for eepe compatibility for now
|
||||
uint8_t lightAutoOff;
|
||||
uint8_t templateSetup; //RETA order according to chout_ar array
|
||||
int8_t PPM_Multiplier;
|
||||
uint8_t unused1;
|
||||
uint8_t unused2:4;
|
||||
uint8_t hideNameOnSplash:1;
|
||||
uint8_t enablePpmsim:1;
|
||||
uint8_t blightinv:1;
|
||||
uint8_t stickScroll:1;
|
||||
uint8_t speakerPitch;
|
||||
uint8_t hapticStrength;
|
||||
uint8_t speakerMode;
|
||||
uint8_t lightOnStickMove;
|
||||
|
||||
char ownerName[10];
|
||||
uint8_t switchWarningStates;
|
||||
uint8_t volume ;
|
||||
uint8_t res[3];
|
||||
uint8_t crosstrim:1;
|
||||
uint8_t spare1:7;
|
||||
|
||||
operator GeneralSettings();
|
||||
t_Er9xGeneral();
|
||||
}) Er9xGeneral;
|
||||
|
||||
PACK(typedef struct t_Er9xExpoData {
|
||||
int8_t expo[3][2][2];
|
||||
int8_t drSw1;
|
||||
int8_t drSw2;
|
||||
|
||||
t_Er9xExpoData() { memset(this, 0, sizeof(t_Er9xExpoData)); }
|
||||
}) Er9xExpoData;
|
||||
|
||||
|
||||
PACK(typedef struct t_Er9xLimitData {
|
||||
int8_t min;
|
||||
int8_t max;
|
||||
bool revert;
|
||||
int16_t offset;
|
||||
|
||||
operator LimitData();
|
||||
t_Er9xLimitData();
|
||||
}) Er9xLimitData;
|
||||
|
||||
#define MLTPX_ADD 0
|
||||
#define MLTPX_MUL 1
|
||||
#define MLTPX_REP 2
|
||||
|
||||
PACK(typedef struct t_Er9xMixData {
|
||||
uint8_t destCh; // 1..C9X_NUM_CHNOUT
|
||||
uint8_t srcRaw; //
|
||||
int8_t weight;
|
||||
int8_t swtch;
|
||||
uint8_t curve; //0=symmetrisch 1=no neg 2=no pos
|
||||
uint8_t delayUp:4;
|
||||
uint8_t delayDown:4;
|
||||
uint8_t speedUp:4; // Servogeschwindigkeit aus Tabelle (10ms Cycle)
|
||||
uint8_t speedDown:4; // 0 nichts
|
||||
uint8_t carryTrim:1;
|
||||
uint8_t mltpx:2; // multiplex method 0=+ 1=* 2=replace
|
||||
uint8_t lateOffset:1; // Add offset later
|
||||
uint8_t mixWarn:2; // mixer warning
|
||||
uint8_t enableFmTrim:1;
|
||||
uint8_t differential:1;
|
||||
int8_t sOffset;
|
||||
int8_t res;
|
||||
|
||||
operator MixData();
|
||||
t_Er9xMixData();
|
||||
}) Er9xMixData;
|
||||
|
||||
|
||||
PACK(typedef struct t_Er9xLogicalSwitchData { // Custom Switches data
|
||||
int8_t v1; //input
|
||||
int8_t v2; //offset
|
||||
uint8_t func:4;
|
||||
uint8_t andsw:4;
|
||||
|
||||
operator LogicalSwitchData();
|
||||
t_Er9xLogicalSwitchData() { memset(this, 0, sizeof(t_Er9xLogicalSwitchData)); }
|
||||
}) Er9xLogicalSwitchData;
|
||||
|
||||
PACK(typedef struct t_Er9xSafetySwData { // Custom Switches data
|
||||
int8_t swtch;
|
||||
int8_t val;
|
||||
|
||||
t_Er9xSafetySwData();
|
||||
}) Er9xSafetySwData;
|
||||
|
||||
PACK(typedef struct t_Er9xFrSkyChannelData {
|
||||
uint8_t ratio; // 0.0 means not used, 0.1V steps EG. 6.6 Volts = 66. 25.1V = 251, etc.
|
||||
uint8_t alarms_value[2]; // 0.1V steps EG. 6.6 Volts = 66. 25.1V = 251, etc.
|
||||
uint8_t alarms_level:4;
|
||||
uint8_t alarms_greater:2; // 0=LT(<), 1=GT(>)
|
||||
uint8_t type:2; // future use: 0=volts, ...
|
||||
|
||||
operator FrSkyChannelData();
|
||||
t_Er9xFrSkyChannelData();
|
||||
}) Er9xFrSkyChannelData;
|
||||
|
||||
PACK(typedef struct t_Er9xFrSkyData {
|
||||
Er9xFrSkyChannelData channels[2];
|
||||
|
||||
operator FrSkyData();
|
||||
t_Er9xFrSkyData();
|
||||
}) Er9xFrSkyData;
|
||||
|
||||
PACK(typedef struct t_gvar {
|
||||
int8_t gvar ;
|
||||
uint8_t gvsource ;
|
||||
// int8_t gvswitch ;
|
||||
}) Er9xGvarData ;
|
||||
|
||||
PACK(typedef struct t_FlightModeData {
|
||||
// Trim store as -1001 to -1, trim value-501, 0-5 use trim of phase 0-5
|
||||
int16_t trim[4]; // -500..500 => trim value, 501 => use trim of phase 0, 502, 503, 504 => use trim of modes 1|2|3|4 instead
|
||||
int8_t swtch; // Try 0-5 use trim of phase 0-5, 1000-2000, trim + 1500 ???
|
||||
uint8_t fadeIn:4;
|
||||
uint8_t fadeOut:4;
|
||||
}) Er9xFlightModeData;
|
||||
|
||||
PACK(typedef struct t_Er9xModelData {
|
||||
char name[10]; // 10 must be first for eeLoadModelName
|
||||
uint8_t modelVoice ; // Index to model name voice (260+value)
|
||||
int8_t tmrMode; // timer trigger source -> off, abs, stk, stk%, sw/!sw, !m_sw/!m_sw
|
||||
uint8_t tmrDir:1; //0=>Count Down, 1=>Count Up
|
||||
uint8_t traineron:1; // 0 disable trainer, 1 allow trainer
|
||||
uint8_t t2throttle:1 ; // Start timer2 using throttle
|
||||
uint8_t FrSkyUsrProto:1 ; // Protocol in FrSky User Data, 0=FrSky Hub, 1=WS HowHigh
|
||||
uint8_t FrSkyGpsAlt:1 ; // Use Gps Altitude as main altitude reading
|
||||
uint8_t FrSkyImperial:1 ; // Convert FrSky values to imperial units
|
||||
uint8_t FrSkyAltAlarm:2;
|
||||
uint16_t tmrVal;
|
||||
uint8_t protocol;
|
||||
int8_t ppmNCH;
|
||||
uint8_t thrTrim:1; // Enable Throttle Trim
|
||||
uint8_t xnumBlades:2; // RPM scaling
|
||||
uint8_t spare10:1;
|
||||
uint8_t thrExpo:1; // Enable Throttle Expo
|
||||
uint8_t ppmStart:3 ; // Start channel for PPM
|
||||
int8_t trimInc; // Trim Increments
|
||||
int8_t ppmDelay;
|
||||
int8_t trimSw;
|
||||
uint8_t beepANACenter; // 1<<0->A1.. 1<<6->A7
|
||||
uint8_t pulsePol:1;
|
||||
uint8_t extendedLimits:1;
|
||||
uint8_t swashInvertELE:1;
|
||||
uint8_t swashInvertAIL:1;
|
||||
uint8_t swashInvertCOL:1;
|
||||
uint8_t swashType:3;
|
||||
uint8_t swashCollectiveSource;
|
||||
uint8_t swashRingValue;
|
||||
int8_t ppmFrameLength;
|
||||
Er9xMixData mixData[ER9X_MAX_MIXERS];
|
||||
Er9xLimitData limitData[ER9X_NUM_CHNOUT];
|
||||
Er9xExpoData expoData[4];
|
||||
int8_t trim[4];
|
||||
int8_t curves5[ER9X_MAX_CURVE5][5];
|
||||
int8_t curves9[ER9X_MAX_CURVE9][9];
|
||||
Er9xLogicalSwitchData logicalSw[ER9X_NUM_CSW];
|
||||
uint8_t frSkyVoltThreshold ;
|
||||
int8_t tmrModeB;
|
||||
uint8_t numVoice;
|
||||
Er9xSafetySwData safetySw[ER9X_NUM_CHNOUT];
|
||||
Er9xFrSkyData frsky;
|
||||
uint8_t numBlades ;
|
||||
uint8_t unused1[8] ;
|
||||
uint8_t CustomDisplayIndex[6] ;
|
||||
Er9xGvarData gvars[ER9X_MAX_GVARS] ;
|
||||
Er9xFlightModeData flightModeData[ER9X_MAX_MODES] ;
|
||||
|
||||
operator ModelData();
|
||||
t_Er9xModelData() { memset(this, 0, sizeof(t_Er9xModelData)); }
|
||||
}) Er9xModelData;
|
||||
|
||||
#endif
|
||||
@@ -1,338 +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 <iostream>
|
||||
#include "er9xinterface.h"
|
||||
#include "er9xeeprom.h"
|
||||
#include "simulator/er9xsimulator.h"
|
||||
#include "file.h"
|
||||
#include "appdata.h"
|
||||
|
||||
#define FILE_TYP_GENERAL 1
|
||||
#define FILE_TYP_MODEL 2
|
||||
|
||||
#define FILE_GENERAL 0
|
||||
#define FILE_MODEL(n) (1+n)
|
||||
|
||||
Er9xInterface::Er9xInterface():
|
||||
EEPROMInterface(BOARD_STOCK),
|
||||
efile(new RleFile())
|
||||
{
|
||||
}
|
||||
|
||||
Er9xInterface::~Er9xInterface()
|
||||
{
|
||||
delete efile;
|
||||
}
|
||||
|
||||
const char * Er9xInterface::getName()
|
||||
{
|
||||
return "Er9x";
|
||||
}
|
||||
|
||||
const int Er9xInterface::getEEpromSize()
|
||||
{
|
||||
QString avrMCU = g.mcu();
|
||||
if (avrMCU==QString("m128")) {
|
||||
return 2*EESIZE_STOCK;
|
||||
}
|
||||
return EESIZE_STOCK;
|
||||
}
|
||||
|
||||
const int Er9xInterface::getMaxModels()
|
||||
{
|
||||
return 16;
|
||||
}
|
||||
|
||||
inline void applyStickModeToModel(Er9xModelData & model, unsigned int mode)
|
||||
{
|
||||
for (int i=0; i<2; i++) {
|
||||
int stick = applyStickMode(i+1, mode) - 1;
|
||||
{
|
||||
int tmp = model.trim[i];
|
||||
model.trim[i] = model.trim[stick];
|
||||
model.trim[stick] = tmp;
|
||||
}
|
||||
{
|
||||
Er9xExpoData tmp = model.expoData[i];
|
||||
model.expoData[i] = model.expoData[stick];
|
||||
model.expoData[stick] = tmp;
|
||||
}
|
||||
}
|
||||
for (int i=0; i<ER9X_MAX_MIXERS; i++)
|
||||
model.mixData[i].srcRaw = applyStickMode(model.mixData[i].srcRaw, mode);
|
||||
for (int i=0; i<ER9X_NUM_CSW; i++) {
|
||||
switch (LogicalSwitchData(model.logicalSw[i].func).getFunctionFamily()) {
|
||||
case LS_FAMILY_VCOMP:
|
||||
model.logicalSw[i].v2 = applyStickMode(model.logicalSw[i].v2, mode);
|
||||
// no break
|
||||
case LS_FAMILY_VOFS:
|
||||
model.logicalSw[i].v1 = applyStickMode(model.logicalSw[i].v1, mode);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
model.swashCollectiveSource = applyStickMode(model.swashCollectiveSource, mode);
|
||||
}
|
||||
|
||||
unsigned long Er9xInterface::loadxml(RadioData &radioData, QDomDocument &doc)
|
||||
{
|
||||
std::cout << "trying er9x xml import... ";
|
||||
|
||||
std::bitset<NUM_ERRORS> errors;
|
||||
|
||||
Er9xGeneral er9xGeneral;
|
||||
memset(&er9xGeneral,0,sizeof(er9xGeneral));
|
||||
if(!loadGeneralDataXML(&doc, &er9xGeneral)) {
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
} else {
|
||||
radioData.generalSettings=er9xGeneral;
|
||||
std::cout << "version " << (unsigned int)er9xGeneral.myVers << " ";
|
||||
}
|
||||
for(int i=0; i<getMaxModels(); i++)
|
||||
{
|
||||
Er9xModelData er9xModel;
|
||||
memset(&er9xModel,0,sizeof(er9xModel));
|
||||
if(loadModelDataXML(&doc, &er9xModel, i)) {
|
||||
applyStickModeToModel(er9xModel, radioData.generalSettings.stickMode+1);
|
||||
radioData.models[i] = er9xModel;
|
||||
}
|
||||
}
|
||||
std::cout << "ok\n";
|
||||
errors.set(NO_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
unsigned long Er9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
|
||||
{
|
||||
std::cout << "trying er9x import... ";
|
||||
|
||||
std::bitset<NUM_ERRORS> errors;
|
||||
|
||||
if (size != getEEpromSize()) {
|
||||
std::cout << "wrong size\n";
|
||||
errors.set(WRONG_SIZE);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
if (!efile->EeFsOpen((uint8_t *)eeprom, size, BOARD_STOCK)) {
|
||||
std::cout << "wrong file system\n";
|
||||
errors.set(WRONG_FILE_SYSTEM);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
efile->openRd(FILE_GENERAL);
|
||||
Er9xGeneral er9xGeneral;
|
||||
|
||||
if (efile->readRlc1((uint8_t*)&er9xGeneral, 1) != 1) {
|
||||
std::cout << "no\n";
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
std::cout << "version " << (unsigned int)er9xGeneral.myVers << " ";
|
||||
|
||||
switch(er9xGeneral.myVers) {
|
||||
case 3:
|
||||
std::cout << "(old gruvin9x) ";
|
||||
case 4:
|
||||
// case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
case 10:
|
||||
break;
|
||||
default:
|
||||
std::cout << "not er9x\n";
|
||||
errors.set(NOT_ER9X);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
efile->openRd(FILE_GENERAL);
|
||||
if (!efile->readRlc1((uint8_t*)&er9xGeneral, sizeof(Er9xGeneral))) {
|
||||
std::cout << "ko\n";
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
|
||||
}
|
||||
radioData.generalSettings = er9xGeneral;
|
||||
|
||||
for (int i=0; i<getMaxModels(); i++) {
|
||||
Er9xModelData er9xModel;
|
||||
efile->openRd(FILE_MODEL(i));
|
||||
if (!efile->readRlc1((uint8_t*)&er9xModel, sizeof(Er9xModelData))) {
|
||||
radioData.models[i].clear();
|
||||
}
|
||||
else {
|
||||
applyStickModeToModel(er9xModel, radioData.generalSettings.stickMode+1);
|
||||
radioData.models[i] = er9xModel;
|
||||
}
|
||||
}
|
||||
|
||||
std::cout << "ok\n";
|
||||
errors.set(NO_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
unsigned long Er9xInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index)
|
||||
{
|
||||
std::bitset<NUM_ERRORS> errors;
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
int Er9xInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t variant, uint8_t version)
|
||||
{
|
||||
std::cout << "NO!\n";
|
||||
// TODO an error
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Er9xInterface::getSize(const ModelData &model)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Er9xInterface::getSize(const GeneralSettings &settings)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Er9xInterface::isAvailable(PulsesProtocol prot, int port)
|
||||
{
|
||||
switch (prot) {
|
||||
case PULSES_PPM:
|
||||
case PULSES_DSM2:
|
||||
case PULSES_PXX_DJT:
|
||||
case PULSES_PPM16:
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void Er9xInterface::appendTextElement(QDomDocument * qdoc, QDomElement * pe, QString name, QString value)
|
||||
{
|
||||
QDomElement e = qdoc->createElement(name);
|
||||
QDomText t = qdoc->createTextNode(name);
|
||||
t.setNodeValue(value);
|
||||
e.appendChild(t);
|
||||
pe->appendChild(e);
|
||||
}
|
||||
|
||||
void Er9xInterface::appendNumberElement(QDomDocument * qdoc, QDomElement * pe,QString name, int value, bool forceZeroWrite)
|
||||
{
|
||||
if(value || forceZeroWrite) {
|
||||
QDomElement e = qdoc->createElement(name);
|
||||
QDomText t = qdoc->createTextNode(name);
|
||||
t.setNodeValue(QString("%1").arg(value));
|
||||
e.appendChild(t);
|
||||
pe->appendChild(e);
|
||||
}
|
||||
}
|
||||
|
||||
void Er9xInterface::appendCDATAElement(QDomDocument * qdoc, QDomElement * pe,QString name, const char * data, int size)
|
||||
{
|
||||
QDomElement e = qdoc->createElement(name);
|
||||
QDomCDATASection t = qdoc->createCDATASection(name);
|
||||
t.setData(QByteArray(data, size).toBase64());
|
||||
e.appendChild(t);
|
||||
pe->appendChild(e);
|
||||
}
|
||||
|
||||
QDomElement Er9xInterface::getGeneralDataXML(QDomDocument * qdoc, Er9xGeneral * tgen)
|
||||
{
|
||||
QDomElement gd = qdoc->createElement("GENERAL_DATA");
|
||||
appendNumberElement(qdoc, &gd, "Version", tgen->myVers, true); // have to write value here
|
||||
appendTextElement(qdoc, &gd, "Owner", QString::fromAscii(tgen->ownerName,sizeof(tgen->ownerName)).trimmed());
|
||||
appendCDATAElement(qdoc, &gd, "Data", (const char *)tgen,sizeof(Er9xGeneral));
|
||||
return gd;
|
||||
}
|
||||
|
||||
QDomElement Er9xInterface::getModelDataXML(QDomDocument * qdoc, Er9xModelData * tmod, int modelNum, int mdver)
|
||||
{
|
||||
QDomElement md = qdoc->createElement("MODEL_DATA");
|
||||
md.setAttribute("number", modelNum);
|
||||
appendNumberElement(qdoc, &md, "Version", mdver, true); // have to write value here
|
||||
appendTextElement(qdoc, &md, "Name", QString::fromAscii(tmod->name,sizeof(tmod->name)).trimmed());
|
||||
appendCDATAElement(qdoc, &md, "Data", (const char *)tmod,sizeof(Er9xModelData));
|
||||
return md;
|
||||
}
|
||||
|
||||
bool Er9xInterface::loadGeneralDataXML(QDomDocument * qdoc, Er9xGeneral * tgen)
|
||||
{
|
||||
//look for "GENERAL_DATA" tag
|
||||
QDomElement gde = qdoc->elementsByTagName("GENERAL_DATA").at(0).toElement();
|
||||
|
||||
if(gde.isNull()) // couldn't find
|
||||
return false;
|
||||
|
||||
//load cdata into tgen
|
||||
QDomNode n = gde.elementsByTagName("Data").at(0).firstChild();// get all children in Data
|
||||
while (!n.isNull()) {
|
||||
if (n.isCDATASection()) {
|
||||
QString ds = n.toCDATASection().data();
|
||||
QByteArray ba = QByteArray::fromBase64(ds.toAscii());
|
||||
const char * data = ba.data();
|
||||
memcpy(tgen, data, sizeof(Er9xGeneral));
|
||||
break;
|
||||
}
|
||||
n = n.nextSibling();
|
||||
}
|
||||
//check version?
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Er9xInterface::loadModelDataXML(QDomDocument * qdoc, Er9xModelData * tmod, int modelNum)
|
||||
{
|
||||
//look for MODEL_DATA with modelNum attribute.
|
||||
//if modelNum = -1 then just pick the first one
|
||||
QDomNodeList ndl = qdoc->elementsByTagName("MODEL_DATA");
|
||||
|
||||
//cycle through nodes to find correct model number
|
||||
QDomNode k = ndl.at(0);
|
||||
if(modelNum>=0) {
|
||||
while(!k.isNull()) {
|
||||
int a = k.toElement().attribute("number").toInt();
|
||||
if(a==modelNum)
|
||||
break;
|
||||
k = k.nextSibling();
|
||||
}
|
||||
}
|
||||
|
||||
if(k.isNull()) // couldn't find
|
||||
return false;
|
||||
|
||||
|
||||
//load cdata into tgen
|
||||
QDomNode n = k.toElement().elementsByTagName("Data").at(0).firstChild();// get all children in Data
|
||||
while (!n.isNull()) {
|
||||
if (n.isCDATASection()) {
|
||||
QString ds = n.toCDATASection().data();
|
||||
QByteArray ba = QByteArray::fromBase64(ds.toAscii());
|
||||
const char * data = ba.data();
|
||||
memcpy(tmod, data, sizeof(Er9xModelData));
|
||||
break;
|
||||
}
|
||||
n = n.nextSibling();
|
||||
}
|
||||
//check version?
|
||||
return true;
|
||||
}
|
||||
@@ -1,72 +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_interface_h
|
||||
#define er9x_interface_h
|
||||
#include <QtXml>
|
||||
#include "eeprominterface.h"
|
||||
#include "er9xeeprom.h"
|
||||
class RleFile;
|
||||
|
||||
class Er9xInterface : public EEPROMInterface
|
||||
{
|
||||
public:
|
||||
|
||||
Er9xInterface();
|
||||
|
||||
virtual ~Er9xInterface();
|
||||
|
||||
virtual const char * getName();
|
||||
|
||||
virtual const int getEEpromSize();
|
||||
|
||||
virtual const int getMaxModels();
|
||||
|
||||
virtual unsigned long load(RadioData &, const uint8_t * eeprom, int size);
|
||||
|
||||
virtual unsigned long loadBackup(RadioData &, uint8_t * eeprom, int esize, int index);
|
||||
|
||||
virtual unsigned long loadxml(RadioData &radioData, QDomDocument &doc);
|
||||
|
||||
virtual int save(uint8_t * eeprom, RadioData & radioData, uint32_t variant=0, uint8_t version=0);
|
||||
|
||||
virtual int getSize(const ModelData &);
|
||||
|
||||
virtual int getSize(const GeneralSettings &settings);
|
||||
|
||||
virtual int isAvailable(PulsesProtocol proto, int port=0);
|
||||
|
||||
protected:
|
||||
|
||||
RleFile *efile;
|
||||
|
||||
private:
|
||||
void appendTextElement(QDomDocument * qdoc, QDomElement * pe, QString name, QString value);
|
||||
|
||||
void appendNumberElement(QDomDocument * qdoc, QDomElement * pe,QString name, int value, bool forceZeroWrite = false);
|
||||
|
||||
void appendCDATAElement(QDomDocument * qdoc, QDomElement * pe,QString name, const char * data, int size);
|
||||
|
||||
QDomElement getGeneralDataXML(QDomDocument * qdoc, Er9xGeneral * tgen); //parse out data to XML format
|
||||
|
||||
QDomElement getModelDataXML(QDomDocument * qdoc, Er9xModelData * tmod, int modelNum, int mdver); //parse out data to XML format
|
||||
|
||||
bool loadGeneralDataXML(QDomDocument * qdoc, Er9xGeneral * tgen); // get data from XML
|
||||
|
||||
bool loadModelDataXML(QDomDocument * qdoc, Er9xModelData * tmod, int modelNum = -1); // get data from XML
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,15 +0,0 @@
|
||||
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
|
||||
)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${PROJECT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
add_library(er9x-simulator er9xsimulator.cpp)
|
||||
@@ -1,223 +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 isBacklightEnable() (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 TRIMS_GPIO_REG_LHL pind
|
||||
#define TRIMS_GPIO_REG_LVD pind
|
||||
#define TRIMS_GPIO_REG_RVU pind
|
||||
#define TRIMS_GPIO_REG_RHL pind
|
||||
#define TRIMS_GPIO_REG_LHR pind
|
||||
#define TRIMS_GPIO_REG_LVU pind
|
||||
#define TRIMS_GPIO_REG_RVD pind
|
||||
#define TRIMS_GPIO_REG_RHR 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, TRIMS_GPIO_REG_LHL, PIN_TRIM_LH_L)
|
||||
TRIM_CASE(1, TRIMS_GPIO_REG_LHR, PIN_TRIM_LH_R)
|
||||
TRIM_CASE(2, TRIMS_GPIO_REG_LVD, PIN_TRIM_LV_DN)
|
||||
TRIM_CASE(3, TRIMS_GPIO_REG_LVU, PIN_TRIM_LV_UP)
|
||||
TRIM_CASE(4, TRIMS_GPIO_REG_RVD, PIN_TRIM_RV_DN)
|
||||
TRIM_CASE(5, TRIMS_GPIO_REG_RVU, PIN_TRIM_RV_UP)
|
||||
TRIM_CASE(6, TRIMS_GPIO_REG_RHL, PIN_TRIM_RH_L)
|
||||
TRIM_CASE(7, TRIMS_GPIO_REG_RHR, 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 isBacklightEnable() (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()
|
||||
{
|
||||
return (::uint8_t *)simuLcdBuf;
|
||||
}
|
||||
|
||||
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,70 +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 const char * getError();
|
||||
|
||||
virtual void sendTelemetry(uint8_t * data, unsigned int len) {};
|
||||
|
||||
virtual uint8_t getSensorInstance(uint16_t id) { return 0; };
|
||||
|
||||
virtual uint16_t getSensorRatio(uint16_t id) { return 0; };
|
||||
|
||||
virtual void setTrainerInput(unsigned int inputNumber, int16_t value) {};
|
||||
|
||||
virtual void setLuaStateReloadPermanentScripts() {};
|
||||
|
||||
protected:
|
||||
|
||||
Er9xInterface * er9xInterface;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,714 +0,0 @@
|
||||
#include <algorithm>
|
||||
#include "helpers.h"
|
||||
#include "ersky9xeeprom.h"
|
||||
#include <QObject>
|
||||
|
||||
extern RawSwitch er9xToSwitch(int8_t sw);
|
||||
|
||||
RawSwitch getErSky9xTimerMode(int mode)
|
||||
{
|
||||
if (mode<4)
|
||||
return RawSwitch(SWITCH_TYPE_TIMER_MODE, mode);
|
||||
else
|
||||
return RawSwitch();
|
||||
}
|
||||
|
||||
RawSwitch ersky9xToSwitch(int8_t sw)
|
||||
{
|
||||
uint8_t swa = abs(sw);
|
||||
if (swa == 0)
|
||||
return RawSwitch(SWITCH_TYPE_NONE);
|
||||
else if (swa <= 9)
|
||||
return RawSwitch(SWITCH_TYPE_SWITCH, sw);
|
||||
else if (swa <= 33)
|
||||
return RawSwitch(SWITCH_TYPE_VIRTUAL, sw > 0 ? sw-9 : sw+9);
|
||||
else if (sw == 34)
|
||||
return RawSwitch(SWITCH_TYPE_ON);
|
||||
else if (sw == -34)
|
||||
return RawSwitch(SWITCH_TYPE_OFF);
|
||||
else if (swa <= 34+9)
|
||||
return RawSwitch(SWITCH_TYPE_SWITCH, sw > 0 ? sw-34 : sw+34);
|
||||
else
|
||||
return RawSwitch(SWITCH_TYPE_VIRTUAL, sw > 0 ? sw-34-9 : sw+34+9);
|
||||
}
|
||||
|
||||
t_Ersky9xTrainerMix::t_Ersky9xTrainerMix()
|
||||
{
|
||||
memset(this, 0, sizeof(t_Ersky9xTrainerMix));
|
||||
}
|
||||
|
||||
t_Ersky9xTrainerMix::operator TrainerMix()
|
||||
{
|
||||
TrainerMix c9x;
|
||||
c9x.src = srcChn;
|
||||
c9x.swtch = er9xToSwitch(swtch);
|
||||
c9x.weight = (25 * studWeight) / 8;
|
||||
c9x.mode = mode;
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Ersky9xTrainerData::t_Ersky9xTrainerData()
|
||||
{
|
||||
memset(this, 0, sizeof(t_Ersky9xTrainerData));
|
||||
}
|
||||
|
||||
t_Ersky9xTrainerData::operator TrainerData ()
|
||||
{
|
||||
TrainerData c9x;
|
||||
for (int i=0; i<NUM_STICKS; i++) {
|
||||
c9x.calib[i] = calib[i];
|
||||
c9x.mix[i] = mix[i];
|
||||
}
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Ersky9xGeneral::t_Ersky9xGeneral()
|
||||
{
|
||||
memset(this, 0, sizeof(t_Ersky9xGeneral));
|
||||
}
|
||||
|
||||
Ersky9xGeneral::operator GeneralSettings ()
|
||||
{
|
||||
GeneralSettings result;
|
||||
|
||||
result.version = myVers;
|
||||
|
||||
for (int i=0; i<NUM_STICKSnPOTS; i++) {
|
||||
result.calibMid[i] = calibMid[i];
|
||||
result.calibSpanNeg[i] = calibSpanNeg[i];
|
||||
result.calibSpanPos[i] = calibSpanPos[i];
|
||||
}
|
||||
|
||||
result.currModel = currModel;
|
||||
result.contrast = contrast;
|
||||
result.vBatWarn = vBatWarn;
|
||||
result.txVoltageCalibration = txVoltageCalibration;
|
||||
|
||||
result.backlightMode = 0;
|
||||
if (lightSw == 22) {
|
||||
result.backlightMode = 4;
|
||||
}
|
||||
else if (lightAutoOff) {
|
||||
result.backlightMode |= 1;
|
||||
result.backlightDelay = lightAutoOff;
|
||||
}
|
||||
else if (lightOnStickMove) {
|
||||
result.backlightMode |= 2;
|
||||
result.backlightDelay = lightOnStickMove;
|
||||
}
|
||||
|
||||
result.trainer = trainer;
|
||||
result.view = std::min((uint8_t)4, view);
|
||||
result.disableThrottleWarning = disableThrottleWarning;
|
||||
result.switchWarning = disableSwitchWarning ? 0 : -1;
|
||||
result.disableMemoryWarning = disableMemoryWarning;
|
||||
|
||||
switch (beeperVal) {
|
||||
case 0:
|
||||
result.beeperMode = GeneralSettings::BEEPER_QUIET;
|
||||
break;
|
||||
case 1:
|
||||
result.beeperMode = GeneralSettings::BEEPER_NOKEYS;
|
||||
break;
|
||||
default:
|
||||
result.beeperMode = GeneralSettings::BEEPER_ALL;
|
||||
result.beeperLength = beeperVal - 4;
|
||||
break;
|
||||
}
|
||||
|
||||
result.disableAlarmWarning = disableAlarmWarning;
|
||||
result.stickMode = std::max((uint8_t)0, std::min(stickMode, (uint8_t)3));
|
||||
result.inactivityTimer = inactivityTimer + 10;
|
||||
result.minuteBeep = minuteBeep;
|
||||
result.preBeep = preBeep;
|
||||
result.flashBeep = flashBeep;
|
||||
result.splashMode = disableSplashScreen;
|
||||
result.disablePotScroll=(disablePotScroll==1);
|
||||
result.disableBG=(disableBG==1);
|
||||
result.templateSetup = templateSetup;
|
||||
result.PPM_Multiplier = PPM_Multiplier;
|
||||
getEEPROMString(result.ownerName, ownerName, sizeof(ownerName));
|
||||
result.optrexDisplay = optrexDisplay;
|
||||
result.speakerPitch = speakerPitch;
|
||||
result.hapticStrength = hapticStrength - 3;
|
||||
result.speakerMode = speakerMode;
|
||||
result.switchWarningStates = switchWarningStates;
|
||||
result.speakerVolume = volume;
|
||||
result.backlightBright = bright ;
|
||||
result.txCurrentCalibration = current_calib;
|
||||
return result;
|
||||
}
|
||||
|
||||
t_Ersky9xLimitData::t_Ersky9xLimitData()
|
||||
{
|
||||
memset(this, 0, sizeof(t_Ersky9xLimitData));
|
||||
}
|
||||
|
||||
t_Ersky9xLimitData::operator LimitData ()
|
||||
{
|
||||
LimitData c9x;
|
||||
c9x.min = 10*(min-100);
|
||||
c9x.max = 10*(max+100);
|
||||
c9x.revert = revert;
|
||||
c9x.offset = offset;
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Ersky9xMixData_v10::t_Ersky9xMixData_v10()
|
||||
{
|
||||
memset(this, 0, sizeof(t_Ersky9xMixData_v10));
|
||||
}
|
||||
|
||||
t_Ersky9xMixData_v10::operator MixData ()
|
||||
{
|
||||
MixData c9x;
|
||||
c9x.destCh = destCh;
|
||||
c9x.weight = weight;
|
||||
c9x.swtch = er9xToSwitch(swtch);
|
||||
|
||||
if (srcRaw == 0) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_NONE);
|
||||
}
|
||||
else if (srcRaw <= 7) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_STICK, srcRaw-1);
|
||||
}
|
||||
else if (srcRaw == 8) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_MAX);
|
||||
}
|
||||
else if (srcRaw == 9) {
|
||||
if (swtch < 0) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_SWITCH, swtch < -3 ? -swtch-3 : -swtch);
|
||||
c9x.weight = -weight;
|
||||
}
|
||||
else if (swtch > 0) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_SWITCH, swtch > 3 ? swtch-3 : swtch);
|
||||
}
|
||||
else {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_MAX);
|
||||
}
|
||||
if (mltpx != MLTPX_REP)
|
||||
c9x.swtch = RawSwitch(SWITCH_TYPE_NONE);
|
||||
}
|
||||
else if (srcRaw == 37) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_SWITCH, 0);
|
||||
}
|
||||
else if (srcRaw <= 12) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_CYC, srcRaw-10);
|
||||
}
|
||||
else if (srcRaw <= 20) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_PPM, srcRaw-13);
|
||||
}
|
||||
else {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-21);
|
||||
}
|
||||
|
||||
if (curve > 6) {
|
||||
c9x.curve.type = CurveReference::CURVE_REF_CUSTOM;
|
||||
c9x.curve.value = curve - 6;
|
||||
}
|
||||
else if (curve > 0) {
|
||||
c9x.curve.type = CurveReference::CURVE_REF_FUNC;
|
||||
c9x.curve.value = curve;
|
||||
}
|
||||
|
||||
c9x.delayUp = delayUp;
|
||||
c9x.delayDown = delayDown;
|
||||
c9x.speedUp = speedUp;
|
||||
c9x.speedDown = speedDown;
|
||||
c9x.carryTrim = carryTrim;
|
||||
c9x.mltpx = (MltpxValue)mltpx;
|
||||
c9x.mixWarn = mixWarn;
|
||||
// c9x.enableFmTrim=enableFmTrim;
|
||||
c9x.sOffset = sOffset;
|
||||
return c9x;
|
||||
}
|
||||
|
||||
|
||||
t_Ersky9xMixData_v11::t_Ersky9xMixData_v11()
|
||||
{
|
||||
memset(this, 0, sizeof(t_Ersky9xMixData_v11));
|
||||
}
|
||||
|
||||
t_Ersky9xMixData_v11::operator MixData ()
|
||||
{
|
||||
MixData c9x;
|
||||
c9x.destCh = destCh;
|
||||
c9x.weight = weight;
|
||||
c9x.swtch = ersky9xToSwitch(swtch);
|
||||
|
||||
if (srcRaw == 0) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_NONE);
|
||||
}
|
||||
else if (srcRaw <= 7) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_STICK, srcRaw-1);
|
||||
}
|
||||
else if (srcRaw == 8) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_MAX);
|
||||
}
|
||||
else if (srcRaw == 9) {
|
||||
if (swtch < 0) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_SWITCH, swtch < -3 ? -swtch-3 : -swtch);
|
||||
c9x.weight = -weight;
|
||||
}
|
||||
else if (swtch > 0) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_SWITCH, swtch > 3 ? swtch-3 : swtch);
|
||||
}
|
||||
else {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_MAX);
|
||||
}
|
||||
if (mltpx != MLTPX_REP)
|
||||
c9x.swtch = RawSwitch(SWITCH_TYPE_NONE);
|
||||
}
|
||||
else if (srcRaw == 45) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_SWITCH, 0);
|
||||
}
|
||||
else if (srcRaw > 45) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_GVAR, srcRaw-46);
|
||||
}
|
||||
else if (srcRaw <= 12) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_CYC, srcRaw-10);
|
||||
}
|
||||
else if (srcRaw <= 20) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_PPM, srcRaw-13);
|
||||
}
|
||||
else {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-21);
|
||||
}
|
||||
|
||||
if (curve > 6) {
|
||||
c9x.curve.type = CurveReference::CURVE_REF_CUSTOM;
|
||||
c9x.curve.value = curve - 6;
|
||||
}
|
||||
else if (curve > 0) {
|
||||
c9x.curve.type = CurveReference::CURVE_REF_FUNC;
|
||||
c9x.curve.value = curve;
|
||||
}
|
||||
|
||||
c9x.delayUp = delayUp;
|
||||
c9x.delayDown = delayDown;
|
||||
c9x.speedUp = speedUp;
|
||||
c9x.speedDown = speedDown;
|
||||
c9x.carryTrim = carryTrim;
|
||||
c9x.mltpx = (MltpxValue)mltpx;
|
||||
c9x.mixWarn = mixWarn;
|
||||
// c9x.enableFmTrim=enableFmTrim;
|
||||
c9x.sOffset = sOffset;
|
||||
return c9x;
|
||||
}
|
||||
|
||||
RawSource ersky9xToSource_v10(int8_t value)
|
||||
{
|
||||
if (value == 0) {
|
||||
return RawSource(SOURCE_TYPE_NONE);
|
||||
}
|
||||
else if (value <= 7) {
|
||||
return RawSource(SOURCE_TYPE_STICK, value - 1);
|
||||
}
|
||||
else if (value == 8) {
|
||||
return RawSource(SOURCE_TYPE_MAX);
|
||||
}
|
||||
else if (value == 9) {
|
||||
return RawSource(SOURCE_TYPE_MAX);
|
||||
}
|
||||
else if (value <= 12) {
|
||||
return RawSource(SOURCE_TYPE_CYC, value-10);
|
||||
}
|
||||
else if (value <= 20) {
|
||||
return RawSource(SOURCE_TYPE_PPM, value-13);
|
||||
}
|
||||
else if (value <= 36) {
|
||||
return RawSource(SOURCE_TYPE_CH, value-21);
|
||||
}
|
||||
else {
|
||||
return RawSource(SOURCE_TYPE_TELEMETRY, value-36);
|
||||
}
|
||||
}
|
||||
|
||||
RawSource ersky9xToSource_v11(int8_t value)
|
||||
{
|
||||
if (value == 0) {
|
||||
return RawSource(SOURCE_TYPE_NONE);
|
||||
}
|
||||
else if (value <= 7) {
|
||||
return RawSource(SOURCE_TYPE_STICK, value - 1);
|
||||
}
|
||||
else if (value == 8) {
|
||||
return RawSource(SOURCE_TYPE_MAX);
|
||||
}
|
||||
else if (value == 9) {
|
||||
return RawSource(SOURCE_TYPE_MAX);
|
||||
}
|
||||
else if (value <= 12) {
|
||||
return RawSource(SOURCE_TYPE_CYC, value-10);
|
||||
}
|
||||
else if (value <= 20) {
|
||||
return RawSource(SOURCE_TYPE_PPM, value-13);
|
||||
}
|
||||
else if (value <= 36) {
|
||||
return RawSource(SOURCE_TYPE_CH, value-21);
|
||||
}
|
||||
else {
|
||||
return RawSource(SOURCE_TYPE_TELEMETRY, value-36);
|
||||
}
|
||||
}
|
||||
|
||||
Ersky9xLogicalSwitchData_v10::operator LogicalSwitchData ()
|
||||
{
|
||||
LogicalSwitchData c9x;
|
||||
c9x.func = func;
|
||||
c9x.val1 = v1;
|
||||
c9x.val2 = v2;
|
||||
|
||||
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val1 = ersky9xToSource_v10(v1).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val2 = ersky9xToSource_v10(v2).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
|
||||
c9x.val1 = er9xToSwitch(v1).toValue();
|
||||
c9x.val2 = er9xToSwitch(v2).toValue();
|
||||
}
|
||||
|
||||
return c9x;
|
||||
}
|
||||
|
||||
Ersky9xLogicalSwitchData_v11::operator LogicalSwitchData ()
|
||||
{
|
||||
LogicalSwitchData c9x;
|
||||
c9x.func = func;
|
||||
c9x.val1 = v1;
|
||||
c9x.val2 = v2;
|
||||
|
||||
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val1 = ersky9xToSource_v11(v1).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val2 = ersky9xToSource_v11(v2).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
|
||||
c9x.val1 = er9xToSwitch(v1).toValue();
|
||||
c9x.val2 = er9xToSwitch(v2).toValue();
|
||||
}
|
||||
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Ersky9xSafetySwData_v10::t_Ersky9xSafetySwData_v10()
|
||||
{
|
||||
memset(this, 0, sizeof(t_Ersky9xSafetySwData_v10));
|
||||
}
|
||||
|
||||
t_Ersky9xSafetySwData_v11::t_Ersky9xSafetySwData_v11()
|
||||
{
|
||||
memset(this, 0, sizeof(t_Ersky9xSafetySwData_v11));
|
||||
}
|
||||
|
||||
t_Ersky9xFrSkyChannelData_v10::t_Ersky9xFrSkyChannelData_v10()
|
||||
{
|
||||
memset(this, 0, sizeof(t_Ersky9xFrSkyChannelData_v10));
|
||||
}
|
||||
|
||||
t_Ersky9xFrSkyChannelData_v10::operator FrSkyChannelData ()
|
||||
{
|
||||
FrSkyChannelData c9x;
|
||||
c9x.ratio = ratio;
|
||||
c9x.alarms[0].value = alarms_value[0];
|
||||
c9x.alarms[0].level = alarms_level & 3;
|
||||
c9x.alarms[0].greater = alarms_greater & 1;
|
||||
c9x.alarms[1].value = alarms_value[1];
|
||||
c9x.alarms[1].level = (alarms_level >> 2) & 3;
|
||||
c9x.alarms[1].greater = (alarms_greater >> 1) & 1;
|
||||
if (type==2) {
|
||||
c9x.type = 0;
|
||||
c9x.multiplier=1;
|
||||
} else {
|
||||
c9x.type = type;
|
||||
}
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Ersky9xFrSkyChannelData_v11::t_Ersky9xFrSkyChannelData_v11()
|
||||
{
|
||||
memset(this, 0, sizeof(t_Ersky9xFrSkyChannelData_v11));
|
||||
}
|
||||
|
||||
t_Ersky9xFrSkyChannelData_v11::operator FrSkyChannelData ()
|
||||
{
|
||||
FrSkyChannelData c9x;
|
||||
c9x.ratio = ratio;
|
||||
c9x.alarms[0].value = alarms_value[0];
|
||||
c9x.alarms[0].level = alarms_level & 3;
|
||||
c9x.alarms[0].greater = alarms_greater & 1;
|
||||
c9x.alarms[1].value = alarms_value[1];
|
||||
c9x.alarms[1].level = (alarms_level >> 2) & 3;
|
||||
c9x.alarms[1].greater = (alarms_greater >> 1) & 1;
|
||||
if (type==2) {
|
||||
c9x.type = 0;
|
||||
c9x.multiplier=1;
|
||||
} else {
|
||||
c9x.type = type;
|
||||
}
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Ersky9xFrSkyData_v10::t_Ersky9xFrSkyData_v10()
|
||||
{
|
||||
memset(this, 0, sizeof(t_Ersky9xFrSkyData_v10));
|
||||
}
|
||||
|
||||
t_Ersky9xFrSkyData_v10::operator FrSkyData ()
|
||||
{
|
||||
FrSkyData c9x;
|
||||
c9x.channels[0] = channels[0];
|
||||
c9x.channels[1] = channels[1];
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Ersky9xFrSkyData_v11::t_Ersky9xFrSkyData_v11()
|
||||
{
|
||||
memset(this, 0, sizeof(t_Ersky9xFrSkyData_v11));
|
||||
}
|
||||
|
||||
t_Ersky9xFrSkyData_v11::operator FrSkyData ()
|
||||
{
|
||||
FrSkyData c9x;
|
||||
c9x.channels[0] = channels[0];
|
||||
c9x.channels[1] = channels[1];
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Ersky9xModelData_v10::operator ModelData ()
|
||||
{
|
||||
ModelData c9x;
|
||||
c9x.used = true;
|
||||
getEEPROMString(c9x.name, name, sizeof(name));
|
||||
for (int i=0; i<2; i++) {
|
||||
c9x.timers[i].mode = getErSky9xTimerMode(timer[i].tmrModeA);
|
||||
c9x.timers[i].val = timer[i].tmrVal;
|
||||
}
|
||||
switch(protocol) {
|
||||
case 1:
|
||||
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
|
||||
break;
|
||||
case 2:
|
||||
c9x.moduleData[0].protocol = PULSES_DSM2;
|
||||
break;
|
||||
case 3:
|
||||
c9x.moduleData[0].protocol = PULSES_PPM16;
|
||||
break;
|
||||
default:
|
||||
c9x.moduleData[0].protocol = PULSES_PPM;
|
||||
break;
|
||||
}
|
||||
c9x.moduleData[0].ppmFrameLength=ppmFrameLength;
|
||||
c9x.moduleData[0].channelsCount = 8 + 2 * ppmNCH;
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.trimInc = trimInc-2;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.customFn[0].func = FuncInstantTrim;
|
||||
if (trimSw) {
|
||||
c9x.customFn[0].swtch = er9xToSwitch(trimSw);
|
||||
}
|
||||
c9x.beepANACenter = beepANACenter;
|
||||
c9x.moduleData[0].ppmPulsePol = pulsePol;
|
||||
c9x.extendedLimits = extendedLimits;
|
||||
c9x.swashRingData.elevatorWeight = swashInvertELE ? -100 : 100;
|
||||
c9x.swashRingData.aileronWeight = swashInvertAIL ? -100 : 100;
|
||||
c9x.swashRingData.collectiveWeight = swashInvertCOL ? -100 : 100;
|
||||
c9x.swashRingData.type = swashType;
|
||||
c9x.swashRingData.collectiveSource = ersky9xToSource_v10(swashCollectiveSource);
|
||||
c9x.swashRingData.value = swashRingValue;
|
||||
for (int i=0; i<ERSKY9X_MAX_MIXERS_V10; i++)
|
||||
c9x.mixData[i] = mixData[i];
|
||||
for (int i=0; i<ERSKY9X_NUM_CHNOUT_V10; i++)
|
||||
c9x.limitData[i] = limitData[i];
|
||||
|
||||
// expoData
|
||||
int e = 0;
|
||||
for (int ch = 0; ch < 4 && e < C9X_MAX_EXPOS; ch++) {
|
||||
for (int dr = 0, pos = 0; dr < 3 && e < C9X_MAX_EXPOS; dr++, pos++) {
|
||||
if ((dr == 0 && !expoData[ch].drSw1) || (dr == 1 && !expoData[ch].drSw2))
|
||||
dr = 2;
|
||||
if (dr == 2 && !expoData[ch].expo[0][0][0] && !expoData[ch].expo[0][0][1] && !expoData[ch].expo[0][1][0] && !expoData[ch].expo[0][1][1])
|
||||
break;
|
||||
if (expoData[ch].drSw1 && !expoData[ch].drSw2) {
|
||||
c9x.expoData[e].swtch = er9xToSwitch(dr == 0 ? expoData[ch].drSw1 : 0);
|
||||
pos = dr == 0 ? 1 : 0;
|
||||
}
|
||||
else {
|
||||
c9x.expoData[e].swtch = er9xToSwitch(dr == 0 ? -expoData[ch].drSw1 : (dr == 1 ? -expoData[ch].drSw2 : 0));
|
||||
}
|
||||
c9x.expoData[e].chn = ch;
|
||||
if (expoData[ch].expo[pos][0][0]) {
|
||||
c9x.expoData[e].curve.type = CurveReference::CURVE_REF_EXPO;
|
||||
c9x.expoData[e].curve.value = expoData[ch].expo[pos][0][0];
|
||||
}
|
||||
c9x.expoData[e].weight = 100 + expoData[ch].expo[pos][1][0];
|
||||
if (expoData[ch].expo[pos][0][0] == expoData[ch].expo[pos][0][1] && expoData[ch].expo[pos][1][0] == expoData[ch].expo[pos][1][1]) {
|
||||
c9x.expoData[e++].mode = 3;
|
||||
}
|
||||
else {
|
||||
c9x.expoData[e].mode = 2;
|
||||
if (e < C9X_MAX_EXPOS - 1) {
|
||||
c9x.expoData[e + 1].swtch = c9x.expoData[e].swtch;
|
||||
c9x.expoData[++e].chn = ch;
|
||||
c9x.expoData[e].mode = 1;
|
||||
if (expoData[ch].expo[pos][0][1]) {
|
||||
c9x.expoData[e].curve.type = CurveReference::CURVE_REF_EXPO;
|
||||
c9x.expoData[e].curve.value = expoData[ch].expo[pos][0][1];
|
||||
}
|
||||
c9x.expoData[e++].weight = 100 + expoData[ch].expo[pos][1][1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=0; i<NUM_STICKS; i++)
|
||||
c9x.flightModeData[0].trim[i] = trim[i];
|
||||
|
||||
for (int i=0; i<ERSKY9X_MAX_CURVE5; i++) {
|
||||
c9x.curves[i].count = 5;
|
||||
for (int j = 0; j < 5; j++) {
|
||||
c9x.curves[i].points[j].x = -100 + 50 * i;
|
||||
c9x.curves[i].points[j].y = curves5[i][j];
|
||||
}
|
||||
}
|
||||
for (int i=0; i<ERSKY9X_MAX_CURVE9; i++) {
|
||||
c9x.curves[ERSKY9X_MAX_CURVE5 + i].count = 9;
|
||||
for (int j = 0; j < 9; j++) {
|
||||
c9x.curves[ERSKY9X_MAX_CURVE5 + i].points[j].x = -100 + 25 * i;
|
||||
c9x.curves[ERSKY9X_MAX_CURVE5 + i].points[j].y = curves9[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=0; i<ERSKY9X_NUM_CSW_V10; i++)
|
||||
c9x.logicalSw[i] = logicalSw[i];
|
||||
|
||||
// for (int i=0; i<ERSKY9X_NUM_CHNOUT_V10; i++)
|
||||
// c9x.safetySw[i] = safetySw[i];
|
||||
|
||||
c9x.frsky = frsky;
|
||||
c9x.frsky.usrProto=FrSkyUsrProto;
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Ersky9xModelData_v11::operator ModelData ()
|
||||
{
|
||||
ModelData c9x;
|
||||
c9x.used = true;
|
||||
getEEPROMString(c9x.name, name, sizeof(name));
|
||||
for (int i=0; i<2; i++) {
|
||||
c9x.timers[i].mode = getErSky9xTimerMode(timer[i].tmrModeA);
|
||||
c9x.timers[i].val = timer[i].tmrVal;
|
||||
}
|
||||
switch(protocol) {
|
||||
case 1:
|
||||
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
|
||||
break;
|
||||
case 2:
|
||||
c9x.moduleData[0].protocol = PULSES_DSM2;
|
||||
break;
|
||||
case 3:
|
||||
c9x.moduleData[0].protocol = PULSES_PPM16;
|
||||
break;
|
||||
default:
|
||||
c9x.moduleData[0].protocol = PULSES_PPM;
|
||||
break;
|
||||
}
|
||||
c9x.moduleData[0].ppmFrameLength=ppmFrameLength;
|
||||
c9x.moduleData[0].channelsCount = 8 + 2 * ppmNCH;
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.trimInc = trimInc-2;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.customFn[0].func = FuncInstantTrim;
|
||||
if (trimSw) {
|
||||
c9x.customFn[0].swtch = er9xToSwitch(trimSw);
|
||||
}
|
||||
c9x.beepANACenter = beepANACenter;
|
||||
c9x.moduleData[0].ppmPulsePol = pulsePol;
|
||||
c9x.extendedLimits = extendedLimits;
|
||||
c9x.swashRingData.elevatorWeight = swashInvertELE ? -100 : 100;
|
||||
c9x.swashRingData.aileronWeight = swashInvertAIL ? -100 : 100;
|
||||
c9x.swashRingData.collectiveWeight = swashInvertCOL ? -100 : 100;
|
||||
c9x.swashRingData.type = swashType;
|
||||
c9x.swashRingData.collectiveSource = ersky9xToSource_v11(swashCollectiveSource);
|
||||
c9x.swashRingData.value = swashRingValue;
|
||||
for (int i=0; i<ERSKY9X_MAX_MIXERS_V11; i++)
|
||||
c9x.mixData[i] = mixData[i];
|
||||
for (int i=0; i<ERSKY9X_NUM_CHNOUT_V11; i++)
|
||||
c9x.limitData[i] = limitData[i];
|
||||
|
||||
// expoData
|
||||
int e = 0;
|
||||
for (int ch = 0; ch < 4 && e < C9X_MAX_EXPOS; ch++) {
|
||||
for (int dr = 0, pos = 0; dr < 3 && e < C9X_MAX_EXPOS; dr++, pos++) {
|
||||
if ((dr == 0 && !expoData[ch].drSw1) || (dr == 1 && !expoData[ch].drSw2))
|
||||
dr = 2;
|
||||
if (dr == 2 && !expoData[ch].expo[0][0][0] && !expoData[ch].expo[0][0][1] && !expoData[ch].expo[0][1][0] && !expoData[ch].expo[0][1][1])
|
||||
break;
|
||||
if (expoData[ch].drSw1 && !expoData[ch].drSw2) {
|
||||
c9x.expoData[e].swtch = er9xToSwitch(dr == 0 ? expoData[ch].drSw1 : 0);
|
||||
pos = dr == 0 ? 1 : 0;
|
||||
}
|
||||
else {
|
||||
c9x.expoData[e].swtch = er9xToSwitch(dr == 0 ? -expoData[ch].drSw1 : (dr == 1 ? -expoData[ch].drSw2 : 0));
|
||||
}
|
||||
c9x.expoData[e].chn = ch;
|
||||
if (expoData[ch].expo[pos][0][0]) {
|
||||
c9x.expoData[e].curve.type = CurveReference::CURVE_REF_EXPO;
|
||||
c9x.expoData[e].curve.value = expoData[ch].expo[pos][0][0];
|
||||
}
|
||||
c9x.expoData[e].weight = 100 + expoData[ch].expo[pos][1][0];
|
||||
if (expoData[ch].expo[pos][0][0] == expoData[ch].expo[pos][0][1] && expoData[ch].expo[pos][1][0] == expoData[ch].expo[pos][1][1]) {
|
||||
c9x.expoData[e++].mode = 3;
|
||||
}
|
||||
else {
|
||||
c9x.expoData[e].mode = 2;
|
||||
if (e < C9X_MAX_EXPOS - 1) {
|
||||
c9x.expoData[e + 1].swtch = c9x.expoData[e].swtch;
|
||||
c9x.expoData[++e].chn = ch;
|
||||
c9x.expoData[e].mode = 1;
|
||||
if (expoData[ch].expo[pos][0][1]) {
|
||||
c9x.expoData[e].curve.type = CurveReference::CURVE_REF_EXPO;
|
||||
c9x.expoData[e].curve.value = expoData[ch].expo[pos][0][1];
|
||||
}
|
||||
c9x.expoData[e++].weight = 100 + expoData[ch].expo[pos][1][1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=0; i<NUM_STICKS; i++)
|
||||
c9x.flightModeData[0].trim[i] = trim[i];
|
||||
|
||||
for (int i=0; i<ERSKY9X_MAX_CURVE5; i++) {
|
||||
c9x.curves[i].count = 5;
|
||||
for (int j = 0; j < 5; j++) {
|
||||
c9x.curves[i].points[j].x = -100 + 50 * i;
|
||||
c9x.curves[i].points[j].y = curves5[i][j];
|
||||
}
|
||||
}
|
||||
for (int i=0; i<ERSKY9X_MAX_CURVE9; i++) {
|
||||
c9x.curves[ERSKY9X_MAX_CURVE5 + i].count = 9;
|
||||
for (int j = 0; j < 9; j++) {
|
||||
c9x.curves[ERSKY9X_MAX_CURVE5 + i].points[j].x = -100 + 25 * i;
|
||||
c9x.curves[ERSKY9X_MAX_CURVE5 + i].points[j].y = curves9[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=0; i<ERSKY9X_NUM_CSW_V11; i++)
|
||||
c9x.logicalSw[i] = logicalSw[i];
|
||||
|
||||
c9x.frsky = frsky;
|
||||
c9x.frsky.usrProto=FrSkyUsrProto;
|
||||
for (int i=0; i<5;i++) {
|
||||
c9x.flightModeData[0].gvars[i]=gvars[i].gvar;
|
||||
}
|
||||
return c9x;
|
||||
}
|
||||
|
||||
@@ -1,431 +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 ersky9xeeprom_h
|
||||
#define ersky9xeeprom_h
|
||||
|
||||
#include <inttypes.h>
|
||||
#include "eeprominterface.h"
|
||||
|
||||
extern RawSwitch getEr9xTimerMode(int mode);
|
||||
|
||||
//eeprom data
|
||||
#define ERSKY9X_MAX_MIXERS_V10 32
|
||||
#define ERSKY9X_MAX_MIXERS_V11 48
|
||||
#define ERSKY9X_MAX_CURVE5 8
|
||||
#define ERSKY9X_MAX_CURVE9 8
|
||||
#define ERSKY9X_MAX_CSFUNC 13
|
||||
|
||||
#define ERSKY9X_MDVERS10 10
|
||||
#define ERSKY9X_MDVERS11 11
|
||||
|
||||
#define ERSKY9X_GENERAL_OWNER_NAME_LEN 10
|
||||
#define ERSKY9X_NUM_CHNOUT_V10 16 //number of real outputchannels CH1-CH8
|
||||
#define ERSKY9X_NUM_CHNOUT_V11 24 //number of real outputchannels CH1-CH8
|
||||
#define ERSKY9X_NUM_CSW_V10 12 //number of custom switches
|
||||
#define ERSKY9X_NUM_CSW_V11 24
|
||||
#define ERSKY9X_NUM_FSW 16
|
||||
#define ERSKY9X_NUM_VOICE 8
|
||||
#define ERSKY9X_MAX_GVARS 7
|
||||
|
||||
#define NUM_STICKSnPOTS 7 //number of sticks and pots
|
||||
|
||||
PACK(typedef struct t_Ersky9xTrainerMix {
|
||||
uint8_t srcChn:3; //0-7 = ch1-8
|
||||
int8_t swtch:5;
|
||||
int8_t studWeight:6;
|
||||
uint8_t mode:2; // off, add-mode, subst-mode
|
||||
|
||||
operator TrainerMix();
|
||||
t_Ersky9xTrainerMix();
|
||||
}) Ersky9xTrainerMix; //
|
||||
|
||||
PACK(typedef struct t_Ersky9xTrainerData {
|
||||
int16_t calib[4];
|
||||
Ersky9xTrainerMix mix[4];
|
||||
|
||||
operator TrainerData();
|
||||
t_Ersky9xTrainerData();
|
||||
}) Ersky9xTrainerData;
|
||||
|
||||
PACK(typedef struct t_Ersky9xGeneral {
|
||||
uint8_t myVers;
|
||||
int16_t calibMid[NUM_STICKSnPOTS];
|
||||
int16_t calibSpanNeg[NUM_STICKSnPOTS];
|
||||
int16_t calibSpanPos[NUM_STICKSnPOTS];
|
||||
uint16_t chkSum;
|
||||
uint8_t currModel; //0..15
|
||||
uint8_t contrast;
|
||||
uint8_t vBatWarn;
|
||||
int8_t txVoltageCalibration;
|
||||
int8_t lightSw;
|
||||
Ersky9xTrainerData trainer;
|
||||
uint8_t view;
|
||||
uint8_t disableThrottleWarning:1;
|
||||
uint8_t disableSwitchWarning:1;
|
||||
uint8_t disableMemoryWarning:1;
|
||||
uint8_t beeperVal:3;
|
||||
uint8_t reserveWarning:1;
|
||||
uint8_t disableAlarmWarning:1;
|
||||
uint8_t stickMode;
|
||||
int8_t inactivityTimer;
|
||||
uint8_t throttleReversed:1;
|
||||
uint8_t minuteBeep:1;
|
||||
uint8_t preBeep:1;
|
||||
uint8_t flashBeep:1;
|
||||
uint8_t disableSplashScreen:1;
|
||||
uint8_t disablePotScroll:1;
|
||||
uint8_t disableBG:1;
|
||||
uint8_t res1:1;
|
||||
uint8_t filterInput;
|
||||
uint8_t lightAutoOff;
|
||||
uint8_t templateSetup; //RETA order according to chout_ar array
|
||||
int8_t PPM_Multiplier;
|
||||
uint8_t FRSkyYellow:4;
|
||||
uint8_t FRSkyOrange:4;
|
||||
uint8_t FRSkyRed:4; //mike please check these are correct
|
||||
uint8_t hideNameOnSplash:1;
|
||||
uint8_t optrexDisplay:1;
|
||||
uint8_t spare:2;
|
||||
uint8_t speakerPitch;
|
||||
uint8_t hapticStrength;
|
||||
uint8_t speakerMode;
|
||||
uint8_t lightOnStickMove;
|
||||
|
||||
char ownerName[10];
|
||||
uint8_t switchWarningStates;
|
||||
uint8_t volume ;
|
||||
uint8_t bright ; // backlight
|
||||
uint8_t stickGain;
|
||||
uint8_t mAh_alarm ;
|
||||
uint16_t mAh_used ;
|
||||
uint16_t run_time ;
|
||||
int8_t current_calib ;
|
||||
uint8_t bt_baudrate ;
|
||||
uint8_t rotaryDivisor ;
|
||||
operator GeneralSettings();
|
||||
t_Ersky9xGeneral();
|
||||
}) Ersky9xGeneral;
|
||||
|
||||
PACK(typedef struct t_Ersky9xExpoData {
|
||||
int8_t expo[3][2][2];
|
||||
int8_t drSw1;
|
||||
int8_t drSw2;
|
||||
|
||||
t_Ersky9xExpoData() { memset(this, 0, sizeof(t_Ersky9xExpoData)); }
|
||||
}) Ersky9xExpoData;
|
||||
|
||||
|
||||
PACK(typedef struct t_Ersky9xLimitData {
|
||||
int8_t min;
|
||||
int8_t max;
|
||||
bool revert;
|
||||
int16_t offset;
|
||||
|
||||
operator LimitData();
|
||||
t_Ersky9xLimitData() ;
|
||||
}) Ersky9xLimitData;
|
||||
|
||||
#define MLTPX_ADD 0
|
||||
#define MLTPX_MUL 1
|
||||
#define MLTPX_REP 2
|
||||
|
||||
PACK(typedef struct t_Ersky9xMixData_v10 {
|
||||
uint8_t destCh; // 1..C9X_NUM_CHNOUT
|
||||
uint8_t srcRaw; //
|
||||
int8_t weight;
|
||||
int8_t swtch;
|
||||
uint8_t curve; //0=symmetrisch 1=no neg 2=no pos
|
||||
uint8_t delayUp:4;
|
||||
uint8_t delayDown:4;
|
||||
uint8_t speedUp:4; // Servogeschwindigkeit aus Tabelle (10ms Cycle)
|
||||
uint8_t speedDown:4; // 0 nichts
|
||||
uint8_t carryTrim:1;
|
||||
uint8_t mltpx:3; // multiplex method 0=+ 1=* 2=replace
|
||||
uint8_t mixWarn:2; // mixer warning
|
||||
uint8_t enableFmTrim:1;
|
||||
uint8_t mixres:1;
|
||||
int8_t sOffset;
|
||||
int8_t res;
|
||||
|
||||
operator MixData();
|
||||
t_Ersky9xMixData_v10();
|
||||
}) Ersky9xMixData_v10;
|
||||
|
||||
PACK(typedef struct t_Ersky9xMixData_v11 {
|
||||
uint8_t destCh; // 1..C9X_NUM_CHNOUT
|
||||
uint8_t srcRaw; //
|
||||
int8_t weight;
|
||||
int8_t swtch;
|
||||
uint8_t curve; //0=symmetrisch 1=no neg 2=no pos
|
||||
uint8_t delayUp;
|
||||
uint8_t delayDown;
|
||||
uint8_t speedUp; // Servogeschwindigkeit aus Tabelle (10ms Cycle)
|
||||
uint8_t speedDown; // 0 nichts
|
||||
uint8_t carryTrim:1;
|
||||
uint8_t mltpx:3; // multiplex method 0=+ 1=* 2=replace
|
||||
uint8_t mixWarn:2; // mixer warning
|
||||
uint8_t enableFmTrim:1;
|
||||
uint8_t mixres:1;
|
||||
int8_t sOffset;
|
||||
uint8_t res[4];
|
||||
operator MixData();
|
||||
t_Ersky9xMixData_v11();
|
||||
}) Ersky9xMixData_v11;
|
||||
|
||||
PACK(typedef struct t_Ersky9xLogicalSwitchData_v10 { // Custom Switches data
|
||||
int8_t v1; //input
|
||||
int8_t v2; //offset
|
||||
uint8_t func;
|
||||
|
||||
operator LogicalSwitchData();
|
||||
t_Ersky9xLogicalSwitchData_v10() { memset(this, 0, sizeof(t_Ersky9xLogicalSwitchData_v10)); }
|
||||
}) Ersky9xLogicalSwitchData_v10;
|
||||
|
||||
PACK(typedef struct t_Ersky9xLogicalSwitchData_v11 { // Custom Switches data
|
||||
int8_t v1; //input
|
||||
int8_t v2; //offset
|
||||
uint8_t func;
|
||||
uint8_t andsw;
|
||||
uint8_t res ;
|
||||
|
||||
operator LogicalSwitchData();
|
||||
t_Ersky9xLogicalSwitchData_v11() { memset(this, 0, sizeof(t_Ersky9xLogicalSwitchData_v11)); }
|
||||
}) Ersky9xLogicalSwitchData_v11;
|
||||
|
||||
PACK(typedef struct t_Ersky9xSafetySwData_v10 { // Custom Switches data
|
||||
int8_t swtch;
|
||||
int8_t val;
|
||||
|
||||
t_Ersky9xSafetySwData_v10();
|
||||
}) Ersky9xSafetySwData_v10;
|
||||
|
||||
PACK(typedef struct t_Ersky9xSafetySwData_v11 { // Custom Switches data
|
||||
union opt {
|
||||
struct ss {
|
||||
int8_t swtch ;
|
||||
uint8_t mode ;
|
||||
int8_t val ;
|
||||
uint8_t res ;
|
||||
} ss ;
|
||||
struct vs {
|
||||
uint8_t vswtch ;
|
||||
uint8_t vmode ; // ON, OFF, BOTH, 15Secs, 30Secs, 60Secs, Varibl
|
||||
uint8_t vval;
|
||||
uint8_t vres ;
|
||||
} vs ;
|
||||
} opt ;
|
||||
|
||||
t_Ersky9xSafetySwData_v11();
|
||||
}) Ersky9xSafetySwData_v11;
|
||||
|
||||
PACK(typedef struct t_Ersky9xgvar {
|
||||
int8_t gvar ;
|
||||
uint8_t gvsource ;
|
||||
// int8_t gvswitch ;
|
||||
}) Ersky9xGvarData ;
|
||||
|
||||
PACK(typedef struct t_Ersky9xFlightModeData {
|
||||
int16_t trim[4]; // -500..500 => trim value, 501 => use trim of phase 0, 502, 503, 504 => use trim of phases 1|2|3|4 instead
|
||||
int8_t swtch; // swtch of phase[0] is not used
|
||||
char name[6];
|
||||
uint8_t fadeIn:4;
|
||||
uint8_t fadeOut:4;
|
||||
uint16_t spare ; // Future expansion
|
||||
}) Ersky9xFlightModeData;
|
||||
|
||||
PACK(typedef struct t_Ersky9xCustomFunctionData { // Function Switches data
|
||||
int8_t swtch; //input
|
||||
uint8_t func;
|
||||
char param[6];
|
||||
uint8_t delay;
|
||||
uint8_t spare;
|
||||
}) Ersky9xCustomFunctionData;
|
||||
|
||||
PACK(typedef struct t_Ersky9xFrSkyChannelData_v10 {
|
||||
uint8_t ratio; // 0.0 means not used, 0.1V steps EG. 6.6 Volts = 66. 25.1V = 251, etc.
|
||||
uint8_t alarms_value[2]; // 0.1V steps EG. 6.6 Volts = 66. 25.1V = 251, etc.
|
||||
uint8_t alarms_level:4;
|
||||
uint8_t alarms_greater:2; // 0=LT(<), 1=GT(>)
|
||||
uint8_t type:2; // future use: 0=volts, ...
|
||||
|
||||
operator FrSkyChannelData();
|
||||
t_Ersky9xFrSkyChannelData_v10();
|
||||
}) Ersky9xFrSkyChannelData_v10;
|
||||
|
||||
PACK(typedef struct t_Ersky9xFrSkyData_v10 {
|
||||
Ersky9xFrSkyChannelData_v10 channels[2];
|
||||
|
||||
operator FrSkyData();
|
||||
t_Ersky9xFrSkyData_v10();
|
||||
}) Ersky9xFrSkyData_v10;
|
||||
|
||||
PACK(typedef struct t_Ersky9xFrSkyChannelData_v11 {
|
||||
uint8_t ratio ; // 0.0 means not used, 0.1V steps EG. 6.6 Volts = 66. 25.1V = 251, etc.
|
||||
uint8_t offset ; //
|
||||
uint8_t gain ; //
|
||||
uint8_t alarms_value[2] ; // 0.1V steps EG. 6.6 Volts = 66. 25.1V = 251, etc.
|
||||
uint8_t alarms_level ;
|
||||
uint8_t alarms_greater ; // 0=LT(<), 1=GT(>)
|
||||
uint8_t type ; // 0=volts, 1=raw, 2=volts*2, 3=Amps
|
||||
|
||||
operator FrSkyChannelData();
|
||||
t_Ersky9xFrSkyChannelData_v11();
|
||||
}) Ersky9xFrSkyChannelData_v11;
|
||||
|
||||
PACK(typedef struct t_Ersky9xFrSkyData_v11 {
|
||||
Ersky9xFrSkyChannelData_v11 channels[2];
|
||||
|
||||
operator FrSkyData();
|
||||
t_Ersky9xFrSkyData_v11();
|
||||
}) Ersky9xFrSkyData_v11;
|
||||
|
||||
PACK(typedef struct t_Ersky9xFrSkyalarms_v11 {
|
||||
uint8_t frskyAlarmType ;
|
||||
uint8_t frskyAlarmLimit ;
|
||||
uint8_t frskyAlarmSound ;
|
||||
}) Ersky9xFrSkyAlData_v11;
|
||||
|
||||
PACK(typedef struct t_Ersky9xFrSkyAlarmData_v11 {
|
||||
Ersky9xFrSkyAlData_v11 alarmData[8] ;
|
||||
}) Ersky9xFrSkyAlarmData_v11;
|
||||
|
||||
PACK(typedef struct t_Ersky9xTimerMode_v10 {
|
||||
uint8_t tmrModeA:7 ; // timer trigger source -> off, abs, stk, stk%, cx%
|
||||
uint8_t tmrDir:1 ; // Timer direction
|
||||
int8_t tmrModeB ; // timer trigger source -> !sw, none, sw, m_sw
|
||||
uint16_t tmrVal ;
|
||||
}) Ersky9xTimerMode_v10;
|
||||
|
||||
PACK(typedef struct t_Ersky9xTimerMode_v11 {
|
||||
uint8_t tmrModeA:7 ; // timer trigger source -> off, abs, stk, stk%, cx%
|
||||
uint8_t tmrDir:1 ; // Timer direction
|
||||
int8_t tmrModeB ; // timer trigger source -> !sw, none, sw, m_sw
|
||||
uint16_t tmrVal ;
|
||||
}) Ersky9xTimerMode_v11;
|
||||
|
||||
PACK(typedef struct te_Ersky9xswVoice {
|
||||
uint8_t swtch ;
|
||||
uint8_t mode ; // ON, OFF, BOTH, 15Secs, 30Secs, 60Secs
|
||||
uint8_t val ;
|
||||
uint8_t vres ;
|
||||
}) Ersky9xvoiceSwData ;
|
||||
|
||||
PACK(typedef struct t_Ersky9xModelData_v10 {
|
||||
char name[10]; // 10 must be first for eeLoadModelName
|
||||
uint8_t reserved_spare; //used to be MDVERS - now depreciated
|
||||
int8_t spare21; // was timer trigger source -> off, abs, stk, stk%, sw/!sw, !m_sw/!m_sw
|
||||
// uint8_t sparex:1; // was tmrDir, now use tmrVal>0 => count down
|
||||
uint8_t sparex:1; // was tmrDir, now use tmrVal>0 => count down
|
||||
// uint8_t tmrDir:1; // was tmrDir, now use tmrVal>0 => count down
|
||||
uint8_t traineron:1; // 0 disable trainer, 1 allow trainer
|
||||
uint8_t spare22:1 ; // Start timer2 using throttle
|
||||
uint8_t FrSkyUsrProto:1 ; // Protocol in FrSky User Data, 0=FrSky Hub, 1=WS HowHigh
|
||||
uint8_t FrSkyGpsAlt:1 ; // Use Gps Altitude as main altitude reading
|
||||
uint8_t FrSkyImperial:1 ; // Convert FrSky values to imperial units
|
||||
uint8_t FrSkyAltAlarm:2;
|
||||
uint16_t spare_u16 ; // Was timerval
|
||||
uint8_t protocol;
|
||||
int8_t ppmNCH;
|
||||
int8_t thrTrim:4; // Enable Throttle Trim
|
||||
int8_t thrExpo:4; // Enable Throttle Expo
|
||||
int8_t trimInc; // Trim Increments
|
||||
int8_t ppmDelay;
|
||||
int8_t trimSw;
|
||||
uint8_t beepANACenter; // 1<<0->A1.. 1<<6->A7
|
||||
uint8_t pulsePol:1;
|
||||
uint8_t extendedLimits:1;
|
||||
uint8_t swashInvertELE:1;
|
||||
uint8_t swashInvertAIL:1;
|
||||
uint8_t swashInvertCOL:1;
|
||||
uint8_t swashType:3;
|
||||
uint8_t swashCollectiveSource;
|
||||
uint8_t swashRingValue;
|
||||
int8_t ppmFrameLength; //0=22.5 (10msec-30msec) 0.5msec increments
|
||||
Ersky9xMixData_v10 mixData[ERSKY9X_MAX_MIXERS_V10];
|
||||
Ersky9xLimitData limitData[ERSKY9X_NUM_CHNOUT_V10];
|
||||
Ersky9xExpoData expoData[4];
|
||||
int8_t trim[4];
|
||||
int8_t curves5[ERSKY9X_MAX_CURVE5][5];
|
||||
int8_t curves9[ERSKY9X_MAX_CURVE9][9];
|
||||
Ersky9xLogicalSwitchData_v10 logicalSw[ERSKY9X_NUM_CSW_V10];
|
||||
uint8_t frSkyVoltThreshold ;
|
||||
uint8_t res3[2];
|
||||
Ersky9xSafetySwData_v10 safetySw[ERSKY9X_NUM_CHNOUT_V10];
|
||||
Ersky9xFrSkyData_v10 frsky;
|
||||
Ersky9xTimerMode_v10 timer[2] ;
|
||||
operator ModelData();
|
||||
t_Ersky9xModelData_v10() { memset(this, 0, sizeof(t_Ersky9xModelData_v10)); }
|
||||
}) Ersky9xModelData_v10;
|
||||
|
||||
PACK(typedef struct t_Ersky9xModelData_v11 {
|
||||
char name[10]; // 10 must be first for eeLoadModelName
|
||||
uint8_t modelVoice ; // Index to model name voice (261+value)
|
||||
uint8_t RxNum ; // was timer trigger source, now RxNum for model match
|
||||
uint8_t sparex:1; // was tmrDir, now use tmrVal>0 => count down
|
||||
uint8_t traineron:1; // 0 disable trainer, 1 allow trainer
|
||||
uint8_t spare22:1 ; // Start timer2 using throttle
|
||||
uint8_t FrSkyUsrProto:1 ; // Protocol in FrSky User Data, 0=FrSky Hub, 1=WS HowHigh
|
||||
uint8_t FrSkyGpsAlt:1 ; // Use Gps Altitude as main altitude reading
|
||||
uint8_t FrSkyImperial:1 ; // Convert FrSky values to imperial units
|
||||
uint8_t FrSkyAltAlarm:2;
|
||||
uint8_t version ;
|
||||
uint8_t protocol;
|
||||
int8_t ppmNCH;
|
||||
uint8_t thrTrim:1; // Enable Throttle Trim
|
||||
uint8_t numBlades:2; // RPM scaling
|
||||
uint8_t spare10:1;
|
||||
uint8_t thrExpo:1; // Enable Throttle Expo
|
||||
uint8_t spare11:3;
|
||||
int8_t trimInc; // Trim Increments
|
||||
int8_t ppmDelay;
|
||||
int8_t trimSw;
|
||||
uint8_t beepANACenter; // 1<<0->A1.. 1<<6->A7
|
||||
uint8_t pulsePol:1;
|
||||
uint8_t extendedLimits:1;
|
||||
uint8_t swashInvertELE:1;
|
||||
uint8_t swashInvertAIL:1;
|
||||
uint8_t swashInvertCOL:1;
|
||||
uint8_t swashType:3;
|
||||
uint8_t swashCollectiveSource;
|
||||
uint8_t swashRingValue;
|
||||
int8_t ppmFrameLength; //0=22.5 (10msec-30msec) 0.5msec increments
|
||||
Ersky9xMixData_v11 mixData[ERSKY9X_MAX_MIXERS_V11];
|
||||
Ersky9xLimitData limitData[ERSKY9X_NUM_CHNOUT_V11];
|
||||
Ersky9xExpoData expoData[4];
|
||||
int8_t trim[4];
|
||||
int8_t curves5[ERSKY9X_MAX_CURVE5][5];
|
||||
int8_t curves9[ERSKY9X_MAX_CURVE9][9];
|
||||
int8_t curvexy[18];
|
||||
Ersky9xLogicalSwitchData_v11 logicalSw[ERSKY9X_NUM_CSW_V11];
|
||||
uint8_t frSkyVoltThreshold ;
|
||||
uint8_t bt_telemetry;
|
||||
uint8_t numVoice; // 0-16, rest are Safety switches
|
||||
Ersky9xSafetySwData_v11 safetySw[ERSKY9X_NUM_CHNOUT_V11];
|
||||
Ersky9xvoiceSwData voiceSwitches[ERSKY9X_NUM_VOICE] ;
|
||||
Ersky9xFrSkyData_v11 frsky;
|
||||
Ersky9xTimerMode_v11 timer[2] ;
|
||||
Ersky9xFrSkyAlarmData_v11 frskyAlarms ;
|
||||
// Add 6 bytes for custom telemetry screen
|
||||
uint8_t customDisplayIndex[6] ;
|
||||
Ersky9xCustomFunctionData customFn[ERSKY9X_NUM_FSW];
|
||||
Ersky9xFlightModeData flightModeData[6] ;
|
||||
Ersky9xGvarData gvars[ERSKY9X_MAX_GVARS] ;
|
||||
|
||||
operator ModelData();
|
||||
t_Ersky9xModelData_v11() { memset(this, 0, sizeof(t_Ersky9xModelData_v11)); }
|
||||
}) Ersky9xModelData_v11;
|
||||
|
||||
#endif
|
||||
@@ -1,387 +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 <iostream>
|
||||
#include "ersky9xinterface.h"
|
||||
#include "ersky9xeeprom.h"
|
||||
#include "simulator/ersky9xsimulator.h"
|
||||
#include "file.h"
|
||||
|
||||
#define FILE_TYP_GENERAL 1
|
||||
#define FILE_TYP_MODEL 2
|
||||
|
||||
/// fileId of general file
|
||||
#define FILE_GENERAL 0
|
||||
/// convert model number 0..MAX_MODELS-1 int fileId
|
||||
#define FILE_MODEL(n) (1+n)
|
||||
#define FILE_TMP (1+16)
|
||||
|
||||
Ersky9xInterface::Ersky9xInterface():
|
||||
EEPROMInterface(BOARD_SKY9X),
|
||||
efile(new RleFile())
|
||||
{
|
||||
}
|
||||
|
||||
Ersky9xInterface::~Ersky9xInterface()
|
||||
{
|
||||
delete efile;
|
||||
}
|
||||
|
||||
const char * Ersky9xInterface::getName()
|
||||
{
|
||||
return "Ersky9x";
|
||||
}
|
||||
|
||||
const int Ersky9xInterface::getEEpromSize()
|
||||
{
|
||||
return EESIZE_SKY9X;
|
||||
}
|
||||
|
||||
const int Ersky9xInterface::getMaxModels()
|
||||
{
|
||||
return 20;
|
||||
}
|
||||
|
||||
inline void applyStickModeToModel(Ersky9xModelData_v10 & model, unsigned int mode)
|
||||
{
|
||||
for (int i=0; i<2; i++) {
|
||||
int stick = applyStickMode(i+1, mode) - 1;
|
||||
{
|
||||
int tmp = model.trim[i];
|
||||
model.trim[i] = model.trim[stick];
|
||||
model.trim[stick] = tmp;
|
||||
}
|
||||
{
|
||||
Ersky9xExpoData tmp = model.expoData[i];
|
||||
model.expoData[i] = model.expoData[stick];
|
||||
model.expoData[stick] = tmp;
|
||||
}
|
||||
}
|
||||
for (int i=0; i<ERSKY9X_MAX_MIXERS_V10; i++)
|
||||
model.mixData[i].srcRaw = applyStickMode(model.mixData[i].srcRaw, mode);
|
||||
for (int i=0; i<ERSKY9X_NUM_CSW_V10; i++) {
|
||||
switch (LogicalSwitchData(model.logicalSw[i].func).getFunctionFamily()) {
|
||||
case LS_FAMILY_VCOMP:
|
||||
model.logicalSw[i].v2 = applyStickMode(model.logicalSw[i].v2, mode);
|
||||
// no break
|
||||
case LS_FAMILY_VOFS:
|
||||
model.logicalSw[i].v1 = applyStickMode(model.logicalSw[i].v1, mode);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
model.swashCollectiveSource = applyStickMode(model.swashCollectiveSource, mode);
|
||||
}
|
||||
|
||||
inline void applyStickModeToModel(Ersky9xModelData_v11 & model, unsigned int mode)
|
||||
{
|
||||
for (int i=0; i<2; i++) {
|
||||
int stick = applyStickMode(i+1, mode) - 1;
|
||||
{
|
||||
int tmp = model.trim[i];
|
||||
model.trim[i] = model.trim[stick];
|
||||
model.trim[stick] = tmp;
|
||||
}
|
||||
{
|
||||
Ersky9xExpoData tmp = model.expoData[i];
|
||||
model.expoData[i] = model.expoData[stick];
|
||||
model.expoData[stick] = tmp;
|
||||
}
|
||||
}
|
||||
for (int i=0; i<ERSKY9X_MAX_MIXERS_V11; i++)
|
||||
model.mixData[i].srcRaw = applyStickMode(model.mixData[i].srcRaw, mode);
|
||||
for (int i=0; i<ERSKY9X_NUM_CSW_V11; i++) {
|
||||
switch (LogicalSwitchData(model.logicalSw[i].func).getFunctionFamily()) {
|
||||
case LS_FAMILY_VCOMP:
|
||||
model.logicalSw[i].v2 = applyStickMode(model.logicalSw[i].v2, mode);
|
||||
// no break
|
||||
case LS_FAMILY_VOFS:
|
||||
model.logicalSw[i].v1 = applyStickMode(model.logicalSw[i].v1, mode);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
model.swashCollectiveSource = applyStickMode(model.swashCollectiveSource, mode);
|
||||
}
|
||||
|
||||
unsigned long Ersky9xInterface::loadxml(RadioData &radioData, QDomDocument &doc)
|
||||
{
|
||||
std::cout << "trying ersky9x xml import... ";
|
||||
|
||||
std::bitset<NUM_ERRORS> errors;
|
||||
|
||||
Ersky9xGeneral ersky9xGeneral;
|
||||
memset(&ersky9xGeneral,0,sizeof(ersky9xGeneral));
|
||||
if(!loadGeneralDataXML(&doc, &ersky9xGeneral)) {
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
else {
|
||||
radioData.generalSettings=ersky9xGeneral;
|
||||
std::cout << "version " << (unsigned int)ersky9xGeneral.myVers << " ";
|
||||
}
|
||||
for(int i=0; i<getMaxModels(); i++) {
|
||||
if (ersky9xGeneral.myVers == 10) {
|
||||
if (!loadModelDataXML<Ersky9xModelData_v10>(&doc, &radioData.models[i], i, radioData.generalSettings.stickMode+1)) {
|
||||
std::cout << "ko\n";
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!loadModelDataXML<Ersky9xModelData_v11>(&doc, &radioData.models[i], i, radioData.generalSettings.stickMode+1)) {
|
||||
std::cout << "ko\n";
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
}
|
||||
}
|
||||
std::cout << "ok\n";
|
||||
errors.set(NO_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
unsigned long Ersky9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
|
||||
{
|
||||
std::cout << "trying ersky9x import... ";
|
||||
|
||||
std::bitset<NUM_ERRORS> errors;
|
||||
|
||||
if (size != EESIZE_SKY9X) {
|
||||
std::cout << "wrong size\n";
|
||||
errors.set(WRONG_SIZE);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
if (!efile->EeFsOpen((uint8_t *)eeprom, size, BOARD_SKY9X)) {
|
||||
std::cout << "wrong file system\n";
|
||||
errors.set(WRONG_FILE_SYSTEM);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
efile->openRd(FILE_GENERAL);
|
||||
Ersky9xGeneral ersky9xGeneral;
|
||||
|
||||
if (efile->readRlc2((uint8_t*)&ersky9xGeneral, 1) != 1) {
|
||||
std::cout << "no\n";
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
std::cout << "version " << (unsigned int)ersky9xGeneral.myVers << " ";
|
||||
|
||||
switch(ersky9xGeneral.myVers) {
|
||||
case 10:
|
||||
break;
|
||||
case 11:
|
||||
break;
|
||||
default:
|
||||
std::cout << "not ersky9x\n";
|
||||
errors.set(NOT_ERSKY9X);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
efile->openRd(FILE_GENERAL);
|
||||
if (!efile->readRlc2((uint8_t*)&ersky9xGeneral, sizeof(Ersky9xGeneral))) {
|
||||
std::cout << "ko\n";
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
radioData.generalSettings = ersky9xGeneral;
|
||||
|
||||
for (int i=0; i<getMaxModels(); i++) {
|
||||
uint8_t buffer[4096];
|
||||
uint size;
|
||||
memset(buffer,0,sizeof(buffer));
|
||||
efile->openRd(FILE_MODEL(i));
|
||||
|
||||
// if (!efile->readRlc2((uint8_t*)&ersky9xModel, sizeof(Ersky9xModelData))) {
|
||||
size=efile->readRlc2(buffer, 4096);
|
||||
if (!size) {
|
||||
radioData.models[i].clear();
|
||||
}
|
||||
else {
|
||||
if (size<720) {
|
||||
Ersky9xModelData_v10 ersky9xModel;
|
||||
memcpy(&ersky9xModel, buffer, sizeof(ersky9xModel));
|
||||
applyStickModeToModel(ersky9xModel, radioData.generalSettings.stickMode+1);
|
||||
radioData.models[i] = ersky9xModel;
|
||||
} else {
|
||||
Ersky9xModelData_v11 ersky9xModel;
|
||||
memcpy(&ersky9xModel, buffer, sizeof(ersky9xModel));
|
||||
applyStickModeToModel(ersky9xModel, radioData.generalSettings.stickMode+1);
|
||||
radioData.models[i] = ersky9xModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::cout << "ok\n";
|
||||
errors.set(NO_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
unsigned long Ersky9xInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index)
|
||||
{
|
||||
std::bitset<NUM_ERRORS> errors;
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
int Ersky9xInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t variant, uint8_t version)
|
||||
{
|
||||
std::cout << "NO!\n";
|
||||
// TODO an error
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Ersky9xInterface::getSize(const ModelData & model)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Ersky9xInterface::getSize(const GeneralSettings & settings)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Ersky9xInterface::isAvailable(PulsesProtocol prot, int port)
|
||||
{
|
||||
switch (prot) {
|
||||
case PULSES_PPM:
|
||||
case PULSES_DSM2:
|
||||
case PULSES_PXX_DJT:
|
||||
case PULSES_PPM16:
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void Ersky9xInterface::appendTextElement(QDomDocument * qdoc, QDomElement * pe, QString name, QString value)
|
||||
{
|
||||
QDomElement e = qdoc->createElement(name);
|
||||
QDomText t = qdoc->createTextNode(name);
|
||||
t.setNodeValue(value);
|
||||
e.appendChild(t);
|
||||
pe->appendChild(e);
|
||||
}
|
||||
|
||||
void Ersky9xInterface::appendNumberElement(QDomDocument * qdoc, QDomElement * pe,QString name, int value, bool forceZeroWrite)
|
||||
{
|
||||
if(value || forceZeroWrite) {
|
||||
QDomElement e = qdoc->createElement(name);
|
||||
QDomText t = qdoc->createTextNode(name);
|
||||
t.setNodeValue(QString("%1").arg(value));
|
||||
e.appendChild(t);
|
||||
pe->appendChild(e);
|
||||
}
|
||||
}
|
||||
|
||||
void Ersky9xInterface::appendCDATAElement(QDomDocument * qdoc, QDomElement * pe,QString name, const char * data, int size)
|
||||
{
|
||||
QDomElement e = qdoc->createElement(name);
|
||||
QDomCDATASection t = qdoc->createCDATASection(name);
|
||||
t.setData(QByteArray(data, size).toBase64());
|
||||
e.appendChild(t);
|
||||
pe->appendChild(e);
|
||||
}
|
||||
|
||||
QDomElement Ersky9xInterface::getGeneralDataXML(QDomDocument * qdoc, Ersky9xGeneral * tgen)
|
||||
{
|
||||
QDomElement gd = qdoc->createElement("GENERAL_DATA");
|
||||
appendNumberElement(qdoc, &gd, "Version", tgen->myVers, true); // have to write value here
|
||||
appendTextElement(qdoc, &gd, "Owner", QString::fromAscii(tgen->ownerName,sizeof(tgen->ownerName)).trimmed());
|
||||
appendCDATAElement(qdoc, &gd, "Data", (const char *)tgen,sizeof(Ersky9xGeneral));
|
||||
return gd;
|
||||
}
|
||||
|
||||
QDomElement Ersky9xInterface::getModelDataXML(QDomDocument * qdoc, Ersky9xModelData_v11 * tmod, int modelNum, int mdver)
|
||||
{
|
||||
QDomElement md = qdoc->createElement("MODEL_DATA");
|
||||
md.setAttribute("number", modelNum);
|
||||
appendNumberElement(qdoc, &md, "Version", mdver, true); // have to write value here
|
||||
appendTextElement(qdoc, &md, "Name", QString::fromAscii(tmod->name,sizeof(tmod->name)).trimmed());
|
||||
appendCDATAElement(qdoc, &md, "Data", (const char *)tmod,sizeof(Ersky9xModelData_v11));
|
||||
return md;
|
||||
}
|
||||
|
||||
bool Ersky9xInterface::loadGeneralDataXML(QDomDocument * qdoc, Ersky9xGeneral * tgen)
|
||||
{
|
||||
//look for "GENERAL_DATA" tag
|
||||
QDomElement gde = qdoc->elementsByTagName("GENERAL_DATA").at(0).toElement();
|
||||
|
||||
if(gde.isNull()) // couldn't find
|
||||
return false;
|
||||
|
||||
//load cdata into tgen
|
||||
QDomNode n = gde.elementsByTagName("Data").at(0).firstChild();// get all children in Data
|
||||
while (!n.isNull()) {
|
||||
if (n.isCDATASection()) {
|
||||
QString ds = n.toCDATASection().data();
|
||||
QByteArray ba = QByteArray::fromBase64(ds.toAscii());
|
||||
const char * data = ba.data();
|
||||
memcpy(tgen, data, std::min((unsigned int)ba.size(), (unsigned int)sizeof(Ersky9xGeneral)));
|
||||
break;
|
||||
}
|
||||
n = n.nextSibling();
|
||||
}
|
||||
//check version?
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool Ersky9xInterface::loadModelDataXML(QDomDocument * qdoc, ModelData *model, int modelNum, int stickMode)
|
||||
{
|
||||
T ersky9xModel;
|
||||
memset(&ersky9xModel, 0, sizeof(ersky9xModel));
|
||||
|
||||
//look for MODEL_DATA with modelNum attribute.
|
||||
//if modelNum = -1 then just pick the first one
|
||||
QDomNodeList ndl = qdoc->elementsByTagName("MODEL_DATA");
|
||||
|
||||
//cycle through nodes to find correct model number
|
||||
QDomNode k = ndl.at(0);
|
||||
if (modelNum>=0) {
|
||||
while(!k.isNull()) {
|
||||
int a = k.toElement().attribute("number").toInt();
|
||||
if(a==modelNum)
|
||||
break;
|
||||
k = k.nextSibling();
|
||||
}
|
||||
}
|
||||
|
||||
if (k.isNull()) // couldn't find
|
||||
return false;
|
||||
|
||||
//load cdata into tgen
|
||||
QDomNode n = k.toElement().elementsByTagName("Data").at(0).firstChild();// get all children in Data
|
||||
while (!n.isNull()) {
|
||||
if (n.isCDATASection()) {
|
||||
QString ds = n.toCDATASection().data();
|
||||
QByteArray ba = QByteArray::fromBase64(ds.toAscii());
|
||||
const char * data = ba.data();
|
||||
memcpy(&ersky9xModel, data, std::min(ba.size(), (int)sizeof(ersky9xModel)));
|
||||
break;
|
||||
}
|
||||
n = n.nextSibling();
|
||||
}
|
||||
|
||||
applyStickModeToModel(ersky9xModel, stickMode);
|
||||
*model = ersky9xModel;
|
||||
return true;
|
||||
}
|
||||
@@ -1,73 +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_interface_h
|
||||
#define ersky9x_interface_h
|
||||
#include <QtXml>
|
||||
#include "eeprominterface.h"
|
||||
#include "ersky9xeeprom.h"
|
||||
class RleFile;
|
||||
|
||||
class Ersky9xInterface : public EEPROMInterface
|
||||
{
|
||||
public:
|
||||
|
||||
Ersky9xInterface();
|
||||
|
||||
virtual ~Ersky9xInterface();
|
||||
|
||||
virtual const char * getName();
|
||||
|
||||
virtual const int getEEpromSize();
|
||||
|
||||
virtual const int getMaxModels();
|
||||
|
||||
virtual unsigned long load(RadioData &, const uint8_t * eeprom, int size);
|
||||
|
||||
virtual unsigned long loadBackup(RadioData &, uint8_t * eeprom, int esize, int index);
|
||||
|
||||
virtual unsigned long loadxml(RadioData &radioData, QDomDocument &doc);
|
||||
|
||||
virtual int save(uint8_t * eeprom, RadioData & radioData, uint32_t variant=0, uint8_t version=0);
|
||||
|
||||
virtual int getSize(const ModelData &);
|
||||
|
||||
virtual int getSize(const GeneralSettings & settings);
|
||||
|
||||
virtual int isAvailable(PulsesProtocol proto, int port=0);
|
||||
|
||||
protected:
|
||||
|
||||
RleFile *efile;
|
||||
|
||||
private:
|
||||
void appendTextElement(QDomDocument * qdoc, QDomElement * pe, QString name, QString value);
|
||||
|
||||
void appendNumberElement(QDomDocument * qdoc, QDomElement * pe,QString name, int value, bool forceZeroWrite = false);
|
||||
|
||||
void appendCDATAElement(QDomDocument * qdoc, QDomElement * pe,QString name, const char * data, int size);
|
||||
|
||||
QDomElement getGeneralDataXML(QDomDocument * qdoc, Ersky9xGeneral * tgen); //parse out data to XML format
|
||||
|
||||
QDomElement getModelDataXML(QDomDocument * qdoc, Ersky9xModelData_v11 * tmod, int modelNum, int mdver); //parse out data to XML format
|
||||
|
||||
bool loadGeneralDataXML(QDomDocument * qdoc, Ersky9xGeneral * tgen); // get data from XML
|
||||
|
||||
template <class T>
|
||||
bool loadModelDataXML(QDomDocument * qdoc, ModelData * model, int modelNum, int stickMode); // get data from XML
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,15 +0,0 @@
|
||||
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
|
||||
)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${PROJECT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
add_library(ersky9x-simulator ersky9xsimulator.cpp)
|
||||
@@ -1,246 +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 isBacklightEnable() (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 KEYS_GPIO_REG_MENU PIOB->PIO_PDSR
|
||||
#define KEYS_GPIO_REG_EXIT PIOC->PIO_PDSR
|
||||
#define KEYS_GPIO_REG_UP PIOC->PIO_PDSR
|
||||
#define KEYS_GPIO_REG_DOWN PIOC->PIO_PDSR
|
||||
#define KEYS_GPIO_REG_RIGHT PIOC->PIO_PDSR
|
||||
#define KEYS_GPIO_REG_LEFT PIOC->PIO_PDSR
|
||||
#define KEYS_GPIO_PIN_MENU 0x00000020
|
||||
#define KEYS_GPIO_PIN_EXIT 0x01000000
|
||||
#define KEYS_GPIO_PIN_UP 0x00000002
|
||||
#define KEYS_GPIO_PIN_DOWN 0x00000020
|
||||
#define KEYS_GPIO_PIN_RIGHT 0x00000010
|
||||
#define KEYS_GPIO_PIN_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, KEYS_GPIO_REG_MENU, KEYS_GPIO_PIN_MENU)
|
||||
KEY_CASE(KEY_EXIT, KEYS_GPIO_REG_EXIT, KEYS_GPIO_PIN_EXIT)
|
||||
KEY_CASE(KEY_RIGHT, KEYS_GPIO_REG_RIGHT, KEYS_GPIO_PIN_RIGHT)
|
||||
KEY_CASE(KEY_LEFT, KEYS_GPIO_REG_LEFT, KEYS_GPIO_PIN_LEFT)
|
||||
KEY_CASE(KEY_UP, KEYS_GPIO_REG_UP, KEYS_GPIO_PIN_UP)
|
||||
KEY_CASE(KEY_DOWN, KEYS_GPIO_REG_DOWN, KEYS_GPIO_PIN_DOWN)
|
||||
}
|
||||
}
|
||||
|
||||
#define TRIMS_GPIO_REG_LHL PIOA->PIO_PDSR
|
||||
#define TRIMS_GPIO_REG_LVD PIOA->PIO_PDSR
|
||||
#define TRIMS_GPIO_REG_RVU PIOA->PIO_PDSR
|
||||
#define TRIMS_GPIO_REG_RHL PIOA->PIO_PDSR
|
||||
#define TRIMS_GPIO_REG_LHR PIOB->PIO_PDSR
|
||||
#define TRIMS_GPIO_REG_LVU PIOC->PIO_PDSR
|
||||
#define TRIMS_GPIO_REG_RVD PIOC->PIO_PDSR
|
||||
#define TRIMS_GPIO_REG_RHR 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, TRIMS_GPIO_REG_LHL, PIN_TRIM_LH_L)
|
||||
TRIM_CASE(1, TRIMS_GPIO_REG_LHR, PIN_TRIM_LH_R)
|
||||
TRIM_CASE(2, TRIMS_GPIO_REG_LVD, PIN_TRIM_LV_DN)
|
||||
TRIM_CASE(3, TRIMS_GPIO_REG_LVU, PIN_TRIM_LV_UP)
|
||||
TRIM_CASE(4, TRIMS_GPIO_REG_RVD, PIN_TRIM_RV_DN)
|
||||
TRIM_CASE(5, TRIMS_GPIO_REG_RVU, PIN_TRIM_RV_UP)
|
||||
TRIM_CASE(6, TRIMS_GPIO_REG_RHL, PIN_TRIM_RH_L)
|
||||
TRIM_CASE(7, TRIMS_GPIO_REG_RHR, 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()
|
||||
{
|
||||
return (::uint8_t *)simuLcdBuf;
|
||||
}
|
||||
|
||||
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,70 +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 const char * getError();
|
||||
|
||||
virtual void sendTelemetry(uint8_t * data, unsigned int len) {};
|
||||
|
||||
virtual uint8_t getSensorInstance(uint16_t id) { return 0; };
|
||||
|
||||
virtual uint16_t getSensorRatio(uint16_t id) { return 0; };
|
||||
|
||||
virtual void setTrainerInput(unsigned int inputNumber, int16_t value) {};
|
||||
|
||||
virtual void setLuaStateReloadPermanentScripts() {};
|
||||
|
||||
protected:
|
||||
|
||||
Ersky9xInterface * ersky9xInterface;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,729 +0,0 @@
|
||||
#include <stdlib.h>
|
||||
#include <algorithm>
|
||||
#include "helpers.h"
|
||||
#include "gruvin9xeeprom.h"
|
||||
#include <QObject>
|
||||
|
||||
#define EEPROM_VER 106
|
||||
|
||||
extern void getEEPROMZString(char *dst, const char *src, int size);
|
||||
|
||||
RawSwitch gruvin9xToSwitch(int8_t sw)
|
||||
{
|
||||
if (sw == 0)
|
||||
return RawSwitch(SWITCH_TYPE_NONE);
|
||||
else if (sw <= 9)
|
||||
return RawSwitch(SWITCH_TYPE_SWITCH, sw);
|
||||
else
|
||||
return RawSwitch(SWITCH_TYPE_VIRTUAL, sw > 0 ? sw-9 : sw+9);
|
||||
}
|
||||
|
||||
t_Gruvin9xTrainerMix_v103::operator TrainerMix()
|
||||
{
|
||||
TrainerMix c9x;
|
||||
c9x.src = srcChn;
|
||||
c9x.swtch = gruvin9xToSwitch(swtch);
|
||||
c9x.weight = (25 * studWeight) / 8;
|
||||
c9x.mode = mode;
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Gruvin9xTrainerMix_v104::operator TrainerMix()
|
||||
{
|
||||
TrainerMix c9x;
|
||||
c9x.src = srcChn;
|
||||
c9x.weight = studWeight;
|
||||
c9x.mode = mode;
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Gruvin9xTrainerData_v103::operator TrainerData ()
|
||||
{
|
||||
TrainerData c9x;
|
||||
for (int i=0; i<NUM_STICKS; i++) {
|
||||
c9x.calib[i] = calib[i];
|
||||
c9x.mix[i] = mix[i];
|
||||
}
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Gruvin9xTrainerData_v104::operator TrainerData ()
|
||||
{
|
||||
TrainerData c9x;
|
||||
for (int i=0; i<NUM_STICKS; i++) {
|
||||
c9x.calib[i] = calib[i];
|
||||
c9x.mix[i] = mix[i];
|
||||
}
|
||||
return c9x;
|
||||
}
|
||||
|
||||
Gruvin9xGeneral_v103::operator GeneralSettings ()
|
||||
{
|
||||
GeneralSettings result;
|
||||
|
||||
for (int i=0; i<NUM_STICKS+BOARD_9X_NUM_POTS; i++) {
|
||||
result.calibMid[i] = calibMid[i];
|
||||
result.calibSpanNeg[i] = calibSpanNeg[i];
|
||||
result.calibSpanPos[i] = calibSpanPos[i];
|
||||
}
|
||||
|
||||
result.currModel = currModel;
|
||||
result.contrast = contrast;
|
||||
result.vBatWarn = vBatWarn;
|
||||
result.txVoltageCalibration = txVoltageCalibration;
|
||||
|
||||
result.backlightMode = 0;
|
||||
if (lightSw == 22) {
|
||||
result.backlightMode = 4;
|
||||
}
|
||||
else if (lightAutoOff) {
|
||||
result.backlightMode |= 1;
|
||||
result.backlightDelay = lightAutoOff;
|
||||
}
|
||||
|
||||
result.trainer = trainer;
|
||||
result.view = view;
|
||||
result.disableThrottleWarning = disableThrottleWarning;
|
||||
result.switchWarning = switchWarning;
|
||||
|
||||
switch (beeperVal) {
|
||||
case 0:
|
||||
result.beeperMode = GeneralSettings::BEEPER_QUIET;
|
||||
break;
|
||||
case 1:
|
||||
result.beeperMode = GeneralSettings::BEEPER_NOKEYS;
|
||||
break;
|
||||
default:
|
||||
result.beeperMode = GeneralSettings::BEEPER_ALL;
|
||||
result.beeperLength = beeperVal - 4;
|
||||
break;
|
||||
}
|
||||
|
||||
result.disableMemoryWarning = disableMemoryWarning;
|
||||
result.disableAlarmWarning = disableAlarmWarning;
|
||||
result.stickMode = stickMode;
|
||||
result.inactivityTimer = inactivityTimer;
|
||||
result.minuteBeep = minuteBeep;
|
||||
result.preBeep = preBeep;
|
||||
result.flashBeep = flashBeep;
|
||||
result.splashMode = disableSplashScreen;
|
||||
result.enableTelemetryAlarm = enableTelemetryAlarm;
|
||||
result.templateSetup = templateSetup;
|
||||
result.PPM_Multiplier = PPM_Multiplier;
|
||||
// TODO frskyRssiAlarms[2];
|
||||
return result;
|
||||
}
|
||||
|
||||
Gruvin9xGeneral_v104::operator GeneralSettings ()
|
||||
{
|
||||
GeneralSettings result;
|
||||
|
||||
for (int i=0; i<NUM_STICKS+BOARD_9X_NUM_POTS; i++) {
|
||||
result.calibMid[i] = calibMid[i];
|
||||
result.calibSpanNeg[i] = calibSpanNeg[i];
|
||||
result.calibSpanPos[i] = calibSpanPos[i];
|
||||
}
|
||||
|
||||
result.currModel = currModel;
|
||||
result.contrast = contrast;
|
||||
result.vBatWarn = vBatWarn;
|
||||
result.txVoltageCalibration = txVoltageCalibration;
|
||||
|
||||
result.backlightMode = 0;
|
||||
if (lightSw == 22) {
|
||||
result.backlightMode = 4;
|
||||
}
|
||||
else if (lightAutoOff) {
|
||||
result.backlightMode |= 1;
|
||||
result.backlightDelay = lightAutoOff;
|
||||
}
|
||||
|
||||
result.trainer = trainer;
|
||||
result.view = view;
|
||||
result.disableThrottleWarning = disableThrottleWarning;
|
||||
result.switchWarning = switchWarning;
|
||||
result.beeperMode = (GeneralSettings::BeeperMode)beeperVal;
|
||||
result.disableMemoryWarning = disableMemoryWarning;
|
||||
result.disableAlarmWarning = disableAlarmWarning;
|
||||
result.stickMode = stickMode;
|
||||
result.inactivityTimer = inactivityTimer;
|
||||
result.minuteBeep = minuteBeep;
|
||||
result.preBeep = preBeep;
|
||||
result.flashBeep = flashBeep;
|
||||
result.splashMode = disableSplashScreen;
|
||||
result.enableTelemetryAlarm = enableTelemetryAlarm;
|
||||
result.templateSetup = templateSetup;
|
||||
result.PPM_Multiplier = PPM_Multiplier;
|
||||
// TODO frskyRssiAlarms[2];
|
||||
return result;
|
||||
}
|
||||
|
||||
t_Gruvin9xExpoData::t_Gruvin9xExpoData()
|
||||
{
|
||||
memset(this, 0, sizeof(t_Gruvin9xExpoData));
|
||||
}
|
||||
|
||||
t_Gruvin9xExpoData::operator ExpoData ()
|
||||
{
|
||||
ExpoData c9x;
|
||||
c9x.mode = mode;
|
||||
c9x.chn = chn;
|
||||
c9x.swtch = gruvin9xToSwitch(swtch);
|
||||
if (negPhase) {
|
||||
c9x.flightModes= 1 << (phase -1);
|
||||
} else if (phase==0) {
|
||||
c9x.flightModes=0;
|
||||
} else {
|
||||
c9x.flightModes=63;
|
||||
c9x.flightModes &= ~(1 << (phase -1));
|
||||
}
|
||||
c9x.weight = weight;
|
||||
if (expo) {
|
||||
c9x.curve.type = CurveReference::CURVE_REF_EXPO;
|
||||
c9x.curve.value = expo;
|
||||
}
|
||||
else if (curve > 6) {
|
||||
c9x.curve.type = CurveReference::CURVE_REF_CUSTOM;
|
||||
c9x.curve.value = curve - 6;
|
||||
}
|
||||
else if (curve > 0) {
|
||||
c9x.curve.type = CurveReference::CURVE_REF_FUNC;
|
||||
c9x.curve.value = curve;
|
||||
}
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Gruvin9xLimitData::t_Gruvin9xLimitData()
|
||||
{
|
||||
memset(this, 0, sizeof(t_Gruvin9xLimitData));
|
||||
}
|
||||
|
||||
t_Gruvin9xLimitData::operator LimitData ()
|
||||
{
|
||||
LimitData c9x;
|
||||
c9x.min = 10*(min-100);
|
||||
c9x.max = 10*(max+100);
|
||||
c9x.revert = revert;
|
||||
c9x.offset = offset;
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Gruvin9xMixData::t_Gruvin9xMixData()
|
||||
{
|
||||
memset(this, 0, sizeof(t_Gruvin9xMixData));
|
||||
}
|
||||
|
||||
t_Gruvin9xMixData::operator MixData ()
|
||||
{
|
||||
MixData c9x;
|
||||
c9x.destCh = destCh;
|
||||
c9x.weight = weight;
|
||||
c9x.swtch = gruvin9xToSwitch(swtch);
|
||||
|
||||
if (srcRaw == 0) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_NONE);
|
||||
}
|
||||
else if (srcRaw <= 7) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_STICK, srcRaw-1);
|
||||
}
|
||||
else if (srcRaw == 8) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_MAX);
|
||||
}
|
||||
else if (srcRaw == 9) {
|
||||
if (swtch < 0) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_SWITCH, -swtch - 1);
|
||||
c9x.weight = -weight;
|
||||
}
|
||||
else {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_SWITCH, swtch - 1);
|
||||
}
|
||||
if (mltpx != MLTPX_REP)
|
||||
c9x.swtch = RawSwitch(SWITCH_TYPE_NONE);
|
||||
}
|
||||
else if (srcRaw <= 12) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_CYC, srcRaw-10);
|
||||
}
|
||||
else if (srcRaw <= 20) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_PPM, srcRaw-13);
|
||||
}
|
||||
else {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-21);
|
||||
}
|
||||
|
||||
c9x.delayUp = delayUp;
|
||||
c9x.delayDown = delayDown;
|
||||
c9x.speedUp = speedUp;
|
||||
c9x.speedDown = speedDown;
|
||||
c9x.carryTrim = carryTrim;
|
||||
c9x.mltpx = (MltpxValue)mltpx;
|
||||
c9x.mixWarn = mixWarn;
|
||||
c9x.sOffset = sOffset;
|
||||
|
||||
if (curve > 6) {
|
||||
c9x.curve.type = CurveReference::CURVE_REF_CUSTOM;
|
||||
c9x.curve.value = curve - 6;
|
||||
}
|
||||
else if (curve > 0) {
|
||||
c9x.curve.type = CurveReference::CURVE_REF_FUNC;
|
||||
c9x.curve.value = curve;
|
||||
}
|
||||
|
||||
return c9x;
|
||||
}
|
||||
|
||||
RawSource gruvin9xToSource(int8_t value)
|
||||
{
|
||||
if (value == 0) {
|
||||
return RawSource(SOURCE_TYPE_NONE);
|
||||
}
|
||||
else if (value <= 7) {
|
||||
return RawSource(SOURCE_TYPE_STICK, value - 1);
|
||||
}
|
||||
else if (value == 8) {
|
||||
return RawSource(SOURCE_TYPE_MAX);
|
||||
}
|
||||
else if (value == 9) {
|
||||
return RawSource(SOURCE_TYPE_MAX);
|
||||
}
|
||||
else if (value <= 12) {
|
||||
return RawSource(SOURCE_TYPE_CYC, value-10);
|
||||
}
|
||||
else if (value <= 20) {
|
||||
return RawSource(SOURCE_TYPE_PPM, value-13);
|
||||
}
|
||||
else if (value <= 36) {
|
||||
return RawSource(SOURCE_TYPE_CH, value-21);
|
||||
}
|
||||
else {
|
||||
return RawSource(SOURCE_TYPE_TELEMETRY, value-36);
|
||||
}
|
||||
}
|
||||
|
||||
Gruvin9xLogicalSwitchData::operator LogicalSwitchData ()
|
||||
{
|
||||
LogicalSwitchData c9x;
|
||||
c9x.func = func;
|
||||
c9x.val1 = v1;
|
||||
c9x.val2 = v2;
|
||||
|
||||
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val1 = gruvin9xToSource(v1).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val2 = gruvin9xToSource(v2).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
|
||||
c9x.val1 = gruvin9xToSwitch(v1).toValue();
|
||||
c9x.val2 = gruvin9xToSwitch(v2).toValue();
|
||||
}
|
||||
|
||||
return c9x;
|
||||
}
|
||||
|
||||
Gruvin9xCustomFunctionData::operator CustomFunctionData ()
|
||||
{
|
||||
CustomFunctionData c9x;
|
||||
c9x.swtch = gruvin9xToSwitch(swtch);
|
||||
c9x.func = (AssignFunc)(func + G9X_NUM_CHNOUT);
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Gruvin9xSwashRingData::t_Gruvin9xSwashRingData()
|
||||
{
|
||||
memset(this, 0, sizeof(t_Gruvin9xSwashRingData));
|
||||
}
|
||||
|
||||
t_Gruvin9xSwashRingData::operator SwashRingData ()
|
||||
{
|
||||
SwashRingData c9x;
|
||||
c9x.elevatorWeight = invertELE ? -100 : 100;
|
||||
c9x.aileronWeight = invertAIL ? -100 : 100;
|
||||
c9x.collectiveWeight = invertCOL ? -100 : 100;
|
||||
c9x.type = type;
|
||||
c9x.collectiveSource = gruvin9xToSource(collectiveSource);
|
||||
c9x.value = value;
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Gruvin9xFlightModeData_v102::operator FlightModeData ()
|
||||
{
|
||||
FlightModeData c9x;
|
||||
for (int i=0; i<NUM_STICKS; i++)
|
||||
c9x.trim[i] = trim[i];
|
||||
c9x.swtch = gruvin9xToSwitch(swtch);
|
||||
getEEPROMZString(c9x.name, name, sizeof(name));
|
||||
c9x.fadeIn = fadeIn;
|
||||
c9x.fadeOut = fadeOut;
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Gruvin9xFlightModeData_v106::operator FlightModeData ()
|
||||
{
|
||||
FlightModeData c9x;
|
||||
for (int i=0; i<NUM_STICKS; i++)
|
||||
c9x.trim[i] = (((int16_t)trim[i]) << 2) + ((trim_ext >> (2*i)) & 0x03);
|
||||
c9x.swtch = gruvin9xToSwitch(swtch);
|
||||
getEEPROMZString(c9x.name, name, sizeof(name));
|
||||
c9x.fadeIn = fadeIn;
|
||||
c9x.fadeOut = fadeOut;
|
||||
return c9x;
|
||||
}
|
||||
|
||||
extern RawSwitch getEr9xTimerMode(int mode);
|
||||
|
||||
t_Gruvin9xTimerData::operator TimerData ()
|
||||
{
|
||||
TimerData c9x;
|
||||
c9x.mode = getEr9xTimerMode(mode);
|
||||
c9x.val = val;
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Gruvin9xFrSkyChannelData::t_Gruvin9xFrSkyChannelData()
|
||||
{
|
||||
memset(this, 0, sizeof(t_Gruvin9xFrSkyChannelData));
|
||||
}
|
||||
|
||||
t_Gruvin9xFrSkyChannelData::operator FrSkyChannelData ()
|
||||
{
|
||||
FrSkyChannelData c9x;
|
||||
c9x.ratio = ratio;
|
||||
c9x.alarms[0].value = alarms_value[0];
|
||||
c9x.alarms[0].level = alarms_level & 3;
|
||||
c9x.alarms[0].greater = alarms_greater & 1;
|
||||
c9x.alarms[1].value = alarms_value[1];
|
||||
c9x.alarms[1].level = (alarms_level >> 2) & 3;
|
||||
c9x.alarms[1].greater = (alarms_greater >> 1) & 1;
|
||||
c9x.type = type;
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Gruvin9xFrSkyData::t_Gruvin9xFrSkyData()
|
||||
{
|
||||
memset(this, 0, sizeof(t_Gruvin9xFrSkyData));
|
||||
}
|
||||
|
||||
t_Gruvin9xFrSkyData::operator FrSkyData ()
|
||||
{
|
||||
FrSkyData c9x;
|
||||
c9x.channels[0] = channels[0];
|
||||
c9x.channels[1] = channels[1];
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Gruvin9xModelData_v102::operator ModelData ()
|
||||
{
|
||||
ModelData c9x;
|
||||
c9x.used = true;
|
||||
getEEPROMString(c9x.name, name, sizeof(name));
|
||||
c9x.timers[0] = timer1;
|
||||
c9x.timers[1] = timer2;
|
||||
|
||||
switch(protocol) {
|
||||
case 1:
|
||||
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
|
||||
break;
|
||||
case 2:
|
||||
c9x.moduleData[0].protocol = PULSES_DSM2;
|
||||
break;
|
||||
case 3:
|
||||
c9x.moduleData[0].protocol = PULSES_SILV_A;
|
||||
break;
|
||||
case 4:
|
||||
c9x.moduleData[0].protocol = PULSES_SILV_B;
|
||||
break;
|
||||
case 5:
|
||||
c9x.moduleData[0].protocol = PULSES_SILV_C;
|
||||
break;
|
||||
case 6:
|
||||
c9x.moduleData[0].protocol = PULSES_CTP1009;
|
||||
break;
|
||||
default:
|
||||
c9x.moduleData[0].protocol = PULSES_PPM;
|
||||
break;
|
||||
}
|
||||
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.trimInc = trimInc-2;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.beepANACenter = beepANACenter;
|
||||
c9x.moduleData[0].ppmPulsePol = pulsePol;
|
||||
c9x.extendedLimits = extendedLimits;
|
||||
for (int i=0; i<G9X_MAX_FLIGHT_MODES; i++)
|
||||
c9x.flightModeData[i] = flightModeData[i];
|
||||
for (int i=0; i<G9X_MAX_MIXERS; i++)
|
||||
c9x.mixData[i] = mixData[i];
|
||||
for (int i=0; i<G9X_NUM_CHNOUT; i++)
|
||||
c9x.limitData[i] = limitData[i];
|
||||
for (int i=0; i<G9X_MAX_EXPOS; i++)
|
||||
c9x.expoData[i] = expoData[i];
|
||||
|
||||
for (int i=0; i<G9X_MAX_CURVE5; i++) {
|
||||
c9x.curves[i].count = 5;
|
||||
for (int j = 0; j < 5; j++) {
|
||||
c9x.curves[i].points[j].x = -100 + 50 * i;
|
||||
c9x.curves[i].points[j].y = curves5[i][j];
|
||||
}
|
||||
}
|
||||
for (int i=0; i<G9X_MAX_CURVE9; i++) {
|
||||
c9x.curves[G9X_MAX_CURVE5 + i].count = 9;
|
||||
for (int j = 0; j < 9; j++) {
|
||||
c9x.curves[G9X_MAX_CURVE5 + i].points[j].x = -100 + 25 * i;
|
||||
c9x.curves[G9X_MAX_CURVE5 + i].points[j].y = curves9[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=0; i<G9X_NUM_CSW; i++)
|
||||
c9x.logicalSw[i] = logicalSw[i];
|
||||
// for (int i=0; i<G9X_NUM_CHNOUT; i++)
|
||||
// c9x.safetySw[i] = safetySw[i];
|
||||
c9x.swashRingData = swashR;
|
||||
c9x.frsky = frsky;
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Gruvin9xModelData_v103::operator ModelData ()
|
||||
{
|
||||
ModelData c9x;
|
||||
c9x.used = true;
|
||||
getEEPROMZString(c9x.name, name, sizeof(name));
|
||||
c9x.timers[0] = timer1;
|
||||
c9x.timers[1] = timer2;
|
||||
switch(protocol) {
|
||||
case 1:
|
||||
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
|
||||
break;
|
||||
case 2:
|
||||
c9x.moduleData[0].protocol = PULSES_DSM2;
|
||||
break;
|
||||
case 3:
|
||||
c9x.moduleData[0].protocol = PULSES_SILV_A;
|
||||
break;
|
||||
case 4:
|
||||
c9x.moduleData[0].protocol = PULSES_SILV_B;
|
||||
break;
|
||||
case 5:
|
||||
c9x.moduleData[0].protocol = PULSES_SILV_C;
|
||||
break;
|
||||
case 6:
|
||||
c9x.moduleData[0].protocol = PULSES_CTP1009;
|
||||
break;
|
||||
default:
|
||||
c9x.moduleData[0].protocol = PULSES_PPM;
|
||||
break;
|
||||
}
|
||||
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.trimInc = trimInc-2;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.beepANACenter = beepANACenter;
|
||||
c9x.moduleData[0].ppmPulsePol = pulsePol;
|
||||
c9x.extendedLimits = extendedLimits;
|
||||
for (int i=0; i<G9X_MAX_FLIGHT_MODES; i++)
|
||||
c9x.flightModeData[i] = flightModeData[i];
|
||||
for (int i=0; i<G9X_MAX_MIXERS; i++)
|
||||
c9x.mixData[i] = mixData[i];
|
||||
for (int i=0; i<G9X_NUM_CHNOUT; i++)
|
||||
c9x.limitData[i] = limitData[i];
|
||||
for (int i=0; i<G9X_MAX_EXPOS; i++)
|
||||
c9x.expoData[i] = expoData[i];
|
||||
|
||||
for (int i=0; i<G9X_MAX_CURVE5; i++) {
|
||||
c9x.curves[i].count = 5;
|
||||
for (int j = 0; j < 5; j++) {
|
||||
c9x.curves[i].points[j].x = -100 + 50 * i;
|
||||
c9x.curves[i].points[j].y = curves5[i][j];
|
||||
}
|
||||
}
|
||||
for (int i=0; i<G9X_MAX_CURVE9; i++) {
|
||||
c9x.curves[G9X_MAX_CURVE5 + i].count = 9;
|
||||
for (int j = 0; j < 9; j++) {
|
||||
c9x.curves[G9X_MAX_CURVE5 + i].points[j].x = -100 + 25 * i;
|
||||
c9x.curves[G9X_MAX_CURVE5 + i].points[j].y = curves9[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=0; i<G9X_NUM_CSW; i++)
|
||||
c9x.logicalSw[i] = logicalSw[i];
|
||||
// for (int i=0; i<G9X_NUM_CHNOUT; i++)
|
||||
// c9x.safetySw[i] = safetySw[i];
|
||||
c9x.swashRingData = swashR;
|
||||
c9x.frsky = frsky;
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Gruvin9xModelData_v105::operator ModelData ()
|
||||
{
|
||||
ModelData c9x;
|
||||
c9x.used = true;
|
||||
getEEPROMZString(c9x.name, name, sizeof(name));
|
||||
c9x.timers[0] = timer1;
|
||||
c9x.timers[1] = timer2;
|
||||
switch(protocol) {
|
||||
case 1:
|
||||
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
|
||||
break;
|
||||
case 2:
|
||||
c9x.moduleData[0].protocol = PULSES_DSM2;
|
||||
break;
|
||||
case 3:
|
||||
c9x.moduleData[0].protocol = PULSES_SILV_A;
|
||||
break;
|
||||
case 4:
|
||||
c9x.moduleData[0].protocol = PULSES_SILV_B;
|
||||
break;
|
||||
case 5:
|
||||
c9x.moduleData[0].protocol = PULSES_SILV_C;
|
||||
break;
|
||||
case 6:
|
||||
c9x.moduleData[0].protocol = PULSES_CTP1009;
|
||||
break;
|
||||
default:
|
||||
c9x.moduleData[0].protocol = PULSES_PPM;
|
||||
break;
|
||||
}
|
||||
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.trimInc = trimInc-2;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.beepANACenter = beepANACenter;
|
||||
c9x.moduleData[0].ppmPulsePol = pulsePol;
|
||||
c9x.extendedLimits = extendedLimits;
|
||||
c9x.extendedTrims = extendedTrims;
|
||||
for (int i=0; i<G9X_MAX_FLIGHT_MODES; i++) {
|
||||
c9x.flightModeData[i] = flightModeData[i];
|
||||
for (int j=0; j<NUM_STICKS; j++) {
|
||||
if (flightModeData[i].trim[j] > 125) {
|
||||
c9x.flightModeData[i].trimRef[j] = 0;
|
||||
c9x.flightModeData[i].trim[j] = 0;
|
||||
}
|
||||
else if (flightModeData[i].trim[j] < -125) {
|
||||
c9x.flightModeData[i].trimRef[j] = 129 + flightModeData[i].trim[j];
|
||||
if (c9x.flightModeData[i].trimRef[j] >= i)
|
||||
c9x.flightModeData[i].trimRef[j] += 1;
|
||||
c9x.flightModeData[i].trim[j] = 0;
|
||||
}
|
||||
else {
|
||||
c9x.flightModeData[i].trim[j] += subtrim[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i=0; i<G9X_MAX_MIXERS; i++)
|
||||
c9x.mixData[i] = mixData[i];
|
||||
for (int i=0; i<G9X_NUM_CHNOUT; i++)
|
||||
c9x.limitData[i] = limitData[i];
|
||||
for (int i=0; i<G9X_MAX_EXPOS; i++)
|
||||
c9x.expoData[i] = expoData[i];
|
||||
|
||||
for (int i=0; i<G9X_MAX_CURVE5; i++) {
|
||||
c9x.curves[i].count = 5;
|
||||
for (int j = 0; j < 5; j++) {
|
||||
c9x.curves[i].points[j].x = -100 + 50 * i;
|
||||
c9x.curves[i].points[j].y = curves5[i][j];
|
||||
}
|
||||
}
|
||||
for (int i=0; i<G9X_MAX_CURVE9; i++) {
|
||||
c9x.curves[G9X_MAX_CURVE5 + i].count = 9;
|
||||
for (int j = 0; j < 9; j++) {
|
||||
c9x.curves[G9X_MAX_CURVE5 + i].points[j].x = -100 + 25 * i;
|
||||
c9x.curves[G9X_MAX_CURVE5 + i].points[j].y = curves9[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=0; i<G9X_NUM_CSW; i++)
|
||||
c9x.logicalSw[i] = logicalSw[i];
|
||||
for (int i=0; i<G9X_NUM_FSW; i++)
|
||||
c9x.customFn[i] = customFn[i];
|
||||
// for (int i=0; i<G9X_NUM_CHNOUT; i++)
|
||||
// c9x.safetySw[i] = safetySw[i];
|
||||
c9x.swashRingData = swashR;
|
||||
c9x.frsky = frsky;
|
||||
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Gruvin9xModelData_v106::operator ModelData ()
|
||||
{
|
||||
ModelData c9x;
|
||||
c9x.used = true;
|
||||
getEEPROMZString(c9x.name, name, sizeof(name));
|
||||
c9x.timers[0] = timer1;
|
||||
c9x.timers[1] = timer2;
|
||||
switch(protocol) {
|
||||
case 1:
|
||||
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
|
||||
break;
|
||||
case 2:
|
||||
c9x.moduleData[0].protocol = PULSES_DSM2;
|
||||
break;
|
||||
case 3:
|
||||
c9x.moduleData[0].protocol = PULSES_SILV_A;
|
||||
break;
|
||||
case 4:
|
||||
c9x.moduleData[0].protocol = PULSES_SILV_B;
|
||||
break;
|
||||
case 5:
|
||||
c9x.moduleData[0].protocol = PULSES_SILV_C;
|
||||
break;
|
||||
case 6:
|
||||
c9x.moduleData[0].protocol = PULSES_CTP1009;
|
||||
break;
|
||||
default:
|
||||
c9x.moduleData[0].protocol = PULSES_PPM;
|
||||
break;
|
||||
}
|
||||
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.trimInc = trimInc-2;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.beepANACenter = beepANACenter;
|
||||
c9x.moduleData[0].ppmPulsePol = pulsePol;
|
||||
c9x.extendedLimits = extendedLimits;
|
||||
c9x.extendedTrims = extendedTrims;
|
||||
for (int i=0; i<G9X_MAX_FLIGHT_MODES; i++) {
|
||||
c9x.flightModeData[i] = flightModeData[i];
|
||||
for (int j=0; j<NUM_STICKS; j++) {
|
||||
if (c9x.flightModeData[i].trim[j] > 500) {
|
||||
c9x.flightModeData[i].trimRef[j] = c9x.flightModeData[i].trim[j] - 501;
|
||||
if (c9x.flightModeData[i].trimRef[j] >= i)
|
||||
c9x.flightModeData[i].trimRef[j] += 1;
|
||||
c9x.flightModeData[i].trim[j] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i=0; i<G9X_MAX_MIXERS; i++)
|
||||
c9x.mixData[i] = mixData[i];
|
||||
for (int i=0; i<G9X_NUM_CHNOUT; i++)
|
||||
c9x.limitData[i] = limitData[i];
|
||||
for (int i=0; i<G9X_MAX_EXPOS; i++)
|
||||
c9x.expoData[i] = expoData[i];
|
||||
|
||||
for (int i=0; i<G9X_MAX_CURVE5; i++) {
|
||||
c9x.curves[i].count = 5;
|
||||
for (int j = 0; j < 5; j++) {
|
||||
c9x.curves[i].points[j].x = -100 + 50 * i;
|
||||
c9x.curves[i].points[j].y = curves5[i][j];
|
||||
}
|
||||
}
|
||||
for (int i=0; i<G9X_MAX_CURVE9; i++) {
|
||||
c9x.curves[G9X_MAX_CURVE5 + i].count = 9;
|
||||
for (int j = 0; j < 9; j++) {
|
||||
c9x.curves[G9X_MAX_CURVE5 + i].points[j].x = -100 + 25 * i;
|
||||
c9x.curves[G9X_MAX_CURVE5 + i].points[j].y = curves9[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=0; i<G9X_NUM_CSW; i++)
|
||||
c9x.logicalSw[i] = logicalSw[i];
|
||||
for (int i=0; i<G9X_NUM_FSW; i++)
|
||||
c9x.customFn[i] = customFn[i];
|
||||
// for (int i=0; i<G9X_NUM_CHNOUT; i++)
|
||||
// c9x.safetySw[i] = safetySw[i];
|
||||
c9x.swashRingData = swashR;
|
||||
c9x.frsky = frsky;
|
||||
|
||||
return c9x;
|
||||
}
|
||||
|
||||
@@ -1,421 +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 gruvin9xeeprom_h
|
||||
#define gruvin9xeeprom_h
|
||||
|
||||
#include <inttypes.h>
|
||||
#include "eeprominterface.h"
|
||||
#define GR9X_MAX_CSFUNC 13
|
||||
|
||||
PACK(typedef struct t_Gruvin9xTrainerMix_v103 {
|
||||
uint8_t srcChn:3; //0-7 = ch1-8
|
||||
int8_t swtch:5;
|
||||
int8_t studWeight:6;
|
||||
uint8_t mode:2; //off,add-mode,subst-mode
|
||||
|
||||
operator TrainerMix();
|
||||
t_Gruvin9xTrainerMix_v103() { memset(this, 0, sizeof(t_Gruvin9xTrainerMix_v103)); }
|
||||
|
||||
}) Gruvin9xTrainerMix_v103; //
|
||||
|
||||
PACK(typedef struct t_Gruvin9xTrainerMix_v104 {
|
||||
uint8_t srcChn:6; // 0-7 = ch1-8
|
||||
uint8_t mode:2; // off,add-mode,subst-mode
|
||||
int8_t studWeight;
|
||||
|
||||
operator TrainerMix();
|
||||
t_Gruvin9xTrainerMix_v104() { memset(this, 0, sizeof(t_Gruvin9xTrainerMix_v104)); }
|
||||
}) Gruvin9xTrainerMix_v104; //
|
||||
|
||||
PACK(typedef struct t_Gruvin9xTrainerData_v103 {
|
||||
int16_t calib[4];
|
||||
Gruvin9xTrainerMix_v103 mix[4];
|
||||
|
||||
operator TrainerData();
|
||||
}) Gruvin9xTrainerData_v103;
|
||||
|
||||
PACK(typedef struct t_Gruvin9xTrainerData_v104 {
|
||||
int16_t calib[4];
|
||||
Gruvin9xTrainerMix_v104 mix[4];
|
||||
|
||||
operator TrainerData();
|
||||
t_Gruvin9xTrainerData_v104() { memset(this, 0, sizeof(t_Gruvin9xTrainerData_v104)); }
|
||||
}) Gruvin9xTrainerData_v104;
|
||||
|
||||
PACK(typedef struct t_Gruvin9xFrSkyRSSIAlarm {
|
||||
uint8_t level:2;
|
||||
int8_t value:6;
|
||||
}) Gruvin9xFrSkyRSSIAlarm;
|
||||
|
||||
PACK(typedef struct t_Gruvin9xGeneral_v103 {
|
||||
uint8_t myVers;
|
||||
int16_t calibMid[7];
|
||||
int16_t calibSpanNeg[7];
|
||||
int16_t calibSpanPos[7];
|
||||
uint16_t chkSum;
|
||||
uint8_t currModel; //0..15
|
||||
uint8_t contrast;
|
||||
uint8_t vBatWarn;
|
||||
int8_t txVoltageCalibration;
|
||||
int8_t lightSw;
|
||||
Gruvin9xTrainerData_v103 trainer;
|
||||
uint8_t view; //index of subview in main scrren
|
||||
uint8_t disableThrottleWarning:1;
|
||||
int8_t switchWarning:2; // -1=down, 0=off, 1=up
|
||||
uint8_t beeperVal:3;
|
||||
uint8_t disableMemoryWarning:1;
|
||||
uint8_t disableAlarmWarning:1;
|
||||
uint8_t stickMode;
|
||||
uint8_t inactivityTimer;
|
||||
uint8_t throttleReversed:1;
|
||||
uint8_t minuteBeep:1;
|
||||
uint8_t preBeep:1;
|
||||
uint8_t flashBeep:1;
|
||||
uint8_t disableSplashScreen:1;
|
||||
uint8_t enableTelemetryAlarm:1; // 0=no, 1=yes (Sound alarm when there's no telem. data coming in)
|
||||
uint8_t spare:2;
|
||||
uint8_t filterInput;
|
||||
uint8_t lightAutoOff;
|
||||
uint8_t templateSetup; //RETA order according to chout_ar array
|
||||
int8_t PPM_Multiplier;
|
||||
Gruvin9xFrSkyRSSIAlarm frskyRssiAlarms[2];
|
||||
|
||||
operator GeneralSettings();
|
||||
t_Gruvin9xGeneral_v103() { memset(this, 0, sizeof(t_Gruvin9xGeneral_v103)); }
|
||||
}) Gruvin9xGeneral_v103;
|
||||
|
||||
PACK(typedef struct t_Gruvin9xGeneral_v104 {
|
||||
uint8_t myVers;
|
||||
int16_t calibMid[7];
|
||||
int16_t calibSpanNeg[7];
|
||||
int16_t calibSpanPos[7];
|
||||
uint16_t chkSum;
|
||||
uint8_t currModel; //0..15
|
||||
uint8_t contrast;
|
||||
uint8_t vBatWarn;
|
||||
int8_t txVoltageCalibration;
|
||||
int8_t lightSw;
|
||||
Gruvin9xTrainerData_v104 trainer;
|
||||
uint8_t view; //index of subview in main scrren
|
||||
uint8_t disableThrottleWarning:1;
|
||||
int8_t switchWarning:2; // -1=down, 0=off, 1=up
|
||||
uint8_t beeperVal:3;
|
||||
uint8_t disableMemoryWarning:1;
|
||||
uint8_t disableAlarmWarning:1;
|
||||
uint8_t stickMode;
|
||||
uint8_t inactivityTimer;
|
||||
uint8_t throttleReversed:1;
|
||||
uint8_t minuteBeep:1;
|
||||
uint8_t preBeep:1;
|
||||
uint8_t flashBeep:1;
|
||||
uint8_t disableSplashScreen:1;
|
||||
uint8_t enableTelemetryAlarm:1; // 0=no, 1=yes (Sound alarm when there's no telem. data coming in)
|
||||
uint8_t spare:2;
|
||||
uint8_t filterInput;
|
||||
uint8_t lightAutoOff;
|
||||
uint8_t templateSetup; //RETA order according to chout_ar array
|
||||
int8_t PPM_Multiplier;
|
||||
Gruvin9xFrSkyRSSIAlarm frskyRssiAlarms[2];
|
||||
|
||||
operator GeneralSettings();
|
||||
t_Gruvin9xGeneral_v104() { memset(this, 0, sizeof(t_Gruvin9xGeneral_v104)); }
|
||||
}) Gruvin9xGeneral_v104;
|
||||
|
||||
typedef Gruvin9xGeneral_v104 Gruvin9xGeneral;
|
||||
|
||||
// eeprom modelspec
|
||||
|
||||
PACK(typedef struct t_Gruvin9xExpoData {
|
||||
uint8_t mode:2; // 0=end, 1=pos, 2=neg, 3=both
|
||||
uint8_t chn:2;
|
||||
uint8_t curve:4; // 0=no curve, 1-6=std curves, 7-10=CV1-CV4, 11-15=CV9-CV13
|
||||
int8_t swtch:5;
|
||||
uint8_t phase:3; // if negPhase is 0: 0=normal, 5=FP4 if negPhase is 1: 5=!FP4
|
||||
uint8_t negPhase:1;
|
||||
uint8_t weight:7;
|
||||
int8_t expo;
|
||||
|
||||
operator ExpoData();
|
||||
t_Gruvin9xExpoData();
|
||||
}) Gruvin9xExpoData;
|
||||
|
||||
PACK(typedef struct t_Gruvin9xLimitData {
|
||||
int8_t min;
|
||||
int8_t max;
|
||||
bool revert;
|
||||
int16_t offset;
|
||||
|
||||
operator LimitData();
|
||||
t_Gruvin9xLimitData();
|
||||
}) Gruvin9xLimitData;
|
||||
|
||||
#define MLTPX_ADD 0
|
||||
#define MLTPX_MUL 1
|
||||
#define MLTPX_REP 2
|
||||
|
||||
PACK(typedef struct t_Gruvin9xMixData {
|
||||
uint8_t destCh:5; // 0, 1..C9X_NUM_CHNOUT
|
||||
uint8_t mixWarn:3; // mixer warning
|
||||
uint8_t srcRaw; //
|
||||
int8_t weight;
|
||||
int8_t swtch;
|
||||
uint8_t curve; // 0=symmetrisch, 1=no neg, 2=no pos
|
||||
uint8_t delayUp:4;
|
||||
uint8_t delayDown:4;
|
||||
uint8_t speedUp:4; // Servogeschwindigkeit aus Tabelle (10ms Cycle)
|
||||
uint8_t speedDown:4; // 0 nichts
|
||||
uint8_t carryTrim:1;
|
||||
uint8_t mltpx:3; // multiplex method 0=+ 1=* 2=replace
|
||||
int8_t phase:4; // -5=!FP4, 0=normal, 5=FP4
|
||||
int8_t sOffset;
|
||||
|
||||
operator MixData();
|
||||
t_Gruvin9xMixData();
|
||||
}) Gruvin9xMixData;
|
||||
|
||||
PACK(typedef struct t_Gruvin9xLogicalSwitchData { // Custom Switches data
|
||||
int8_t v1; //input
|
||||
int8_t v2; //offset
|
||||
uint8_t func;
|
||||
|
||||
operator LogicalSwitchData();
|
||||
t_Gruvin9xLogicalSwitchData() { memset(this, 0, sizeof(t_Gruvin9xLogicalSwitchData)); }
|
||||
}) Gruvin9xLogicalSwitchData;
|
||||
|
||||
PACK(typedef struct t_Gruvin9xSafetySwData { // Safety Switches data
|
||||
int8_t swtch;
|
||||
int8_t val;
|
||||
|
||||
t_Gruvin9xSafetySwData() { memset(this, 0, sizeof(t_Gruvin9xSafetySwData)); }
|
||||
}) Gruvin9xSafetySwData;
|
||||
|
||||
PACK(typedef struct t_Gruvin9xCustomFunctionData { // Function Switches data
|
||||
int8_t swtch; // input
|
||||
uint8_t func;
|
||||
|
||||
operator CustomFunctionData();
|
||||
t_Gruvin9xCustomFunctionData() { memset(this, 0, sizeof(t_Gruvin9xCustomFunctionData)); }
|
||||
}) Gruvin9xCustomFunctionData;
|
||||
|
||||
PACK(typedef struct t_Gruvin9xFrSkyChannelData {
|
||||
uint16_t ratio:12; // (Maximum resistor divider input volts +/- calibration. 0 means channel not used.
|
||||
// 0.01v steps from 0 to 40.95V. Ex. 6.60 Volts = 660. 40.95V = 4095
|
||||
uint16_t type:4; // channel display unit (0=volts, 1=raw, 2-15=reserverd.)
|
||||
uint8_t alarms_value[2]; // raw sample values 0..255
|
||||
uint8_t alarms_level:4; // two pairs of 2bits. none=0, yel=1, org=2, red=3
|
||||
uint8_t alarms_greater:2; // two alarms, 1 bit each. 0=LT(<), 1=GT(>)
|
||||
uint8_t spare:2;
|
||||
uint8_t barMin; // minimum for bar display (raw ADC value)
|
||||
uint8_t barMax; // ditto for max display (would G:NOT usually = ratio)
|
||||
|
||||
operator FrSkyChannelData();
|
||||
t_Gruvin9xFrSkyChannelData();
|
||||
}) Gruvin9xFrSkyChannelData;
|
||||
|
||||
PACK(typedef struct t_Gruvin9xFrSkyData {
|
||||
Gruvin9xFrSkyChannelData channels[2];
|
||||
|
||||
operator FrSkyData();
|
||||
t_Gruvin9xFrSkyData();
|
||||
}) Gruvin9xFrSkyData;
|
||||
|
||||
PACK(typedef struct t_Gruvin9xSwashRingData { // Swash Ring data
|
||||
uint8_t invertELE:1;
|
||||
uint8_t invertAIL:1;
|
||||
uint8_t invertCOL:1;
|
||||
uint8_t type:5;
|
||||
uint8_t collectiveSource;
|
||||
uint8_t value;
|
||||
|
||||
operator SwashRingData();
|
||||
t_Gruvin9xSwashRingData();
|
||||
}) Gruvin9xSwashRingData;
|
||||
|
||||
PACK(typedef struct t_Gruvin9xFlightModeData_v102 {
|
||||
int8_t trim[4]; // -125..125 => trim value, 127 => use trim of phase 0, -128, -127, -126 => use trim of phases 1|2|3|4 instead
|
||||
int8_t swtch; // swtch of phase[0] is not used
|
||||
char name[6];
|
||||
uint8_t fadeIn:4;
|
||||
uint8_t fadeOut:4;
|
||||
|
||||
operator FlightModeData();
|
||||
t_Gruvin9xFlightModeData_v102() { memset(this, 0, sizeof(t_Gruvin9xFlightModeData_v102)); }
|
||||
}) Gruvin9xFlightModeData_v102;
|
||||
|
||||
|
||||
PACK(typedef struct t_Gruvin9xFlightModeData_v106 {
|
||||
int8_t trim[4]; // -500..500 => trim value, 501 => use trim of phase 0, 502, 503, 504 => use trim of phases 1|2|3|4 instead
|
||||
int8_t trim_ext:8; // 2 less significant extra bits per trim (10bits trims)
|
||||
int8_t swtch; // swtch of phase[0] is not used
|
||||
char name[6];
|
||||
uint8_t fadeIn:4;
|
||||
uint8_t fadeOut:4;
|
||||
|
||||
operator FlightModeData();
|
||||
t_Gruvin9xFlightModeData_v106() { memset(this, 0, sizeof(t_Gruvin9xFlightModeData_v106)); }
|
||||
}) Gruvin9xFlightModeData_v106;
|
||||
|
||||
PACK(typedef struct t_Gruvin9xTimerData {
|
||||
int8_t mode:7; // timer trigger source -> off, abs, stk, stk%, sw/!sw, !m_sw/!m_sw
|
||||
uint8_t dir:1; // 0=>Count Down, 1=>Count Up
|
||||
uint16_t val;
|
||||
|
||||
operator TimerData();
|
||||
t_Gruvin9xTimerData() { memset(this, 0, sizeof(t_Gruvin9xTimerData)); }
|
||||
}) Gruvin9xTimerData;
|
||||
|
||||
#define G9X_MAX_FLIGHT_MODES 5
|
||||
#define G9X_MAX_MIXERS 32
|
||||
#define G9X_MAX_EXPOS 14
|
||||
#define G9X_MAX_CURVE5 8
|
||||
#define G9X_MAX_CURVE9 8
|
||||
|
||||
#define G9X_NUM_CHNOUT 16 // number of real output channels CH1-CH16
|
||||
#define G9X_NUM_CSW 12 // number of custom switches
|
||||
#define G9X_NUM_FSW 12 // number of functions assigned to switches
|
||||
|
||||
// TODO
|
||||
PACK(typedef struct t_Gruvin9xModelData_v102 {
|
||||
char name[10]; // 10 must be first for eeLoadModelName
|
||||
Gruvin9xTimerData timer1;
|
||||
uint8_t protocol:3;
|
||||
int8_t ppmNCH:3;
|
||||
uint8_t thrTrim:1; // Enable Throttle Trim
|
||||
uint8_t thrExpo:1; // Enable Throttle Expo
|
||||
uint8_t trimInc:3; // Trim Increments
|
||||
uint8_t spare1:1;
|
||||
uint8_t pulsePol:1;
|
||||
uint8_t extendedLimits:1;
|
||||
uint8_t extendedTrims:1;
|
||||
uint8_t spare2:1;
|
||||
int8_t ppmDelay;
|
||||
uint8_t beepANACenter; // 1<<0->A1.. 1<<6->A7
|
||||
Gruvin9xTimerData timer2;
|
||||
Gruvin9xMixData mixData[G9X_MAX_MIXERS];
|
||||
Gruvin9xLimitData limitData[G9X_NUM_CHNOUT];
|
||||
Gruvin9xExpoData expoData[G9X_MAX_EXPOS];
|
||||
int8_t curves5[G9X_MAX_CURVE5][5];
|
||||
int8_t curves9[G9X_MAX_CURVE9][9];
|
||||
Gruvin9xLogicalSwitchData logicalSw[G9X_NUM_CSW];
|
||||
Gruvin9xSafetySwData safetySw[G9X_NUM_CHNOUT];
|
||||
Gruvin9xSwashRingData swashR;
|
||||
Gruvin9xFlightModeData_v102 flightModeData[G9X_MAX_FLIGHT_MODES];
|
||||
Gruvin9xFrSkyData frsky;
|
||||
|
||||
operator ModelData();
|
||||
t_Gruvin9xModelData_v102() { memset(this, 0, sizeof(t_Gruvin9xModelData_v102)); }
|
||||
|
||||
}) Gruvin9xModelData_v102;
|
||||
|
||||
PACK(typedef struct t_Gruvin9xModelData_v103 {
|
||||
char name[10]; // 10 must be first for eeLoadModelName
|
||||
Gruvin9xTimerData timer1;
|
||||
uint8_t protocol:3;
|
||||
int8_t ppmNCH:3;
|
||||
uint8_t thrTrim:1; // Enable Throttle Trim
|
||||
uint8_t thrExpo:1; // Enable Throttle Expo
|
||||
uint8_t trimInc:3; // Trim Increments
|
||||
uint8_t spare1:1;
|
||||
uint8_t pulsePol:1;
|
||||
uint8_t extendedLimits:1;
|
||||
uint8_t extendedTrims:1;
|
||||
uint8_t spare2:1;
|
||||
int8_t ppmDelay;
|
||||
uint8_t beepANACenter; // 1<<0->A1.. 1<<6->A7
|
||||
Gruvin9xTimerData timer2;
|
||||
Gruvin9xMixData mixData[G9X_MAX_MIXERS];
|
||||
Gruvin9xLimitData limitData[G9X_NUM_CHNOUT];
|
||||
Gruvin9xExpoData expoData[G9X_MAX_EXPOS];
|
||||
int8_t curves5[G9X_MAX_CURVE5][5];
|
||||
int8_t curves9[G9X_MAX_CURVE9][9];
|
||||
Gruvin9xLogicalSwitchData logicalSw[G9X_NUM_CSW];
|
||||
Gruvin9xSafetySwData safetySw[G9X_NUM_CHNOUT];
|
||||
Gruvin9xSwashRingData swashR;
|
||||
Gruvin9xFlightModeData_v102 flightModeData[G9X_MAX_FLIGHT_MODES];
|
||||
Gruvin9xFrSkyData frsky;
|
||||
|
||||
operator ModelData();
|
||||
t_Gruvin9xModelData_v103() { memset(this, 0, sizeof(t_Gruvin9xModelData_v103)); }
|
||||
|
||||
}) Gruvin9xModelData_v103;
|
||||
|
||||
PACK(typedef struct t_Gruvin9xModelData_v105 {
|
||||
char name[10]; // 10 must be first for eeLoadModelName
|
||||
Gruvin9xTimerData timer1;
|
||||
uint8_t protocol:3;
|
||||
int8_t ppmNCH:3;
|
||||
uint8_t thrTrim:1; // Enable Throttle Trim
|
||||
uint8_t thrExpo:1; // Enable Throttle Expo
|
||||
uint8_t trimInc:3; // Trim Increments
|
||||
uint8_t spare1:1;
|
||||
uint8_t pulsePol:1;
|
||||
uint8_t extendedLimits:1;
|
||||
uint8_t extendedTrims:1;
|
||||
uint8_t spare2:1;
|
||||
int8_t ppmDelay;
|
||||
uint8_t beepANACenter; // 1<<0->A1.. 1<<6->A7
|
||||
Gruvin9xTimerData timer2;
|
||||
Gruvin9xMixData mixData[G9X_MAX_MIXERS];
|
||||
Gruvin9xLimitData limitData[G9X_NUM_CHNOUT];
|
||||
Gruvin9xExpoData expoData[G9X_MAX_EXPOS];
|
||||
int8_t curves5[G9X_MAX_CURVE5][5];
|
||||
int8_t curves9[G9X_MAX_CURVE9][9];
|
||||
Gruvin9xLogicalSwitchData logicalSw[G9X_NUM_CSW];
|
||||
Gruvin9xSafetySwData safetySw[G9X_NUM_CHNOUT];
|
||||
Gruvin9xCustomFunctionData customFn[G9X_NUM_FSW];
|
||||
Gruvin9xSwashRingData swashR;
|
||||
Gruvin9xFlightModeData_v102 flightModeData[G9X_MAX_FLIGHT_MODES];
|
||||
int16_t subtrim[NUM_STICKS];
|
||||
Gruvin9xFrSkyData frsky;
|
||||
|
||||
operator ModelData();
|
||||
t_Gruvin9xModelData_v105() { memset(this, 0, sizeof(t_Gruvin9xModelData_v105)); }
|
||||
}) Gruvin9xModelData_v105;
|
||||
|
||||
PACK(typedef struct t_Gruvin9xModelData_v106 {
|
||||
char name[10]; // 10 must be first for eeLoadModelName
|
||||
Gruvin9xTimerData timer1;
|
||||
uint8_t protocol:3;
|
||||
uint8_t thrTrim:1; // Enable Throttle Trim
|
||||
int8_t ppmNCH:4;
|
||||
uint8_t trimInc:3; // Trim Increments
|
||||
uint8_t thrExpo:1; // Enable Throttle Expo
|
||||
uint8_t pulsePol:1;
|
||||
uint8_t extendedLimits:1;
|
||||
uint8_t extendedTrims:1;
|
||||
uint8_t spare2:1;
|
||||
int8_t ppmDelay;
|
||||
uint8_t beepANACenter; // 1<<0->A1.. 1<<6->A7
|
||||
Gruvin9xTimerData timer2;
|
||||
Gruvin9xMixData mixData[G9X_MAX_MIXERS];
|
||||
Gruvin9xLimitData limitData[G9X_NUM_CHNOUT];
|
||||
Gruvin9xExpoData expoData[G9X_MAX_EXPOS];
|
||||
int8_t curves5[G9X_MAX_CURVE5][5];
|
||||
int8_t curves9[G9X_MAX_CURVE9][9];
|
||||
Gruvin9xLogicalSwitchData logicalSw[G9X_NUM_CSW];
|
||||
Gruvin9xSafetySwData safetySw[G9X_NUM_CHNOUT];
|
||||
Gruvin9xCustomFunctionData customFn[G9X_NUM_FSW];
|
||||
Gruvin9xSwashRingData swashR;
|
||||
Gruvin9xFlightModeData_v106 flightModeData[G9X_MAX_FLIGHT_MODES];
|
||||
Gruvin9xFrSkyData frsky;
|
||||
|
||||
operator ModelData();
|
||||
t_Gruvin9xModelData_v106() { memset(this, 0, sizeof(t_Gruvin9xModelData_v106)); }
|
||||
}) Gruvin9xModelData_v106;
|
||||
|
||||
typedef Gruvin9xModelData_v106 Gruvin9xModelData;
|
||||
|
||||
#endif
|
||||
@@ -1,252 +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 <iostream>
|
||||
#include "gruvin9xinterface.h"
|
||||
#include "gruvin9xeeprom.h"
|
||||
#include "file.h"
|
||||
#include "appdata.h"
|
||||
|
||||
#define FILE_TYP_GENERAL 1
|
||||
#define FILE_TYP_MODEL 2
|
||||
|
||||
#define FILE_GENERAL 0
|
||||
#define FILE_MODEL(n) (1+n)
|
||||
|
||||
Gruvin9xInterface::Gruvin9xInterface(BoardEnum board):
|
||||
EEPROMInterface(board),
|
||||
efile(new RleFile())
|
||||
{
|
||||
}
|
||||
|
||||
Gruvin9xInterface::~Gruvin9xInterface()
|
||||
{
|
||||
delete efile;
|
||||
}
|
||||
|
||||
const char * Gruvin9xInterface::getName()
|
||||
{
|
||||
if (board == BOARD_STOCK)
|
||||
return "Gruvin9x";
|
||||
else
|
||||
return "Gruvin9x v4";
|
||||
}
|
||||
|
||||
const int Gruvin9xInterface::getEEpromSize()
|
||||
{
|
||||
if (board == BOARD_STOCK) {
|
||||
QString avrMCU = g.mcu();
|
||||
if (avrMCU==QString("m128")) {
|
||||
return EESIZE_STOCK*2;
|
||||
}
|
||||
return EESIZE_STOCK;
|
||||
} else {
|
||||
return EESIZE_GRUVIN9X;
|
||||
}
|
||||
}
|
||||
|
||||
const int Gruvin9xInterface::getMaxModels()
|
||||
{
|
||||
return 16;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void Gruvin9xInterface::loadModel(ModelData &model, unsigned int stickMode, int version)
|
||||
{
|
||||
T _model;
|
||||
if ((version == 2 && efile->readRlc2((uint8_t*)&_model, sizeof(T))) ||
|
||||
(version == 1 && efile->readRlc1((uint8_t*)&_model, sizeof(T)))) {
|
||||
model = _model;
|
||||
if (stickMode) {
|
||||
applyStickModeToModel(model, stickMode);
|
||||
}
|
||||
}
|
||||
else {
|
||||
model.clear();
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool Gruvin9xInterface::loadGeneral(GeneralSettings &settings, int version)
|
||||
{
|
||||
T _settings;
|
||||
if ((version == 2 && efile->readRlc2((uint8_t*)&_settings, sizeof(T))) ||
|
||||
(version == 1 && efile->readRlc1((uint8_t*)&_settings, sizeof(T)))) {
|
||||
settings = _settings;
|
||||
return true;
|
||||
}
|
||||
|
||||
std::cerr << "error when loading general settings";
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned long Gruvin9xInterface::loadxml(RadioData &radioData, QDomDocument &doc)
|
||||
{
|
||||
std::bitset<NUM_ERRORS> errors;
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
|
||||
unsigned long Gruvin9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
|
||||
{
|
||||
std::cout << "trying " << getName() << " import... ";
|
||||
|
||||
std::bitset<NUM_ERRORS> errors;
|
||||
|
||||
if (size != this->getEEpromSize()) {
|
||||
std::cout << "wrong size\n";
|
||||
errors.set(WRONG_SIZE);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
if (!efile->EeFsOpen((uint8_t *)eeprom, size, BOARD_STOCK)) {
|
||||
std::cout << "wrong file system\n";
|
||||
errors.set(WRONG_FILE_SYSTEM);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
efile->openRd(FILE_GENERAL);
|
||||
|
||||
uint8_t version;
|
||||
if (efile->readRlc2(&version, 1) != 1) {
|
||||
std::cout << "no\n";
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
if (version == 0) {
|
||||
efile->openRd(FILE_GENERAL);
|
||||
if (efile->readRlc1(&version, 1) != 1) {
|
||||
std::cout << "no\n";
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
}
|
||||
|
||||
std::cout << "version " << (unsigned int)version << " ";
|
||||
|
||||
switch(version) {
|
||||
case 5:
|
||||
case 100:
|
||||
case 101:
|
||||
case 102:
|
||||
case 103:
|
||||
case 104:
|
||||
case 105:
|
||||
// subtrims(16bits) + function switches added
|
||||
case 106:
|
||||
// trims(10bits), no subtrims
|
||||
break;
|
||||
default:
|
||||
std::cout << "not gruvin9x\n";
|
||||
errors.set(NOT_GRUVIN9X);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
efile->openRd(FILE_GENERAL);
|
||||
if (version == 5) {
|
||||
if (!loadGeneral<Gruvin9xGeneral_v103>(radioData.generalSettings, 1)) {
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
}
|
||||
else if (version < 104) {
|
||||
if (!loadGeneral<Gruvin9xGeneral_v103>(radioData.generalSettings)) {
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
}
|
||||
else if (version <= 106) {
|
||||
if (!loadGeneral<Gruvin9xGeneral_v104>(radioData.generalSettings)) {
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
}
|
||||
else {
|
||||
std::cout << "ko\n";
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
for (int i=0; i<getMaxModels(); i++) {
|
||||
efile->openRd(FILE_MODEL(i));
|
||||
if (version == 5) {
|
||||
loadModel<Gruvin9xModelData_v102>(radioData.models[i], radioData.generalSettings.stickMode+1, 1);
|
||||
}
|
||||
else if (version < 103) {
|
||||
loadModel<Gruvin9xModelData_v102>(radioData.models[i], radioData.generalSettings.stickMode+1);
|
||||
}
|
||||
else if (version == 103) {
|
||||
loadModel<Gruvin9xModelData_v103>(radioData.models[i], radioData.generalSettings.stickMode+1);
|
||||
}
|
||||
else if (version == 105) {
|
||||
loadModel<Gruvin9xModelData_v105>(radioData.models[i], radioData.generalSettings.stickMode+1);
|
||||
}
|
||||
else if (version == 106) {
|
||||
loadModel<Gruvin9xModelData_v106>(radioData.models[i], radioData.generalSettings.stickMode+1);
|
||||
}
|
||||
else {
|
||||
std::cout << "ko\n";
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
}
|
||||
|
||||
std::cout << "ok\n";
|
||||
errors.set(NO_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
unsigned long Gruvin9xInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index)
|
||||
{
|
||||
std::bitset<NUM_ERRORS> errors;
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
int Gruvin9xInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t variant, uint8_t version)
|
||||
{
|
||||
std::cout << "NO!\n";
|
||||
// TODO an error
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Gruvin9xInterface::getSize(const ModelData & model)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Gruvin9xInterface::getSize(const GeneralSettings & settings)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Gruvin9xInterface::isAvailable(PulsesProtocol proto, int port)
|
||||
{
|
||||
switch (proto) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -1,65 +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 gruvin9x_interface_h
|
||||
#define gruvin9x_interface_h
|
||||
|
||||
#include "eeprominterface.h"
|
||||
|
||||
class RleFile;
|
||||
|
||||
class Gruvin9xInterface : public EEPROMInterface
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
Gruvin9xInterface(BoardEnum board);
|
||||
|
||||
virtual ~Gruvin9xInterface();
|
||||
|
||||
virtual const char * getName();
|
||||
|
||||
virtual const int getEEpromSize();
|
||||
|
||||
virtual const int getMaxModels();
|
||||
|
||||
virtual unsigned long load(RadioData &, const uint8_t *eeprom, int size);
|
||||
|
||||
|
||||
virtual unsigned long loadBackup(RadioData &, uint8_t *eeprom,int esize, int index);
|
||||
|
||||
virtual unsigned long loadxml(RadioData &radioData, QDomDocument &doc);
|
||||
|
||||
virtual int save(uint8_t *eeprom, RadioData &radioData, uint32_t variant=0, uint8_t version=0);
|
||||
|
||||
virtual int getSize(const ModelData &);
|
||||
|
||||
virtual int getSize(const GeneralSettings & settings);
|
||||
|
||||
virtual int isAvailable(PulsesProtocol proto, int port=0);
|
||||
|
||||
protected:
|
||||
|
||||
template <class T>
|
||||
void loadModel(ModelData &model, unsigned int stickMode=0, int version=2);
|
||||
|
||||
template <class T>
|
||||
bool loadGeneral(GeneralSettings &settings, int version=2);
|
||||
|
||||
RleFile *efile;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,838 +0,0 @@
|
||||
#include <stdlib.h>
|
||||
#include <algorithm>
|
||||
#include "helpers.h"
|
||||
#include "open9xGruvin9xeeprom.h"
|
||||
#include <QObject>
|
||||
#include <QMessageBox>
|
||||
|
||||
extern void getEEPROMZString(char *dst, const char *src, int size);
|
||||
extern RawSwitch open9xStockToSwitch(int8_t sw);
|
||||
|
||||
t_Open9xGruvin9xFlightModeData_v207::operator FlightModeData ()
|
||||
{
|
||||
FlightModeData c9x;
|
||||
for (int i=0; i<NUM_STICKS; i++)
|
||||
c9x.trim[i] = (((int16_t)trim[i]) << 2) + ((trim_ext >> (2*i)) & 0x03);
|
||||
c9x.swtch = open9xStockToSwitch(swtch);
|
||||
getEEPROMZString(c9x.name, name, sizeof(name));
|
||||
c9x.fadeIn = fadeIn;
|
||||
c9x.fadeOut = fadeOut;
|
||||
for (int i=0; i<2; i++)
|
||||
c9x.rotaryEncoders[i] = rotaryEncoders[i];
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Open9xGruvin9xFlightModeData_v208::operator FlightModeData ()
|
||||
{
|
||||
FlightModeData c9x;
|
||||
for (int i=0; i<NUM_STICKS; i++)
|
||||
c9x.trim[i] = trim[i];
|
||||
c9x.swtch = open9xStockToSwitch(swtch);
|
||||
getEEPROMZString(c9x.name, name, sizeof(name));
|
||||
c9x.fadeIn = fadeIn;
|
||||
c9x.fadeOut = fadeOut;
|
||||
for (int i=0; i<2; i++)
|
||||
c9x.rotaryEncoders[i] = rotaryEncoders[i];
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Open9xGruvin9xMixData_v207::operator MixData ()
|
||||
{
|
||||
MixData c9x;
|
||||
if (srcRaw) {
|
||||
c9x.destCh = destCh+1;
|
||||
if (srcRaw == 0) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_NONE);
|
||||
}
|
||||
else if (srcRaw <= 7) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_STICK, srcRaw-1);
|
||||
}
|
||||
else if (srcRaw <= 9) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_ROTARY_ENCODER, srcRaw-8);
|
||||
}
|
||||
else if (srcRaw == 10) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_MAX);
|
||||
}
|
||||
/* else if (srcRaw == 11) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_3POS);
|
||||
} */
|
||||
else if (srcRaw <= 32) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_SWITCH, srcRaw-11);
|
||||
}
|
||||
else if (srcRaw <= 35) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_CYC, srcRaw-33);
|
||||
}
|
||||
else if (srcRaw <= 43) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_PPM, srcRaw-36);
|
||||
}
|
||||
else {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-44);
|
||||
}
|
||||
c9x.weight = weight;
|
||||
|
||||
if (differential) {
|
||||
c9x.curve = CurveReference(CurveReference::CURVE_REF_DIFF, differential*2);
|
||||
}
|
||||
else {
|
||||
// TODO c9x.curve = curve;
|
||||
}
|
||||
|
||||
c9x.swtch = open9xStockToSwitch(swtch);
|
||||
c9x.delayUp = delayUp;
|
||||
c9x.delayDown = delayDown;
|
||||
c9x.speedUp = speedUp;
|
||||
c9x.speedDown = speedDown;
|
||||
c9x.carryTrim = carryTrim;
|
||||
c9x.mltpx = (MltpxValue)mltpx;
|
||||
c9x.mixWarn = mixWarn;
|
||||
|
||||
if (phase<0) {
|
||||
c9x.flightModes= 1 << (-phase -1);
|
||||
}
|
||||
else if (phase==0) {
|
||||
c9x.flightModes=0;
|
||||
}
|
||||
else {
|
||||
c9x.flightModes=63;
|
||||
c9x.flightModes &= ~(1 << (phase -1));
|
||||
}
|
||||
c9x.sOffset = sOffset;
|
||||
}
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Open9xGruvin9xMixData_v209::operator MixData ()
|
||||
{
|
||||
MixData c9x;
|
||||
if (srcRaw) {
|
||||
c9x.destCh = destCh+1;
|
||||
if (srcRaw == 0) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_NONE);
|
||||
}
|
||||
else if (srcRaw <= 7) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_STICK, srcRaw-1);
|
||||
}
|
||||
else if (srcRaw <= 9) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_ROTARY_ENCODER, srcRaw-8);
|
||||
}
|
||||
else if (srcRaw <= 13) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_TRIM, srcRaw-10);
|
||||
}
|
||||
else if (srcRaw == 14) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_MAX);
|
||||
}
|
||||
else if (srcRaw == 15) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_SWITCH, 0);
|
||||
}
|
||||
else if (srcRaw <= 36) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_SWITCH, srcRaw-15);
|
||||
}
|
||||
else if (srcRaw <= 39) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_CYC, srcRaw-37);
|
||||
}
|
||||
else if (srcRaw <= 47) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_PPM, srcRaw-40);
|
||||
}
|
||||
else {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-48);
|
||||
}
|
||||
c9x.weight = weight;
|
||||
|
||||
if (differential) {
|
||||
c9x.curve = CurveReference(CurveReference::CURVE_REF_DIFF, differential*2);
|
||||
}
|
||||
else {
|
||||
// TODO c9x.curve = curve;
|
||||
}
|
||||
|
||||
c9x.swtch = open9xStockToSwitch(swtch);
|
||||
c9x.delayUp = delayUp;
|
||||
c9x.delayDown = delayDown;
|
||||
c9x.speedUp = speedUp;
|
||||
c9x.speedDown = speedDown;
|
||||
c9x.carryTrim = carryTrim;
|
||||
c9x.mltpx = (MltpxValue)mltpx;
|
||||
c9x.mixWarn = mixWarn;
|
||||
|
||||
if (phase<0) {
|
||||
c9x.flightModes= 1 << (-phase -1);
|
||||
}
|
||||
else if (phase==0) {
|
||||
c9x.flightModes=0;
|
||||
}
|
||||
else {
|
||||
c9x.flightModes=63;
|
||||
c9x.flightModes &= ~(1 << (phase -1));
|
||||
}
|
||||
c9x.sOffset = sOffset;
|
||||
}
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Open9xGruvin9xMixData_v211::operator MixData ()
|
||||
{
|
||||
MixData c9x;
|
||||
if (srcRaw) {
|
||||
c9x.destCh = destCh+1;
|
||||
if (srcRaw == 0) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_NONE);
|
||||
}
|
||||
else if (srcRaw <= 7) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_STICK, srcRaw-1);
|
||||
}
|
||||
else if (srcRaw <= 9) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_ROTARY_ENCODER, srcRaw-8);
|
||||
}
|
||||
else if (srcRaw <= 13) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_TRIM, srcRaw-10);
|
||||
}
|
||||
else if (srcRaw == 14) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_MAX);
|
||||
}
|
||||
else if (srcRaw == 15) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_SWITCH, 0);
|
||||
}
|
||||
else if (srcRaw <= 36) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_SWITCH, srcRaw-15);
|
||||
}
|
||||
else if (srcRaw <= 39) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_CYC, srcRaw-37);
|
||||
}
|
||||
else if (srcRaw <= 47) {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_PPM, srcRaw-40);
|
||||
}
|
||||
else {
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-48);
|
||||
}
|
||||
c9x.weight = weight;
|
||||
c9x.swtch = open9xStockToSwitch(swtch);
|
||||
|
||||
if (curveMode==0) {
|
||||
c9x.curve = CurveReference(CurveReference::CURVE_REF_DIFF, curveParam);
|
||||
}
|
||||
else {
|
||||
// TODO c9x.curve = curve;
|
||||
}
|
||||
|
||||
c9x.delayUp = delayUp;
|
||||
c9x.delayDown = delayDown;
|
||||
c9x.speedUp = speedUp;
|
||||
c9x.speedDown = speedDown;
|
||||
c9x.carryTrim = carryTrim;
|
||||
c9x.noExpo = noExpo;
|
||||
c9x.mltpx = (MltpxValue)mltpx;
|
||||
c9x.mixWarn = mixWarn;
|
||||
c9x.flightModes = phases;
|
||||
c9x.sOffset = sOffset;
|
||||
}
|
||||
return c9x;
|
||||
}
|
||||
|
||||
RawSource open9xV4207ToSource(int8_t value)
|
||||
{
|
||||
if (value == 0) {
|
||||
return RawSource(SOURCE_TYPE_NONE);
|
||||
}
|
||||
else if (value <= 7) {
|
||||
return RawSource(SOURCE_TYPE_STICK, value - 1);
|
||||
}
|
||||
else if (value <= 9) {
|
||||
return RawSource(SOURCE_TYPE_ROTARY_ENCODER, value - 8);
|
||||
}
|
||||
else if (value == 10) {
|
||||
return RawSource(SOURCE_TYPE_MAX);
|
||||
}
|
||||
/* else if (value == 11) {
|
||||
return RawSource(SOURCE_TYPE_3POS);
|
||||
} */
|
||||
else if (value <= 14) {
|
||||
return RawSource(SOURCE_TYPE_CYC, value-12);
|
||||
}
|
||||
else if (value <= 22) {
|
||||
return RawSource(SOURCE_TYPE_PPM, value-15);
|
||||
}
|
||||
else if (value <= 38) {
|
||||
return RawSource(SOURCE_TYPE_CH, value-23);
|
||||
}
|
||||
else {
|
||||
return RawSource(SOURCE_TYPE_TELEMETRY, value-38);
|
||||
}
|
||||
}
|
||||
|
||||
RawSource open9xV4209ToSource(int8_t value)
|
||||
{
|
||||
if (value == 0) {
|
||||
return RawSource(SOURCE_TYPE_NONE);
|
||||
}
|
||||
else if (value <= 7) {
|
||||
return RawSource(SOURCE_TYPE_STICK, value - 1);
|
||||
}
|
||||
else if (value <= 9) {
|
||||
return RawSource(SOURCE_TYPE_ROTARY_ENCODER, value - 8);
|
||||
}
|
||||
else if (value <= 13) {
|
||||
return RawSource(SOURCE_TYPE_STICK, value - 10);
|
||||
}
|
||||
else if (value == 14) {
|
||||
return RawSource(SOURCE_TYPE_MAX);
|
||||
}
|
||||
/* else if (value == 15) {
|
||||
return RawSource(SOURCE_TYPE_3POS);
|
||||
} */
|
||||
else if (value <= 18) {
|
||||
return RawSource(SOURCE_TYPE_CYC, value-16);
|
||||
}
|
||||
else if (value <= 26) {
|
||||
return RawSource(SOURCE_TYPE_PPM, value-19);
|
||||
}
|
||||
else if (value <= 42) {
|
||||
return RawSource(SOURCE_TYPE_CH, value-27);
|
||||
}
|
||||
else {
|
||||
return RawSource(SOURCE_TYPE_TELEMETRY, value-42);
|
||||
}
|
||||
}
|
||||
|
||||
Open9xGruvin9xLogicalSwitchData_v207::operator LogicalSwitchData ()
|
||||
{
|
||||
LogicalSwitchData c9x;
|
||||
c9x.func = func;
|
||||
c9x.val1 = v1;
|
||||
c9x.val2 = v2;
|
||||
|
||||
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val1 = open9xV4207ToSource(v1).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val2 = open9xV4207ToSource(v2).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
|
||||
c9x.val1 = open9xStockToSwitch(v1).toValue();
|
||||
c9x.val2 = open9xStockToSwitch(v2).toValue();
|
||||
}
|
||||
|
||||
return c9x;
|
||||
}
|
||||
|
||||
Open9xGruvin9xLogicalSwitchData_v209::operator LogicalSwitchData ()
|
||||
{
|
||||
LogicalSwitchData c9x;
|
||||
c9x.func = func;
|
||||
c9x.val1 = v1;
|
||||
c9x.val2 = v2;
|
||||
|
||||
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val1 = open9xV4209ToSource(v1).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= LS_FN_EQUAL && c9x.func <= LS_FN_ELESS) {
|
||||
c9x.val2 = open9xV4209ToSource(v2).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
|
||||
c9x.val1 = open9xStockToSwitch(v1).toValue();
|
||||
c9x.val2 = open9xStockToSwitch(v2).toValue();
|
||||
}
|
||||
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Open9xGruvin9xCustomFunctionData_v203::operator CustomFunctionData ()
|
||||
{
|
||||
CustomFunctionData c9x;
|
||||
c9x.swtch = open9xStockToSwitch(swtch);
|
||||
if (func < 16) {
|
||||
c9x.func = (AssignFunc)(func);
|
||||
c9x.enabled=param & 0x01;
|
||||
c9x.param = (param>>1)<<1;
|
||||
}
|
||||
else {
|
||||
c9x.param = param;
|
||||
if (func <= 20)
|
||||
c9x.func = (AssignFunc)(func);
|
||||
else if (func == 21)
|
||||
c9x.func = FuncInstantTrim;
|
||||
else if (func == 22)
|
||||
c9x.func = FuncPlaySound;
|
||||
else if (func == 23)
|
||||
c9x.func = FuncPlayHaptic;
|
||||
else if (func == 24)
|
||||
c9x.func = FuncReset;
|
||||
else if (func == 25)
|
||||
c9x.func = FuncVario;
|
||||
else if (func == 26)
|
||||
c9x.func = FuncPlayPrompt;
|
||||
else if (func == 27)
|
||||
c9x.func = FuncPlayValue;
|
||||
else if (func == 28)
|
||||
c9x.func = FuncLogs;
|
||||
else if (func == 29)
|
||||
c9x.func = FuncBacklight;
|
||||
else if (func >= 30 && func <= 34)
|
||||
c9x.func = AssignFunc(FuncAdjustGV1 + func - 30);
|
||||
else
|
||||
c9x.clear();
|
||||
}
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Open9xGruvin9xCustomFunctionData_v210::operator CustomFunctionData ()
|
||||
{
|
||||
CustomFunctionData c9x;
|
||||
c9x.swtch = open9xStockToSwitch(swtch);
|
||||
c9x.param = param;
|
||||
if (func < 22) {
|
||||
c9x.func = (AssignFunc)(func);
|
||||
c9x.enabled = delay;
|
||||
} else {
|
||||
if (func == 22)
|
||||
c9x.func = FuncPlaySound;
|
||||
else if (func == 23)
|
||||
c9x.func = FuncPlayHaptic;
|
||||
else if (func == 24)
|
||||
c9x.func = FuncReset;
|
||||
else if (func == 25)
|
||||
c9x.func = FuncVario;
|
||||
else if (func == 26)
|
||||
c9x.func = FuncPlayPrompt;
|
||||
else if (func == 27)
|
||||
c9x.func = FuncPlayValue;
|
||||
else if (func == 28)
|
||||
c9x.func = FuncLogs;
|
||||
else
|
||||
c9x.clear();
|
||||
}
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Open9xGruvin9xSwashRingData_v208::operator SwashRingData ()
|
||||
{
|
||||
SwashRingData c9x;
|
||||
c9x.elevatorWeight = invertELE ? -100 : 100;
|
||||
c9x.aileronWeight = invertAIL ? -100 : 100;
|
||||
c9x.collectiveWeight = invertCOL ? -100 : 100;
|
||||
c9x.type = type;
|
||||
c9x.collectiveSource = open9xV4207ToSource(collectiveSource);
|
||||
c9x.value = value;
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Open9xGruvin9xSwashRingData_v209::operator SwashRingData ()
|
||||
{
|
||||
SwashRingData c9x;
|
||||
c9x.elevatorWeight = invertELE ? -100 : 100;
|
||||
c9x.aileronWeight = invertAIL ? -100 : 100;
|
||||
c9x.collectiveWeight = invertCOL ? -100 : 100;
|
||||
c9x.type = type;
|
||||
c9x.collectiveSource = open9xV4209ToSource(collectiveSource);
|
||||
c9x.value = value;
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Open9xGruvin9xModelData_v207::operator ModelData ()
|
||||
{
|
||||
ModelData c9x;
|
||||
c9x.used = true;
|
||||
getEEPROMZString(c9x.name, name, sizeof(name));
|
||||
for (int i=0; i<2; i++)
|
||||
c9x.timers[i] = timers[i];
|
||||
switch(protocol) {
|
||||
case 1:
|
||||
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
|
||||
break;
|
||||
case 2:
|
||||
c9x.moduleData[0].protocol = PULSES_DSM2;
|
||||
break;
|
||||
case 3:
|
||||
c9x.moduleData[0].protocol = PULSES_PPM16;
|
||||
break;
|
||||
default:
|
||||
c9x.moduleData[0].protocol = PULSES_PPM;
|
||||
break;
|
||||
}
|
||||
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.trimInc = trimInc - 2;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.beepANACenter = beepANACenter;
|
||||
c9x.moduleData[0].ppmPulsePol = pulsePol;
|
||||
c9x.extendedLimits = extendedLimits;
|
||||
c9x.extendedTrims = extendedTrims;
|
||||
for (int i=0; i<5; i++) {
|
||||
c9x.flightModeData[i] = flightModeData[i];
|
||||
for (int j=0; j<NUM_STICKS; j++) {
|
||||
if (c9x.flightModeData[i].trim[j] > 500) {
|
||||
c9x.flightModeData[i].trimRef[j] = c9x.flightModeData[i].trim[j] - 501;
|
||||
if (c9x.flightModeData[i].trimRef[j] >= i)
|
||||
c9x.flightModeData[i].trimRef[j] += 1;
|
||||
c9x.flightModeData[i].trim[j] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i=0; i<32; i++)
|
||||
c9x.mixData[i] = mixData[i];
|
||||
for (int i=0; i<16; i++)
|
||||
c9x.limitData[i] = limitData[i];
|
||||
for (int i=0; i<14; i++)
|
||||
c9x.expoData[i] = expoData[i];
|
||||
|
||||
for (int i=0; i<8; i++) {
|
||||
c9x.curves[i].count = 5;
|
||||
for (int j = 0; j < 5; j++) {
|
||||
c9x.curves[i].points[j].x = -100 + 50 * i;
|
||||
c9x.curves[i].points[j].y = curves5[i][j];
|
||||
}
|
||||
}
|
||||
for (int i=0; i<8; i++) {
|
||||
c9x.curves[8 + i].count = 9;
|
||||
for (int j = 0; j < 9; j++) {
|
||||
c9x.curves[8 + i].points[j].x = -100 + 25 * i;
|
||||
c9x.curves[8 + i].points[j].y = curves9[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=0; i<12; i++)
|
||||
c9x.logicalSw[i] = logicalSw[i];
|
||||
for (int i=0; i<16; i++)
|
||||
c9x.customFn[i] = customFn[i];
|
||||
c9x.swashRingData = swashR;
|
||||
c9x.frsky = frsky;
|
||||
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
|
||||
c9x.thrTraceSrc = thrTraceSrc;
|
||||
c9x.moduleData[0].modelId = modelId;
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Open9xGruvin9xModelData_v208::operator ModelData ()
|
||||
{
|
||||
ModelData c9x;
|
||||
c9x.used = true;
|
||||
getEEPROMZString(c9x.name, name, sizeof(name));
|
||||
for (int i=0; i<2; i++)
|
||||
c9x.timers[i] = timers[i];
|
||||
switch(protocol) {
|
||||
case 1:
|
||||
c9x.moduleData[0].protocol = PULSES_PPM16;
|
||||
break;
|
||||
case 2:
|
||||
c9x.moduleData[0].protocol = PULSES_PPMSIM;
|
||||
break;
|
||||
case 3:
|
||||
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
|
||||
break;
|
||||
case 4:
|
||||
c9x.moduleData[0].protocol = PULSES_DSM2;
|
||||
break;
|
||||
default:
|
||||
c9x.moduleData[0].protocol = PULSES_PPM;
|
||||
break;
|
||||
}
|
||||
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.trimInc = trimInc - 2;
|
||||
c9x.disableThrottleWarning=disableThrottleWarning;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.beepANACenter = beepANACenter;
|
||||
c9x.moduleData[0].ppmPulsePol = pulsePol;
|
||||
c9x.extendedLimits = extendedLimits;
|
||||
c9x.extendedTrims = extendedTrims;
|
||||
for (int i=0; i<5; i++) {
|
||||
c9x.flightModeData[i] = flightModeData[i];
|
||||
for (int j=0; j<NUM_STICKS; j++) {
|
||||
if (c9x.flightModeData[i].trim[j] > 500) {
|
||||
c9x.flightModeData[i].trimRef[j] = c9x.flightModeData[i].trim[j] - 501;
|
||||
if (c9x.flightModeData[i].trimRef[j] >= i)
|
||||
c9x.flightModeData[i].trimRef[j] += 1;
|
||||
c9x.flightModeData[i].trim[j] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i=0; i<32; i++)
|
||||
c9x.mixData[i] = mixData[i];
|
||||
for (int i=0; i<16; i++)
|
||||
c9x.limitData[i] = limitData[i];
|
||||
for (int i=0; i<14; i++)
|
||||
c9x.expoData[i] = expoData[i];
|
||||
for (int i=0; i<8; i++) {
|
||||
c9x.curves[i].count = 5;
|
||||
for (int j = 0; j < 5; j++) {
|
||||
c9x.curves[i].points[j].x = -100 + 50 * i;
|
||||
c9x.curves[i].points[j].y = curves5[i][j];
|
||||
}
|
||||
}
|
||||
for (int i=0; i<8; i++) {
|
||||
c9x.curves[8 + i].count = 9;
|
||||
for (int j = 0; j < 9; j++) {
|
||||
c9x.curves[8 + i].points[j].x = -100 + 25 * i;
|
||||
c9x.curves[8 + i].points[j].y = curves9[i][j];
|
||||
}
|
||||
}
|
||||
for (int i=0; i<12; i++)
|
||||
c9x.logicalSw[i] = logicalSw[i];
|
||||
for (int i=0; i<16; i++)
|
||||
c9x.customFn[i] = customFn[i];
|
||||
c9x.swashRingData = swashR;
|
||||
c9x.frsky = frsky;
|
||||
c9x.frsky.varioSource = varioSource;
|
||||
c9x.frsky.varioCenterMax = varioSpeedUpMin;
|
||||
c9x.frsky.varioCenterMin = varioSpeedDownMin;
|
||||
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
|
||||
c9x.thrTraceSrc = thrTraceSrc;
|
||||
c9x.moduleData[0].modelId = modelId;
|
||||
for (int i=0; i<16; i++) {
|
||||
c9x.limitData[i].ppmCenter = servoCenter[i];
|
||||
}
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Open9xGruvin9xModelData_v209::operator ModelData ()
|
||||
{
|
||||
ModelData c9x;
|
||||
c9x.used = true;
|
||||
getEEPROMZString(c9x.name, name, sizeof(name));
|
||||
for (int i=0; i<2; i++)
|
||||
c9x.timers[i] = timers[i];
|
||||
switch(protocol) {
|
||||
case 1:
|
||||
c9x.moduleData[0].protocol = PULSES_PPM16;
|
||||
break;
|
||||
case 2:
|
||||
c9x.moduleData[0].protocol = PULSES_PPMSIM;
|
||||
break;
|
||||
case 3:
|
||||
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
|
||||
break;
|
||||
case 4:
|
||||
c9x.moduleData[0].protocol = PULSES_DSM2;
|
||||
break;
|
||||
default:
|
||||
c9x.moduleData[0].protocol = PULSES_PPM;
|
||||
break;
|
||||
}
|
||||
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.trimInc = trimInc - 2;
|
||||
c9x.disableThrottleWarning=disableThrottleWarning;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.beepANACenter = beepANACenter;
|
||||
c9x.moduleData[0].ppmPulsePol = pulsePol;
|
||||
c9x.extendedLimits = extendedLimits;
|
||||
c9x.extendedTrims = extendedTrims;
|
||||
for (int i=0; i<5; i++) {
|
||||
c9x.flightModeData[i] = flightModeData[i];
|
||||
for (int j=0; j<NUM_STICKS; j++) {
|
||||
if (c9x.flightModeData[i].trim[j] > 500) {
|
||||
c9x.flightModeData[i].trimRef[j] = c9x.flightModeData[i].trim[j] - 501;
|
||||
if (c9x.flightModeData[i].trimRef[j] >= i)
|
||||
c9x.flightModeData[i].trimRef[j] += 1;
|
||||
c9x.flightModeData[i].trim[j] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i=0; i<32; i++)
|
||||
c9x.mixData[i] = mixData[i];
|
||||
for (int i=0; i<16; i++)
|
||||
c9x.limitData[i] = limitData[i];
|
||||
for (int i=0; i<14; i++)
|
||||
c9x.expoData[i] = expoData[i];
|
||||
for (int i=0; i<8; i++) {
|
||||
c9x.curves[i].count = 5;
|
||||
for (int j = 0; j < 5; j++) {
|
||||
c9x.curves[i].points[j].x = -100 + 50 * i;
|
||||
c9x.curves[i].points[j].y = curves5[i][j];
|
||||
}
|
||||
}
|
||||
for (int i=0; i<8; i++) {
|
||||
c9x.curves[8 + i].count = 9;
|
||||
for (int j = 0; j < 9; j++) {
|
||||
c9x.curves[8 + i].points[j].x = -100 + 25 * i;
|
||||
c9x.curves[8 + i].points[j].y = curves9[i][j];
|
||||
}
|
||||
}
|
||||
for (int i=0; i<12; i++)
|
||||
c9x.logicalSw[i] = logicalSw[i];
|
||||
for (int i=0; i<16; i++)
|
||||
c9x.customFn[i] = customFn[i];
|
||||
c9x.swashRingData = swashR;
|
||||
c9x.frsky = frsky;
|
||||
c9x.frsky.varioSource = varioSource;
|
||||
c9x.frsky.varioCenterMax = varioSpeedUpMin;
|
||||
c9x.frsky.varioCenterMin = varioSpeedDownMin;
|
||||
c9x.switchWarningStates = switchWarningStates;
|
||||
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
|
||||
c9x.thrTraceSrc = thrTraceSrc;
|
||||
c9x.moduleData[0].modelId = modelId;
|
||||
for (int i=0; i<16; i++) {
|
||||
c9x.limitData[i].ppmCenter = servoCenter[i];
|
||||
}
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Open9xGruvin9xModelData_v210::operator ModelData ()
|
||||
{
|
||||
ModelData c9x;
|
||||
c9x.used = true;
|
||||
getEEPROMZString(c9x.name, name, sizeof(name));
|
||||
for (int i=0; i<2; i++)
|
||||
c9x.timers[i] = timers[i];
|
||||
switch(protocol) {
|
||||
case 1:
|
||||
c9x.moduleData[0].protocol = PULSES_PPM16;
|
||||
break;
|
||||
case 2:
|
||||
c9x.moduleData[0].protocol = PULSES_PPMSIM;
|
||||
break;
|
||||
case 3:
|
||||
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
|
||||
break;
|
||||
case 4:
|
||||
c9x.moduleData[0].protocol = PULSES_DSM2;
|
||||
break;
|
||||
default:
|
||||
c9x.moduleData[0].protocol = PULSES_PPM;
|
||||
break;
|
||||
}
|
||||
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.trimInc = trimInc - 2;
|
||||
c9x.disableThrottleWarning=disableThrottleWarning;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.beepANACenter = beepANACenter;
|
||||
c9x.moduleData[0].ppmPulsePol = pulsePol;
|
||||
c9x.extendedLimits = extendedLimits;
|
||||
c9x.extendedTrims = extendedTrims;
|
||||
for (int i=0; i<5; i++) {
|
||||
c9x.flightModeData[i] = flightModeData[i];
|
||||
for (int j=0; j<NUM_STICKS; j++) {
|
||||
if (c9x.flightModeData[i].trim[j] > 500) {
|
||||
c9x.flightModeData[i].trimRef[j] = c9x.flightModeData[i].trim[j] - 501;
|
||||
if (c9x.flightModeData[i].trimRef[j] >= i)
|
||||
c9x.flightModeData[i].trimRef[j] += 1;
|
||||
c9x.flightModeData[i].trim[j] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i=0; i<32; i++)
|
||||
c9x.mixData[i] = mixData[i];
|
||||
for (int i=0; i<16; i++)
|
||||
c9x.limitData[i] = limitData[i];
|
||||
for (int i=0; i<14; i++)
|
||||
c9x.expoData[i] = expoData[i];
|
||||
for (int i=0; i<8; i++) {
|
||||
CurveInfo crvinfo = curveinfo(this, i);
|
||||
c9x.curves[i].type = (crvinfo.custom ? CurveData::CURVE_TYPE_CUSTOM : CurveData::CURVE_TYPE_STANDARD);
|
||||
c9x.curves[i].count = crvinfo.points;
|
||||
for (int j=0; j<crvinfo.points; j++)
|
||||
c9x.curves[i].points[j].y = crvinfo.crv[j];
|
||||
if (crvinfo.custom) {
|
||||
c9x.curves[i].points[0].x = -100;
|
||||
for (int j=1; j<crvinfo.points-1; j++)
|
||||
c9x.curves[i].points[j].x = crvinfo.crv[crvinfo.points+j-1];
|
||||
c9x.curves[i].points[crvinfo.points-1].x = +100;
|
||||
}
|
||||
else {
|
||||
for (int j=0; j<crvinfo.points; j++)
|
||||
c9x.curves[i].points[j].x = -100 + (200*i) / (crvinfo.points-1);
|
||||
}
|
||||
}
|
||||
for (int i=0; i<12; i++)
|
||||
c9x.logicalSw[i] = logicalSw[i];
|
||||
for (int i=0; i<16; i++)
|
||||
c9x.customFn[i] = customFn[i];
|
||||
c9x.swashRingData = swashR;
|
||||
c9x.frsky = frsky;
|
||||
c9x.switchWarningStates = switchWarningStates;
|
||||
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
|
||||
c9x.thrTraceSrc = thrTraceSrc;
|
||||
c9x.moduleData[0].modelId = modelId;
|
||||
for (int i=0; i<16; i++) {
|
||||
c9x.limitData[i].ppmCenter = servoCenter[i];
|
||||
}
|
||||
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Open9xGruvin9xModelData_v211::operator ModelData ()
|
||||
{
|
||||
ModelData c9x;
|
||||
c9x.used = true;
|
||||
getEEPROMZString(c9x.name, name, sizeof(name));
|
||||
for (int i=0; i<2; i++) {
|
||||
c9x.timers[i] = timers[i];
|
||||
c9x.timers[i].persistent = timersXtra[i].remanent;
|
||||
c9x.timers[i].val = timersXtra[i].value;
|
||||
}
|
||||
switch(protocol) {
|
||||
case 1:
|
||||
c9x.moduleData[0].protocol = PULSES_PPM16;
|
||||
break;
|
||||
case 2:
|
||||
c9x.moduleData[0].protocol = PULSES_PPMSIM;
|
||||
break;
|
||||
case 3:
|
||||
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
|
||||
break;
|
||||
case 4:
|
||||
c9x.moduleData[0].protocol = PULSES_DSM2;
|
||||
break;
|
||||
default:
|
||||
c9x.moduleData[0].protocol = PULSES_PPM;
|
||||
break;
|
||||
}
|
||||
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.trimInc = trimInc - 2;
|
||||
c9x.disableThrottleWarning=disableThrottleWarning;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.beepANACenter = beepANACenter;
|
||||
c9x.moduleData[0].ppmPulsePol = pulsePol;
|
||||
c9x.extendedLimits = extendedLimits;
|
||||
c9x.extendedTrims = extendedTrims;
|
||||
for (int i=0; i<5; i++) {
|
||||
c9x.flightModeData[i] = flightModeData[i];
|
||||
for (int j=0; j<NUM_STICKS; j++) {
|
||||
if (c9x.flightModeData[i].trim[j] > 500) {
|
||||
c9x.flightModeData[i].trimRef[j] = c9x.flightModeData[i].trim[j] - 501;
|
||||
if (c9x.flightModeData[i].trimRef[j] >= i)
|
||||
c9x.flightModeData[i].trimRef[j] += 1;
|
||||
c9x.flightModeData[i].trim[j] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i=0; i<32; i++)
|
||||
c9x.mixData[i] = mixData[i];
|
||||
for (int i=0; i<16; i++)
|
||||
c9x.limitData[i] = limitData[i];
|
||||
for (int i=0; i<14; i++)
|
||||
c9x.expoData[i] = expoData[i];
|
||||
for (int i=0; i<8; i++) {
|
||||
CurveInfo crvinfo = curveinfo(this, i);
|
||||
c9x.curves[i].type = (crvinfo.custom ? CurveData::CURVE_TYPE_CUSTOM : CurveData::CURVE_TYPE_STANDARD);
|
||||
c9x.curves[i].count = crvinfo.points;
|
||||
for (int j=0; j<crvinfo.points; j++)
|
||||
c9x.curves[i].points[j].y = crvinfo.crv[j];
|
||||
if (crvinfo.custom) {
|
||||
c9x.curves[i].points[0].x = -100;
|
||||
for (int j=1; j<crvinfo.points-1; j++)
|
||||
c9x.curves[i].points[j].x = crvinfo.crv[crvinfo.points+j-1];
|
||||
c9x.curves[i].points[crvinfo.points-1].x = +100;
|
||||
}
|
||||
else {
|
||||
for (int j=0; j<crvinfo.points; j++)
|
||||
c9x.curves[i].points[j].x = -100 + (200*i) / (crvinfo.points-1);
|
||||
}
|
||||
}
|
||||
for (int i=0; i<12; i++)
|
||||
c9x.logicalSw[i] = logicalSw[i];
|
||||
for (int i=0; i<16; i++)
|
||||
c9x.customFn[i] = customFn[i];
|
||||
c9x.swashRingData = swashR;
|
||||
c9x.frsky = frsky;
|
||||
c9x.switchWarningStates = switchWarningStates;
|
||||
c9x.moduleData[0].ppmFrameLength = ppmFrameLength;
|
||||
c9x.thrTraceSrc = thrTraceSrc;
|
||||
c9x.moduleData[0].modelId = modelId;
|
||||
return c9x;
|
||||
}
|
||||
@@ -1,365 +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 open9xGruvin9xeeprom_h
|
||||
#define open9xGruvin9xeeprom_h
|
||||
|
||||
#define O9X_V4_MAX_CSFUNCOLD 13
|
||||
#define O9X_V4_MAX_CSFUNC 15
|
||||
|
||||
#include "open9xStockeeprom.h"
|
||||
|
||||
PACK(typedef struct t_Open9xGruvin9xFlightModeData_v207 {
|
||||
int8_t trim[4]; // -500..500 => trim value, 501 => use trim of phase 0, 502, 503, 504 => use trim of phases 1|2|3|4 instead
|
||||
int8_t trim_ext:8; // 2 less significant extra bits per trim (10bits trims)
|
||||
int8_t swtch; // swtch of phase[0] is not used
|
||||
char name[6];
|
||||
uint8_t fadeIn:4;
|
||||
uint8_t fadeOut:4;
|
||||
int16_t rotaryEncoders[2];
|
||||
operator FlightModeData();
|
||||
t_Open9xGruvin9xFlightModeData_v207() { memset(this, 0, sizeof(t_Open9xGruvin9xFlightModeData_v207)); }
|
||||
}) Open9xGruvin9xFlightModeData_v207;
|
||||
|
||||
PACK(typedef struct t_Open9xGruvin9xFlightModeData_v208 {
|
||||
int16_t trim[4]; // -500..500 => trim value, 501 => use trim of phase 0, 502, 503, 504 => use trim of phases 1|2|3|4 instead
|
||||
int8_t swtch; // swtch of phase[0] is not used
|
||||
char name[6];
|
||||
uint8_t fadeIn:4;
|
||||
uint8_t fadeOut:4;
|
||||
int16_t rotaryEncoders[2];
|
||||
operator FlightModeData();
|
||||
t_Open9xGruvin9xFlightModeData_v208() { memset(this, 0, sizeof(t_Open9xGruvin9xFlightModeData_v208)); }
|
||||
}) Open9xGruvin9xFlightModeData_v208;
|
||||
|
||||
PACK(typedef struct t_Open9xGruvin9xMixData_v207 {
|
||||
uint8_t destCh:4; // 0, 1..C9X_NUM_CHNOUT
|
||||
int8_t phase:4; // -5=!FP4, 0=normal, 5=FP4
|
||||
int8_t weight;
|
||||
int8_t swtch:6;
|
||||
uint8_t mltpx:2; // multiplex method: 0 means +=, 1 means *=, 2 means :=
|
||||
int8_t curve:6;
|
||||
uint8_t mixWarn:2; // mixer warning
|
||||
uint8_t delayUp:4;
|
||||
uint8_t delayDown:4;
|
||||
uint8_t speedUp:4; // Servogeschwindigkeit aus Tabelle (10ms Cycle)
|
||||
uint8_t speedDown:4; // 0 nichts
|
||||
uint16_t srcRaw:7; //
|
||||
uint16_t differential:7;
|
||||
uint16_t carryTrim:2;
|
||||
int8_t sOffset;
|
||||
|
||||
operator MixData();
|
||||
t_Open9xGruvin9xMixData_v207() { memset(this, 0, sizeof(t_Open9xGruvin9xMixData_v207)); }
|
||||
}) Open9xGruvin9xMixData_v207;
|
||||
|
||||
PACK(typedef struct t_Open9xGruvin9xMixData_v209 {
|
||||
uint8_t destCh:4; // 0, 1..C9X_NUM_CHNOUT
|
||||
int8_t phase:4; // -5=!FP4, 0=normal, 5=FP4
|
||||
int8_t weight;
|
||||
int8_t swtch:6;
|
||||
uint8_t mltpx:2; // multiplex method: 0 means +=, 1 means *=, 2 means :=
|
||||
int8_t curve:6;
|
||||
uint8_t mixWarn:2; // mixer warning
|
||||
uint8_t delayUp:4;
|
||||
uint8_t delayDown:4;
|
||||
uint8_t speedUp:4; // Servogeschwindigkeit aus Tabelle (10ms Cycle)
|
||||
uint8_t speedDown:4; // 0 nichts
|
||||
uint16_t srcRaw:6; //
|
||||
int16_t differential:7;
|
||||
int16_t carryTrim:3;
|
||||
int8_t sOffset;
|
||||
|
||||
operator MixData();
|
||||
t_Open9xGruvin9xMixData_v209() { memset(this, 0, sizeof(t_Open9xGruvin9xMixData_v209)); }
|
||||
}) Open9xGruvin9xMixData_v209;
|
||||
|
||||
PACK(typedef struct t_Open9xGruvin9xMixData_v211 {
|
||||
uint8_t destCh:4; // 0, 1..C9X_NUM_CHNOUT
|
||||
uint8_t curveMode:1; // O=curve, 1=differential
|
||||
uint8_t noExpo:1;
|
||||
uint8_t spare:2;
|
||||
int8_t weight;
|
||||
int8_t swtch:6;
|
||||
uint8_t mltpx:2; // multiplex method: 0 means +=, 1 means *=, 2 means :=
|
||||
uint8_t phases:5;
|
||||
int8_t carryTrim:3;
|
||||
uint8_t srcRaw:6;
|
||||
uint8_t mixWarn:2; // mixer warning
|
||||
uint8_t delayUp:4;
|
||||
uint8_t delayDown:4;
|
||||
uint8_t speedUp:4;
|
||||
uint8_t speedDown:4;
|
||||
int8_t curveParam;
|
||||
int8_t sOffset;
|
||||
|
||||
operator MixData();
|
||||
t_Open9xGruvin9xMixData_v211() { memset(this, 0, sizeof(t_Open9xGruvin9xMixData_v211)); }
|
||||
}) Open9xGruvin9xMixData_v211;
|
||||
|
||||
PACK(typedef struct t_Open9xGruvin9xLogicalSwitchData_v207 { // Custom Switches data
|
||||
int8_t v1; //input
|
||||
int8_t v2; //offset
|
||||
uint8_t func;
|
||||
|
||||
operator LogicalSwitchData();
|
||||
t_Open9xGruvin9xLogicalSwitchData_v207() { memset(this, 0, sizeof(t_Open9xGruvin9xLogicalSwitchData_v207)); }
|
||||
int8_t fromSource(RawSource source);
|
||||
RawSource toSource(int8_t value);
|
||||
}) Open9xGruvin9xLogicalSwitchData_v207;
|
||||
|
||||
PACK(typedef struct t_Open9xGruvin9xLogicalSwitchData_v209 { // Custom Switches data
|
||||
int8_t v1; //input
|
||||
int8_t v2; //offset
|
||||
uint8_t func;
|
||||
|
||||
operator LogicalSwitchData();
|
||||
t_Open9xGruvin9xLogicalSwitchData_v209() { memset(this, 0, sizeof(t_Open9xGruvin9xLogicalSwitchData_v209)); }
|
||||
int8_t fromSource(RawSource source);
|
||||
RawSource toSource(int8_t value);
|
||||
}) Open9xGruvin9xLogicalSwitchData_v209;
|
||||
|
||||
PACK(typedef struct t_Open9xGruvin9xCustomFunctionData_v203 { // Function Switches data
|
||||
int8_t swtch; // input
|
||||
uint8_t func;
|
||||
uint8_t param;
|
||||
|
||||
operator CustomFunctionData();
|
||||
t_Open9xGruvin9xCustomFunctionData_v203() { memset(this, 0, sizeof(t_Open9xGruvin9xCustomFunctionData_v203)); }
|
||||
}) Open9xGruvin9xCustomFunctionData_v203;
|
||||
|
||||
PACK(typedef struct t_Open9xGruvin9xCustomFunctionData_v210 { // Function Switches data
|
||||
int8_t swtch; // input
|
||||
uint8_t func:5;
|
||||
uint8_t delay:3;
|
||||
uint8_t param;
|
||||
|
||||
operator CustomFunctionData();
|
||||
t_Open9xGruvin9xCustomFunctionData_v210() { memset(this, 0, sizeof(t_Open9xGruvin9xCustomFunctionData_v210)); }
|
||||
}) Open9xGruvin9xCustomFunctionData_v210;
|
||||
|
||||
PACK(typedef struct t_Open9xGruvin9xSwashRingData_v208 { // Swash Ring data
|
||||
uint8_t invertELE:1;
|
||||
uint8_t invertAIL:1;
|
||||
uint8_t invertCOL:1;
|
||||
uint8_t type:5;
|
||||
uint8_t collectiveSource;
|
||||
uint8_t value;
|
||||
|
||||
operator SwashRingData();
|
||||
t_Open9xGruvin9xSwashRingData_v208() { memset(this, 0, sizeof(t_Open9xGruvin9xSwashRingData_v208)); }
|
||||
}) Open9xGruvin9xSwashRingData_v208;
|
||||
|
||||
PACK(typedef struct t_Open9xGruvin9xSwashRingData_v209 { // Swash Ring data
|
||||
uint8_t invertELE:1;
|
||||
uint8_t invertAIL:1;
|
||||
uint8_t invertCOL:1;
|
||||
uint8_t type:5;
|
||||
uint8_t collectiveSource;
|
||||
uint8_t value;
|
||||
|
||||
operator SwashRingData();
|
||||
t_Open9xGruvin9xSwashRingData_v209() { memset(this, 0, sizeof(t_Open9xGruvin9xSwashRingData_v209)); }
|
||||
}) Open9xGruvin9xSwashRingData_v209;
|
||||
|
||||
PACK(typedef struct t_Open9xGruvin9xModelData_v207 {
|
||||
char name[10]; // 10 must be first for eeLoadModelName
|
||||
Open9xTimerData_v202 timers[2];
|
||||
uint8_t protocol:3;
|
||||
uint8_t thrTrim:1; // Enable Throttle Trim
|
||||
int8_t ppmNCH:4;
|
||||
uint8_t trimInc:3; // Trim Increments
|
||||
uint8_t spare1:1;
|
||||
uint8_t pulsePol:1;
|
||||
uint8_t extendedLimits:1;
|
||||
uint8_t extendedTrims:1;
|
||||
uint8_t spare2:1;
|
||||
int8_t ppmDelay;
|
||||
uint16_t beepANACenter; // 1<<0->A1.. 1<<6->A7
|
||||
Open9xGruvin9xMixData_v207 mixData[32];
|
||||
Open9xLimitData_v201 limitData[16];
|
||||
Open9xExpoData_v201 expoData[14];
|
||||
int8_t curves5[8][5];
|
||||
int8_t curves9[8][9];
|
||||
Open9xGruvin9xLogicalSwitchData_v207 logicalSw[12];
|
||||
Open9xCustomFunctionData_v203 customFn[16];
|
||||
Open9xGruvin9xSwashRingData_v208 swashR;
|
||||
Open9xGruvin9xFlightModeData_v207 flightModeData[5];
|
||||
Open9xFrSkyData_v205 frsky;
|
||||
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
|
||||
uint8_t thrTraceSrc;
|
||||
uint8_t modelId;
|
||||
uint8_t frskyLines[4];
|
||||
uint16_t frskyLinesXtra;
|
||||
|
||||
operator ModelData();
|
||||
t_Open9xGruvin9xModelData_v207() { memset(this, 0, sizeof(t_Open9xGruvin9xModelData_v207)); }
|
||||
}) Open9xGruvin9xModelData_v207;
|
||||
|
||||
PACK(typedef struct t_Open9xGruvin9xModelData_v208 {
|
||||
char name[10]; // 10 must be first for eeLoadModelName
|
||||
Open9xTimerData_v202 timers[2];
|
||||
uint8_t protocol:3;
|
||||
uint8_t thrTrim:1; // Enable Throttle Trim
|
||||
int8_t ppmNCH:4;
|
||||
uint8_t trimInc:3; // Trim Increments
|
||||
uint8_t disableThrottleWarning:1;
|
||||
uint8_t pulsePol:1;
|
||||
uint8_t extendedLimits:1;
|
||||
uint8_t extendedTrims:1;
|
||||
uint8_t spare2:1;
|
||||
int8_t ppmDelay;
|
||||
uint16_t beepANACenter; // 1<<0->A1.. 1<<6->A7
|
||||
Open9xGruvin9xMixData_v207 mixData[32];
|
||||
Open9xLimitData_v201 limitData[16];
|
||||
Open9xExpoData_v201 expoData[14];
|
||||
int8_t curves5[8][5];
|
||||
int8_t curves9[8][9];
|
||||
Open9xGruvin9xLogicalSwitchData_v207 logicalSw[12];
|
||||
Open9xGruvin9xCustomFunctionData_v203 customFn[16];
|
||||
Open9xGruvin9xSwashRingData_v208 swashR;
|
||||
Open9xGruvin9xFlightModeData_v208 flightModeData[5];
|
||||
Open9xFrSkyData_v208 frsky;
|
||||
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
|
||||
uint8_t thrTraceSrc;
|
||||
uint8_t modelId;
|
||||
uint8_t frskyLines[4];
|
||||
uint16_t frskyLinesXtra;
|
||||
int8_t servoCenter[16];
|
||||
|
||||
uint8_t varioSource:3;
|
||||
uint8_t varioSpeedUpMin:5; // if increment in 0.2m/s = 3.0m/s max
|
||||
uint8_t varioSpeedDownMin;
|
||||
|
||||
operator ModelData();
|
||||
t_Open9xGruvin9xModelData_v208() { memset(this, 0, sizeof(t_Open9xGruvin9xModelData_v208)); }
|
||||
}) Open9xGruvin9xModelData_v208;
|
||||
|
||||
PACK(typedef struct t_Open9xGruvin9xModelData_v209 {
|
||||
char name[10]; // 10 must be first for eeLoadModelName
|
||||
Open9xTimerData_v202 timers[2];
|
||||
uint8_t protocol:3;
|
||||
uint8_t thrTrim:1; // Enable Throttle Trim
|
||||
int8_t ppmNCH:4;
|
||||
uint8_t trimInc:3; // Trim Increments
|
||||
uint8_t disableThrottleWarning:1;
|
||||
uint8_t pulsePol:1;
|
||||
uint8_t extendedLimits:1;
|
||||
uint8_t extendedTrims:1;
|
||||
uint8_t spare2:1;
|
||||
int8_t ppmDelay;
|
||||
uint16_t beepANACenter; // 1<<0->A1.. 1<<6->A7
|
||||
Open9xGruvin9xMixData_v209 mixData[32];
|
||||
Open9xLimitData_v201 limitData[16];
|
||||
Open9xExpoData_v201 expoData[14];
|
||||
int8_t curves5[8][5];
|
||||
int8_t curves9[8][9];
|
||||
Open9xGruvin9xLogicalSwitchData_v209 logicalSw[12];
|
||||
Open9xGruvin9xCustomFunctionData_v203 customFn[16];
|
||||
Open9xGruvin9xSwashRingData_v209 swashR;
|
||||
Open9xGruvin9xFlightModeData_v208 flightModeData[5];
|
||||
Open9xFrSkyData_v208 frsky;
|
||||
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
|
||||
uint8_t thrTraceSrc;
|
||||
uint8_t modelId;
|
||||
uint8_t frskyLines[4];
|
||||
uint16_t frskyLinesXtra;
|
||||
int8_t servoCenter[16];
|
||||
|
||||
uint8_t varioSource:3;
|
||||
uint8_t varioSpeedUpMin:5; // if increment in 0.2m/s = 3.0m/s max
|
||||
uint8_t varioSpeedDownMin;
|
||||
uint8_t switchWarningStates;
|
||||
|
||||
operator ModelData();
|
||||
t_Open9xGruvin9xModelData_v209() { memset(this, 0, sizeof(t_Open9xGruvin9xModelData_v209)); }
|
||||
}) Open9xGruvin9xModelData_v209;
|
||||
|
||||
PACK(typedef struct t_Open9xGruvin9xModelData_v210 {
|
||||
char name[10]; // 10 must be first for eeLoadModelName
|
||||
Open9xTimerData_v202 timers[2];
|
||||
uint8_t protocol:3;
|
||||
uint8_t thrTrim:1; // Enable Throttle Trim
|
||||
int8_t ppmNCH:4;
|
||||
uint8_t trimInc:3; // Trim Increments
|
||||
uint8_t disableThrottleWarning:1;
|
||||
uint8_t pulsePol:1;
|
||||
uint8_t extendedLimits:1;
|
||||
uint8_t extendedTrims:1;
|
||||
uint8_t spare2:1;
|
||||
int8_t ppmDelay;
|
||||
uint16_t beepANACenter; // 1<<0->A1.. 1<<6->A7
|
||||
Open9xGruvin9xMixData_v209 mixData[32];
|
||||
Open9xLimitData_v201 limitData[16];
|
||||
Open9xExpoData_v201 expoData[14];
|
||||
int8_t curves[8];
|
||||
int8_t points[112-8];
|
||||
Open9xGruvin9xLogicalSwitchData_v209 logicalSw[12];
|
||||
Open9xGruvin9xCustomFunctionData_v210 customFn[16];
|
||||
Open9xGruvin9xSwashRingData_v209 swashR;
|
||||
Open9xGruvin9xFlightModeData_v208 flightModeData[5];
|
||||
|
||||
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
|
||||
uint8_t thrTraceSrc;
|
||||
uint8_t modelId;
|
||||
|
||||
int8_t servoCenter[16];
|
||||
|
||||
uint8_t switchWarningStates;
|
||||
|
||||
Open9xFrSkyData_v210 frsky;
|
||||
|
||||
operator ModelData();
|
||||
t_Open9xGruvin9xModelData_v210() { memset(this, 0, sizeof(t_Open9xGruvin9xModelData_v210)); }
|
||||
}) Open9xGruvin9xModelData_v210;
|
||||
|
||||
PACK(typedef struct t_Open9xGruvin9xModelData_v211 {
|
||||
char name[10]; // 10 must be first for eeLoadModelName
|
||||
Open9xTimerData_v202 timers[2];
|
||||
uint8_t protocol:3;
|
||||
uint8_t thrTrim:1; // Enable Throttle Trim
|
||||
int8_t ppmNCH:4;
|
||||
uint8_t trimInc:3; // Trim Increments
|
||||
uint8_t disableThrottleWarning:1;
|
||||
uint8_t pulsePol:1;
|
||||
uint8_t extendedLimits:1;
|
||||
uint8_t extendedTrims:1;
|
||||
uint8_t spare1:1;
|
||||
int8_t ppmDelay;
|
||||
uint16_t beepANACenter; // 1<<0->A1.. 1<<6->A7
|
||||
Open9xGruvin9xMixData_v211 mixData[32];
|
||||
Open9xLimitData_v211 limitData[16];
|
||||
Open9xExpoData_v211 expoData[14];
|
||||
int8_t curves[8];
|
||||
int8_t points[112-8];
|
||||
Open9xGruvin9xLogicalSwitchData_v209 logicalSw[12];
|
||||
Open9xGruvin9xCustomFunctionData_v210 customFn[16];
|
||||
Open9xGruvin9xSwashRingData_v209 swashR;
|
||||
Open9xGruvin9xFlightModeData_v208 flightModeData[5];
|
||||
|
||||
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
|
||||
uint8_t thrTraceSrc;
|
||||
uint8_t modelId;
|
||||
uint8_t switchWarningStates;
|
||||
|
||||
Open9xFrSkyData_v210 frsky;
|
||||
Open9xTimerDataExtra timersXtra[2];
|
||||
|
||||
operator ModelData();
|
||||
t_Open9xGruvin9xModelData_v211() { memset(this, 0, sizeof(t_Open9xGruvin9xModelData_v211)); }
|
||||
}) Open9xGruvin9xModelData_v211;
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,508 +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 open9xSky9xeeprom_h
|
||||
#define open9xSky9xeeprom_h
|
||||
|
||||
#include "open9xStockeeprom.h"
|
||||
|
||||
PACK(typedef struct t_Open9xArmTimerData_v202 {
|
||||
int8_t mode; // timer trigger source -> off, abs, stk, stk%, sw/!sw, !m_sw/!m_sw
|
||||
uint16_t val;
|
||||
|
||||
operator TimerData();
|
||||
t_Open9xArmTimerData_v202() { memset(this, 0, sizeof(t_Open9xArmTimerData_v202)); }
|
||||
}) Open9xArmTimerData_v202;
|
||||
|
||||
PACK(typedef struct t_Open9xArmExpoData_v208 {
|
||||
uint8_t mode; // 0=end, 1=pos, 2=neg, 3=both
|
||||
uint8_t chn;
|
||||
int8_t curve; // 0=no curve, 1-6=std curves, 7-10=CV1-CV4, 11-15=CV9-CV13
|
||||
int8_t swtch;
|
||||
int8_t phase; // if negPhase is 0: 0=normal, 5=FP4 if negPhase is 1: 5=!FP4
|
||||
uint8_t weight;
|
||||
int8_t expo;
|
||||
|
||||
operator ExpoData();
|
||||
t_Open9xArmExpoData_v208() { memset(this, 0, sizeof(t_Open9xArmExpoData_v208)); }
|
||||
}) Open9xArmExpoData_v208;
|
||||
|
||||
PACK(typedef struct t_Open9xArmExpoData_v210 {
|
||||
uint8_t mode; // 0=end, 1=pos, 2=neg, 3=both
|
||||
uint8_t chn;
|
||||
int8_t curve; // 0=no curve, 1-6=std curves, 7-10=CV1-CV4, 11-15=CV9-CV13
|
||||
int8_t swtch;
|
||||
int8_t phase; // if negPhase is 0: 0=normal, 5=FP4 if negPhase is 1: 5=!FP4
|
||||
uint8_t weight;
|
||||
int8_t expo;
|
||||
char name[6];
|
||||
uint8_t spare[4];
|
||||
|
||||
operator ExpoData();
|
||||
t_Open9xArmExpoData_v210() { memset(this, 0, sizeof(t_Open9xArmExpoData_v210)); }
|
||||
}) Open9xArmExpoData_v210;
|
||||
|
||||
PACK(typedef struct t_Open9xArmExpoData_v212 {
|
||||
uint8_t mode; // 0=end, 1=pos, 2=neg, 3=both
|
||||
uint8_t chn;
|
||||
int8_t swtch;
|
||||
uint16_t phases;
|
||||
int8_t weight;
|
||||
uint8_t curveMode;
|
||||
char name[6];
|
||||
int8_t curveParam;
|
||||
|
||||
operator ExpoData();
|
||||
t_Open9xArmExpoData_v212() { memset(this, 0, sizeof(t_Open9xArmExpoData_v212)); }
|
||||
}) Open9xArmExpoData_v212;
|
||||
|
||||
PACK(typedef struct t_Open9xArmMixData_v208 {
|
||||
uint8_t destCh; // 0, 1..C9X_NUM_CHNOUT
|
||||
int8_t phase; // -5=!FP4, 0=normal, 5=FP4
|
||||
int8_t weight;
|
||||
int8_t swtch;
|
||||
uint8_t mltpx; // multiplex method: 0 means +=, 1 means *=, 2 means :=
|
||||
int8_t curve;
|
||||
uint8_t mixWarn; // mixer warning
|
||||
uint8_t delayUp;
|
||||
uint8_t delayDown;
|
||||
uint8_t speedUp; // Servogeschwindigkeit aus Tabelle (10ms Cycle)
|
||||
uint8_t speedDown; // 0 nichts
|
||||
uint8_t srcRaw; //
|
||||
int8_t differential;
|
||||
uint8_t carryTrim;
|
||||
int8_t sOffset;
|
||||
|
||||
operator MixData();
|
||||
t_Open9xArmMixData_v208() { memset(this, 0, sizeof(t_Open9xArmMixData_v208)); }
|
||||
}) Open9xArmMixData_v208;
|
||||
|
||||
PACK(typedef struct t_Open9xArmMixData_v209 {
|
||||
uint8_t destCh; // 0, 1..C9X_NUM_CHNOUT
|
||||
int8_t phase; // -5=!FP4, 0=normal, 5=FP4
|
||||
int8_t weight;
|
||||
int8_t swtch;
|
||||
uint8_t mltpx; // multiplex method: 0 means +=, 1 means *=, 2 means :=
|
||||
int8_t curve;
|
||||
uint8_t mixWarn; // mixer warning
|
||||
uint8_t delayUp;
|
||||
uint8_t delayDown;
|
||||
uint8_t speedUp; // Servogeschwindigkeit aus Tabelle (10ms Cycle)
|
||||
uint8_t speedDown; // 0 nichts
|
||||
uint8_t srcRaw; //
|
||||
int8_t differential;
|
||||
int8_t carryTrim;
|
||||
int8_t sOffset;
|
||||
|
||||
operator MixData();
|
||||
t_Open9xArmMixData_v209() { memset(this, 0, sizeof(t_Open9xArmMixData_v209)); }
|
||||
}) Open9xArmMixData_v209;
|
||||
|
||||
PACK(typedef struct t_Open9xArmMixData_v210 {
|
||||
uint8_t destCh; // 0, 1..C9X_NUM_CHNOUT
|
||||
int8_t phase; // -5=!FP4, 0=normal, 5=FP4
|
||||
int8_t weight;
|
||||
int8_t swtch;
|
||||
uint8_t mltpx; // multiplex method: 0 means +=, 1 means *=, 2 means :=
|
||||
int8_t curve;
|
||||
uint8_t mixWarn; // mixer warning
|
||||
uint8_t delayUp;
|
||||
uint8_t delayDown;
|
||||
uint8_t speedUp; // Servogeschwindigkeit aus Tabelle (10ms Cycle)
|
||||
uint8_t speedDown; // 0 nichts
|
||||
uint8_t srcRaw; //
|
||||
int8_t differential;
|
||||
int8_t carryTrim;
|
||||
int8_t sOffset;
|
||||
char name[6];
|
||||
uint8_t spare[4];
|
||||
|
||||
operator MixData();
|
||||
t_Open9xArmMixData_v210() { memset(this, 0, sizeof(t_Open9xArmMixData_v210)); }
|
||||
}) Open9xArmMixData_v210;
|
||||
|
||||
PACK(typedef struct t_Open9xArmMixData_v212 {
|
||||
uint8_t destCh;
|
||||
uint16_t phases;
|
||||
uint8_t curveMode:1; // O=curve, 1=differential
|
||||
uint8_t noExpo:1;
|
||||
int8_t carryTrim:3;
|
||||
uint8_t mltpx:2; // multiplex method: 0 means +=, 1 means *=, 2 means :=
|
||||
uint8_t spare:1;
|
||||
int8_t weight;
|
||||
int8_t swtch;
|
||||
int8_t curveParam;
|
||||
uint8_t mixWarn; // mixer warning
|
||||
uint8_t delayUp;
|
||||
uint8_t delayDown;
|
||||
uint8_t speedUp;
|
||||
uint8_t speedDown;
|
||||
uint8_t srcRaw;
|
||||
int8_t sOffset;
|
||||
char name[6];
|
||||
|
||||
operator MixData();
|
||||
t_Open9xArmMixData_v212() { memset(this, 0, sizeof(t_Open9xArmMixData_v212)); }
|
||||
}) Open9xArmMixData_v212;
|
||||
|
||||
PACK(typedef struct t_Open9xArmFlightModeData_v208 {
|
||||
int16_t trim[4]; // -500..500 => trim value, 501 => use trim of phase 0, 502, 503, 504 => use trim of phases 1|2|3|4 instead
|
||||
int8_t swtch; // swtch of phase[0] is not used
|
||||
char name[6];
|
||||
uint8_t fadeIn:4;
|
||||
uint8_t fadeOut:4;
|
||||
operator FlightModeData();
|
||||
t_Open9xArmFlightModeData_v208() { memset(this, 0, sizeof(t_Open9xArmFlightModeData_v208)); }
|
||||
}) Open9xArmFlightModeData_v208;
|
||||
|
||||
PACK(typedef struct t_Open9xArmFlightModeData_v212 {
|
||||
int16_t trim[4]; // -500..500 => trim value, 501 => use trim of phase 0, 502, 503, 504 => use trim of phases 1|2|3|4 instead
|
||||
int8_t swtch; // swtch of phase[0] is not used
|
||||
char name[6];
|
||||
uint8_t fadeIn:4;
|
||||
uint8_t fadeOut:4;
|
||||
int16_t rotaryEncoders[1];
|
||||
operator FlightModeData();
|
||||
t_Open9xArmFlightModeData_v212() { memset(this, 0, sizeof(t_Open9xArmFlightModeData_v212)); }
|
||||
}) Open9xArmFlightModeData_v212;
|
||||
|
||||
PACK(typedef struct t_Open9xArmLogicalSwitchData_v208 { // Custom Switches data
|
||||
int8_t v1; //input
|
||||
int8_t v2; //offset
|
||||
uint8_t func;
|
||||
|
||||
operator LogicalSwitchData();
|
||||
t_Open9xArmLogicalSwitchData_v208() { memset(this, 0, sizeof(t_Open9xArmLogicalSwitchData_v208)); }
|
||||
}) Open9xArmLogicalSwitchData_v208;
|
||||
|
||||
PACK(typedef struct t_Open9xArmLogicalSwitchData_v209 { // Custom Switches data
|
||||
int8_t v1; //input
|
||||
int8_t v2; //offset
|
||||
uint8_t func;
|
||||
|
||||
operator LogicalSwitchData();
|
||||
t_Open9xArmLogicalSwitchData_v209() { memset(this, 0, sizeof(t_Open9xArmLogicalSwitchData_v209)); }
|
||||
}) Open9xArmLogicalSwitchData_v209;
|
||||
|
||||
PACK(typedef struct t_Open9xArmLogicalSwitchData_v210 { // Custom Switches data
|
||||
int8_t v1; //input
|
||||
int8_t v2; //offset
|
||||
uint8_t func;
|
||||
uint8_t delay;
|
||||
uint8_t duration;
|
||||
|
||||
operator LogicalSwitchData();
|
||||
t_Open9xArmLogicalSwitchData_v210() { memset(this, 0, sizeof(t_Open9xArmLogicalSwitchData_v210)); }
|
||||
}) Open9xArmLogicalSwitchData_v210;
|
||||
|
||||
PACK(typedef struct t_Open9xArmCustomFunctionData_v208 { // Function Switches data
|
||||
int8_t swtch; // input
|
||||
uint8_t func;
|
||||
uint8_t param;
|
||||
|
||||
operator CustomFunctionData();
|
||||
t_Open9xArmCustomFunctionData_v208() { memset(this, 0, sizeof(t_Open9xArmCustomFunctionData_v208)); }
|
||||
}) Open9xArmCustomFunctionData_v208;
|
||||
|
||||
PACK(typedef struct t_Open9xArmCustomFunctionData_v210 { // Function Switches data
|
||||
int8_t swtch; // input
|
||||
uint8_t func;
|
||||
char param[6];
|
||||
|
||||
operator CustomFunctionData();
|
||||
t_Open9xArmCustomFunctionData_v210() { memset(this, 0, sizeof(t_Open9xArmCustomFunctionData_v210)); }
|
||||
}) Open9xArmCustomFunctionData_v210;
|
||||
|
||||
PACK(typedef struct t_Open9xArmCustomFunctionData_v211 { // Function Switches data
|
||||
int8_t swtch; // input
|
||||
uint8_t func;
|
||||
char param[6];
|
||||
uint8_t delay;
|
||||
uint8_t spare;
|
||||
|
||||
operator CustomFunctionData();
|
||||
t_Open9xArmCustomFunctionData_v211() { memset(this, 0, sizeof(t_Open9xArmCustomFunctionData_v211)); }
|
||||
}) Open9xArmCustomFunctionData_v211;
|
||||
|
||||
PACK(typedef struct t_Open9xArmSwashRingData_v208 { // Swash Ring data
|
||||
uint8_t invertELE:1;
|
||||
uint8_t invertAIL:1;
|
||||
uint8_t invertCOL:1;
|
||||
uint8_t type:5;
|
||||
uint8_t collectiveSource;
|
||||
uint8_t value;
|
||||
|
||||
operator SwashRingData();
|
||||
t_Open9xArmSwashRingData_v208() { memset(this, 0, sizeof(t_Open9xArmSwashRingData_v208)); }
|
||||
}) Open9xArmSwashRingData_v208;
|
||||
|
||||
PACK(typedef struct t_Open9xArmSwashRingData_v209 { // Swash Ring data
|
||||
uint8_t invertELE:1;
|
||||
uint8_t invertAIL:1;
|
||||
uint8_t invertCOL:1;
|
||||
uint8_t type:5;
|
||||
uint8_t collectiveSource;
|
||||
uint8_t value;
|
||||
|
||||
operator SwashRingData();
|
||||
t_Open9xArmSwashRingData_v209() { memset(this, 0, sizeof(t_Open9xArmSwashRingData_v209)); }
|
||||
}) Open9xArmSwashRingData_v209;
|
||||
|
||||
PACK(typedef struct t_Open9xArmSwashRingData_v210 { // Swash Ring data
|
||||
uint8_t invertELE:1;
|
||||
uint8_t invertAIL:1;
|
||||
uint8_t invertCOL:1;
|
||||
uint8_t type:5;
|
||||
uint8_t collectiveSource;
|
||||
uint8_t value;
|
||||
|
||||
operator SwashRingData();
|
||||
t_Open9xArmSwashRingData_v210() { memset(this, 0, sizeof(t_Open9xArmSwashRingData_v210)); }
|
||||
}) Open9xArmSwashRingData_v210;
|
||||
|
||||
|
||||
PACK(typedef struct t_Open9xArmFrSkyBarData_v210 {
|
||||
uint8_t source;
|
||||
uint8_t barMin; // minimum for bar display
|
||||
uint8_t barMax; // ditto for max display (would usually = ratio)
|
||||
}) Open9xArmFrSkyBarData_v210;
|
||||
|
||||
PACK(typedef struct t_Open9xArmFrSkyData_v210 {
|
||||
Open9xFrSkyChannelData_v208 channels[2];
|
||||
uint8_t usrProto:2; // Protocol in FrSky user data, 0=None, 1=FrSky hub, 2=WS HowHigh
|
||||
uint8_t voltsSource:2;
|
||||
uint8_t blades:2;
|
||||
uint8_t currentSource:2;
|
||||
Open9xArmFrSkyBarData_v210 bars[4];
|
||||
Open9xFrSkyRSSIAlarm rssiAlarms[2];
|
||||
uint8_t lines[4*2*2];
|
||||
uint8_t spare[4];
|
||||
|
||||
operator FrSkyData();
|
||||
t_Open9xArmFrSkyData_v210() { memset(this, 0, sizeof(t_Open9xArmFrSkyData_v210)); }
|
||||
}) Open9xArmFrSkyData_v210;
|
||||
|
||||
PACK(typedef struct t_Open9xArmFrSkyData_v211 {
|
||||
Open9xFrSkyChannelData_v208 channels[2];
|
||||
Open9xFrSkyRSSIAlarm rssiAlarms[2];
|
||||
uint8_t usrProto; // Protocol in FrSky user data, 0=None, 1=FrSky hub, 2=WS HowHigh
|
||||
uint8_t voltsSource;
|
||||
uint8_t blades; // How many blades for RPMs, 0=2 blades, 1=3 blades
|
||||
uint8_t currentSource;
|
||||
Open9xArmFrSkyBarData_v210 bars[4];
|
||||
uint8_t lines[4*2*2];
|
||||
uint8_t varioSource;
|
||||
uint8_t varioSpeedUpMin; // if increment in 0.2m/s = 3.0m/s max
|
||||
uint8_t varioSpeedDownMin;
|
||||
uint8_t spare[4];
|
||||
|
||||
operator FrSkyData();
|
||||
t_Open9xArmFrSkyData_v211() { memset(this, 0, sizeof(t_Open9xArmFrSkyData_v211)); }
|
||||
}) Open9xArmFrSkyData_v211;
|
||||
|
||||
PACK(typedef struct t_Open9xArmModelData_v208 {
|
||||
char name[10]; // 10 must be first for eeLoadModelName
|
||||
Open9xArmTimerData_v202 timers[2];
|
||||
uint8_t protocol:3;
|
||||
uint8_t thrTrim:1; // Enable Throttle Trim
|
||||
int8_t ppmNCH:4;
|
||||
uint8_t trimInc:3; // Trim Increments
|
||||
uint8_t disableThrottleWarning:1;
|
||||
uint8_t pulsePol:1;
|
||||
uint8_t extendedLimits:1;
|
||||
uint8_t extendedTrims:1;
|
||||
uint8_t spare2:1;
|
||||
int8_t ppmDelay;
|
||||
uint16_t beepANACenter; // 1<<0->A1.. 1<<6->A7
|
||||
Open9xArmMixData_v208 mixData[64];
|
||||
Open9xLimitData_v201 limitData[32];
|
||||
Open9xArmExpoData_v208 expoData[32];
|
||||
int8_t curves5[8][5];
|
||||
int8_t curves9[8][9];
|
||||
Open9xArmLogicalSwitchData_v208 logicalSw[32];
|
||||
Open9xArmCustomFunctionData_v208 customFn[32];
|
||||
Open9xArmSwashRingData_v208 swashR;
|
||||
Open9xArmFlightModeData_v208 flightModeData[9];
|
||||
Open9xFrSkyData_v208 frsky;
|
||||
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
|
||||
uint8_t thrTraceSrc;
|
||||
uint8_t modelId;
|
||||
uint8_t frskyLines[4];
|
||||
uint16_t frskyLinesXtra;
|
||||
int8_t servoCenter[32];
|
||||
|
||||
uint8_t varioSource:3;
|
||||
uint8_t varioSpeedUpMin:5; // if increment in 0.2m/s = 3.0m/s max
|
||||
uint8_t varioSpeedDownMin;
|
||||
|
||||
operator ModelData();
|
||||
t_Open9xArmModelData_v208() { memset(this, 0, sizeof(t_Open9xArmModelData_v208)); }
|
||||
}) Open9xArmModelData_v208;
|
||||
|
||||
PACK(typedef struct t_Open9xArmModelData_v209 {
|
||||
char name[10]; // 10 must be first for eeLoadModelName
|
||||
Open9xArmTimerData_v202 timers[2];
|
||||
uint8_t protocol:3;
|
||||
uint8_t thrTrim:1; // Enable Throttle Trim
|
||||
int8_t ppmNCH:4;
|
||||
uint8_t trimInc:3; // Trim Increments
|
||||
uint8_t disableThrottleWarning:1;
|
||||
uint8_t pulsePol:1;
|
||||
uint8_t extendedLimits:1;
|
||||
uint8_t extendedTrims:1;
|
||||
uint8_t spare2:1;
|
||||
int8_t ppmDelay;
|
||||
uint16_t beepANACenter; // 1<<0->A1.. 1<<6->A7
|
||||
Open9xArmMixData_v209 mixData[64];
|
||||
Open9xLimitData_v201 limitData[32];
|
||||
Open9xArmExpoData_v208 expoData[32];
|
||||
int8_t curves5[8][5];
|
||||
int8_t curves9[8][9];
|
||||
Open9xArmLogicalSwitchData_v209 logicalSw[32];
|
||||
Open9xArmCustomFunctionData_v208 customFn[32];
|
||||
Open9xArmSwashRingData_v209 swashR;
|
||||
Open9xArmFlightModeData_v208 flightModeData[9];
|
||||
Open9xFrSkyData_v208 frsky;
|
||||
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
|
||||
uint8_t thrTraceSrc;
|
||||
uint8_t modelId;
|
||||
uint8_t frskyLines[4];
|
||||
uint16_t frskyLinesXtra;
|
||||
int8_t servoCenter[32];
|
||||
|
||||
uint8_t varioSource:3;
|
||||
uint8_t varioSpeedUpMin:5; // if increment in 0.2m/s = 3.0m/s max
|
||||
uint8_t varioSpeedDownMin;
|
||||
uint8_t switchWarningStates;
|
||||
|
||||
operator ModelData();
|
||||
t_Open9xArmModelData_v209() { memset(this, 0, sizeof(t_Open9xArmModelData_v209)); }
|
||||
}) Open9xArmModelData_v209;
|
||||
|
||||
PACK(typedef struct t_Open9xArmModelData_v210 {
|
||||
char name[10]; // 10 must be first for eeLoadModelName
|
||||
Open9xArmTimerData_v202 timers[2];
|
||||
uint8_t protocol:3;
|
||||
uint8_t thrTrim:1; // Enable Throttle Trim
|
||||
int8_t ppmNCH:4;
|
||||
uint8_t trimInc:3; // Trim Increments
|
||||
uint8_t disableThrottleWarning:1;
|
||||
uint8_t pulsePol:1;
|
||||
uint8_t extendedLimits:1;
|
||||
uint8_t extendedTrims:1;
|
||||
uint8_t spare2:1;
|
||||
int8_t ppmDelay;
|
||||
uint16_t beepANACenter; // 1<<0->A1.. 1<<6->A7
|
||||
Open9xArmMixData_v210 mixData[64];
|
||||
Open9xLimitData_v201 limitData[32];
|
||||
Open9xArmExpoData_v210 expoData[32];
|
||||
int8_t curves5[8][5];
|
||||
int8_t curves9[8][9];
|
||||
Open9xArmLogicalSwitchData_v210 logicalSw[32];
|
||||
Open9xArmCustomFunctionData_v210 customFn[32];
|
||||
Open9xArmSwashRingData_v209 swashR;
|
||||
Open9xArmFlightModeData_v208 flightModeData[9];
|
||||
Open9xArmFrSkyData_v210 frsky;
|
||||
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
|
||||
uint8_t thrTraceSrc;
|
||||
uint8_t modelId;
|
||||
int8_t servoCenter[32];
|
||||
|
||||
uint8_t varioSource:3;
|
||||
uint8_t varioSpeedUpMin:5; // if increment in 0.2m/s = 3.0m/s max
|
||||
uint8_t varioSpeedDownMin;
|
||||
uint8_t switchWarningStates;
|
||||
|
||||
operator ModelData();
|
||||
t_Open9xArmModelData_v210() { memset(this, 0, sizeof(t_Open9xArmModelData_v210)); }
|
||||
|
||||
}) Open9xArmModelData_v210;
|
||||
|
||||
PACK(typedef struct t_Open9xArmModelData_v211 {
|
||||
char name[10]; // 10 must be first for eeLoadModelName
|
||||
Open9xArmTimerData_v202 timers[2];
|
||||
uint8_t protocol:3;
|
||||
uint8_t thrTrim:1; // Enable Throttle Trim
|
||||
int8_t ppmNCH:4;
|
||||
uint8_t trimInc:3; // Trim Increments
|
||||
uint8_t disableThrottleWarning:1;
|
||||
uint8_t pulsePol:1;
|
||||
uint8_t extendedLimits:1;
|
||||
uint8_t extendedTrims:1;
|
||||
uint8_t spare2:1;
|
||||
int8_t ppmDelay;
|
||||
uint16_t beepANACenter; // 1<<0->A1.. 1<<6->A7
|
||||
Open9xArmMixData_v210 mixData[64];
|
||||
Open9xLimitData_v201 limitData[32];
|
||||
Open9xArmExpoData_v210 expoData[32];
|
||||
int16_t curves[16];
|
||||
int8_t points[512];
|
||||
Open9xArmLogicalSwitchData_v210 logicalSw[32];
|
||||
Open9xArmCustomFunctionData_v211 customFn[32];
|
||||
Open9xArmSwashRingData_v209 swashR;
|
||||
Open9xArmFlightModeData_v208 flightModeData[9];
|
||||
|
||||
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
|
||||
uint8_t thrTraceSrc;
|
||||
uint8_t modelId;
|
||||
|
||||
int8_t servoCenter[32];
|
||||
|
||||
uint8_t switchWarningStates;
|
||||
|
||||
Open9xArmFrSkyData_v211 frsky;
|
||||
|
||||
operator ModelData();
|
||||
t_Open9xArmModelData_v211() { memset(this, 0, sizeof(t_Open9xArmModelData_v211)); }
|
||||
}) Open9xArmModelData_v211;
|
||||
|
||||
PACK(typedef struct t_Open9xArmModelData_v212 {
|
||||
char name[10]; // 10 must be first for eeLoadModelName
|
||||
Open9xArmTimerData_v202 timers[2];
|
||||
uint8_t protocol:3;
|
||||
uint8_t thrTrim:1; // Enable Throttle Trim
|
||||
int8_t ppmNCH:4;
|
||||
uint8_t trimInc:3; // Trim Increments
|
||||
uint8_t disableThrottleWarning:1;
|
||||
uint8_t pulsePol:1;
|
||||
uint8_t extendedLimits:1;
|
||||
uint8_t extendedTrims:1;
|
||||
uint8_t spare1:1;
|
||||
int8_t ppmDelay;
|
||||
uint16_t beepANACenter; // 1<<0->A1.. 1<<6->A7
|
||||
Open9xArmMixData_v212 mixData[64];
|
||||
Open9xLimitData_v211 limitData[32];
|
||||
Open9xArmExpoData_v212 expoData[32];
|
||||
int16_t curves[16];
|
||||
int8_t points[512];
|
||||
Open9xArmLogicalSwitchData_v210 logicalSw[32];
|
||||
Open9xArmCustomFunctionData_v211 customFn[32];
|
||||
Open9xArmSwashRingData_v210 swashR;
|
||||
Open9xArmFlightModeData_v212 flightModeData[9];
|
||||
|
||||
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
|
||||
uint8_t thrTraceSrc;
|
||||
uint8_t modelId;
|
||||
uint8_t switchWarningStates;
|
||||
|
||||
Open9xArmFrSkyData_v211 frsky;
|
||||
Open9xTimerDataExtra timersXtra[2];
|
||||
|
||||
operator ModelData();
|
||||
t_Open9xArmModelData_v212() { memset(this, 0, sizeof(t_Open9xArmModelData_v212)); }
|
||||
}) Open9xArmModelData_v212;
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,805 +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 open9xstockeeprom_h
|
||||
#define open9xstockeeprom_h
|
||||
|
||||
#define O9X_MAX_CSFUNCOLD 13
|
||||
#define O9X_MAX_CSFUNC 15
|
||||
|
||||
#include <inttypes.h>
|
||||
#include "eeprominterface.h"
|
||||
#include <qbytearray.h>
|
||||
|
||||
int8_t open9xV4209FromSource(RawSource source);
|
||||
int8_t open9xStock209FromSource(RawSource source);
|
||||
RawSource open9xV4209ToSource(int8_t value);
|
||||
RawSource open9xStock209ToSource(int8_t value);
|
||||
int8_t open9xStockFromSwitch(const RawSwitch & sw);
|
||||
RawSwitch open9xStockToSwitch(int8_t sw);
|
||||
|
||||
struct CurveInfo {
|
||||
int8_t *crv;
|
||||
uint8_t points;
|
||||
bool custom;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
int8_t *curveaddress(T * model, uint8_t idx)
|
||||
{
|
||||
return &model->points[idx==0 ? 0 : 5*idx+model->curves[idx-1]];
|
||||
}
|
||||
|
||||
template <class T>
|
||||
extern CurveInfo curveinfo(T * model, uint8_t idx)
|
||||
{
|
||||
CurveInfo result;
|
||||
result.crv = curveaddress(model, idx);
|
||||
int8_t *next = curveaddress(model, idx+1);
|
||||
uint8_t size = next - result.crv;
|
||||
if (size % 2 == 0) {
|
||||
result.points = (size / 2) + 1;
|
||||
result.custom = true;
|
||||
}
|
||||
else {
|
||||
result.points = size;
|
||||
result.custom = false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
PACK(typedef struct t_Open9xFrSkyRSSIAlarm {
|
||||
uint8_t level:2;
|
||||
int8_t value:6;
|
||||
FrSkyRSSIAlarm get(int index);
|
||||
t_Open9xFrSkyRSSIAlarm() { memset(this, 0, sizeof(t_Open9xFrSkyRSSIAlarm)); }
|
||||
}) Open9xFrSkyRSSIAlarm;
|
||||
|
||||
PACK(typedef struct t_Open9xExpoData_v201 {
|
||||
uint8_t mode:2; // 0=end, 1=pos, 2=neg, 3=both
|
||||
uint8_t chn:2;
|
||||
uint8_t curve:4; // 0=no curve, 1-6=std curves, 7-10=CV1-CV4, 11-15=CV9-CV13
|
||||
int8_t swtch:5;
|
||||
uint8_t phase:3; // if negPhase is 0: 0=normal, 5=FP4 if negPhase is 1: 5=!FP4
|
||||
uint8_t negPhase:1;
|
||||
uint8_t weight:7;
|
||||
int8_t expo;
|
||||
|
||||
operator ExpoData();
|
||||
t_Open9xExpoData_v201() { memset(this, 0, sizeof(t_Open9xExpoData_v201)); }
|
||||
}) Open9xExpoData_v201;
|
||||
|
||||
PACK(typedef struct t_Open9xExpoData_v211 {
|
||||
uint8_t mode:2; // 0=end, 1=pos, 2=neg, 3=both
|
||||
int8_t swtch:6;
|
||||
uint8_t chn:2;
|
||||
uint8_t phases:5;
|
||||
uint8_t curveMode:1;
|
||||
uint8_t weight; // we have one bit spare here :)
|
||||
int8_t curveParam;
|
||||
|
||||
operator ExpoData();
|
||||
t_Open9xExpoData_v211() { memset(this, 0, sizeof(t_Open9xExpoData_v211)); }
|
||||
}) Open9xExpoData_v211;
|
||||
|
||||
PACK(typedef struct t_Open9xLimitData_v201 {
|
||||
int8_t min;
|
||||
int8_t max;
|
||||
bool revert;
|
||||
int16_t offset;
|
||||
|
||||
operator LimitData();
|
||||
t_Open9xLimitData_v201() { memset(this, 0, sizeof(t_Open9xLimitData_v201)); }
|
||||
}) Open9xLimitData_v201;
|
||||
|
||||
PACK(typedef struct t_Open9xLimitData_v211 {
|
||||
int8_t min;
|
||||
int8_t max;
|
||||
int8_t ppmCenter;
|
||||
int16_t offset:14;
|
||||
uint16_t symetrical:1;
|
||||
uint16_t revert:1;
|
||||
|
||||
operator LimitData();
|
||||
t_Open9xLimitData_v211() { memset(this, 0, sizeof(t_Open9xLimitData_v211)); }
|
||||
}) Open9xLimitData_v211;
|
||||
|
||||
PACK(typedef struct t_Open9xMixData_v201 {
|
||||
uint8_t destCh:5; // 0, 1..C9X_NUM_CHNOUT
|
||||
uint8_t mixWarn:3; // mixer warning
|
||||
uint8_t srcRaw; //
|
||||
int8_t weight;
|
||||
int8_t swtch;
|
||||
uint8_t curve; // 0=symmetrisch, 1=no neg, 2=no pos
|
||||
uint8_t delayUp:4;
|
||||
uint8_t delayDown:4;
|
||||
uint8_t speedUp:4; // Servogeschwindigkeit aus Tabelle (10ms Cycle)
|
||||
uint8_t speedDown:4; // 0 nichts
|
||||
uint8_t carryTrim:1;
|
||||
uint8_t mltpx:3; // multiplex method 0=+ 1=* 2=replace
|
||||
int8_t phase:4; // -5=!FP4, 0=normal, 5=FP4
|
||||
int8_t sOffset;
|
||||
|
||||
operator MixData();
|
||||
t_Open9xMixData_v201() { memset(this, 0, sizeof(t_Open9xMixData_v201)); }
|
||||
}) Open9xMixData_v201;
|
||||
|
||||
PACK(typedef struct t_Open9xMixData_v203 {
|
||||
uint8_t destCh:5; // 0, 1..C9X_NUM_CHNOUT
|
||||
uint8_t mixWarn:3; // mixer warning
|
||||
uint8_t srcRaw; //
|
||||
int8_t weight;
|
||||
int8_t swtch;
|
||||
uint8_t curve;
|
||||
uint8_t delayUp:4;
|
||||
uint8_t delayDown:4;
|
||||
uint8_t speedUp:4; // Servogeschwindigkeit aus Tabelle (10ms Cycle)
|
||||
uint8_t speedDown:4; // 0 nichts
|
||||
uint8_t carryTrim:2;
|
||||
uint8_t mltpx:2; // multiplex method: 0 means +=, 1 means *=, 2 means :=
|
||||
int8_t phase:4; // -5=!FP4, 0=normal, 5=FP4
|
||||
int8_t sOffset;
|
||||
|
||||
operator MixData();
|
||||
t_Open9xMixData_v203() { memset(this, 0, sizeof(t_Open9xMixData_v203)); }
|
||||
}) Open9xMixData_v203;
|
||||
|
||||
PACK(typedef struct t_Open9xMixData_v205 {
|
||||
uint8_t destCh:4; // 0, 1..C9X_NUM_CHNOUT
|
||||
int8_t phase:4; // -5=!FP4, 0=normal, 5=FP4
|
||||
int8_t weight;
|
||||
int8_t swtch:6;
|
||||
uint8_t mltpx:2; // multiplex method: 0 means +=, 1 means *=, 2 means :=
|
||||
int8_t curve:6;
|
||||
uint8_t mixWarn:2; // mixer warning
|
||||
uint8_t delayUp:4;
|
||||
uint8_t delayDown:4;
|
||||
uint8_t speedUp:4; // Servogeschwindigkeit aus Tabelle (10ms Cycle)
|
||||
uint8_t speedDown:4; // 0 nichts
|
||||
uint16_t srcRaw:7; //
|
||||
int16_t differential:7;
|
||||
uint16_t carryTrim:2;
|
||||
int8_t sOffset;
|
||||
|
||||
operator MixData();
|
||||
t_Open9xMixData_v205() { memset(this, 0, sizeof(t_Open9xMixData_v205)); }
|
||||
}) Open9xMixData_v205;
|
||||
|
||||
PACK(typedef struct t_Open9xMixData_v209 {
|
||||
uint8_t destCh:4; // 0, 1..C9X_NUM_CHNOUT
|
||||
int8_t phase:4; // -5=!FP4, 0=normal, 5=FP4
|
||||
int8_t weight;
|
||||
int8_t swtch:6;
|
||||
uint8_t mltpx:2; // multiplex method: 0 means +=, 1 means *=, 2 means :=
|
||||
int8_t curve:6;
|
||||
uint8_t mixWarn:2; // mixer warning
|
||||
uint8_t delayUp:4;
|
||||
uint8_t delayDown:4;
|
||||
uint8_t speedUp:4; // Servogeschwindigkeit aus Tabelle (10ms Cycle)
|
||||
uint8_t speedDown:4; // 0 nichts
|
||||
uint16_t srcRaw:6;
|
||||
int16_t differential:7;
|
||||
int16_t carryTrim:3;
|
||||
int8_t sOffset;
|
||||
|
||||
operator MixData();
|
||||
t_Open9xMixData_v209() { memset(this, 0, sizeof(t_Open9xMixData_v209)); }
|
||||
}) Open9xMixData_v209;
|
||||
|
||||
PACK(typedef struct t_Open9xMixData_v211 {
|
||||
uint8_t destCh:4; // 0, 1..C9X_NUM_CHNOUT
|
||||
uint8_t curveMode:1; // O=curve, 1=differential
|
||||
uint8_t noExpo:1;
|
||||
uint8_t spare:2;
|
||||
int8_t weight;
|
||||
int8_t swtch:6;
|
||||
uint8_t mltpx:2; // multiplex method: 0 means +=, 1 means *=, 2 means :=
|
||||
uint8_t phases:5;
|
||||
int8_t carryTrim:3;
|
||||
uint8_t srcRaw:6;
|
||||
uint8_t mixWarn:2; // mixer warning
|
||||
uint8_t delayUp:4;
|
||||
uint8_t delayDown:4;
|
||||
uint8_t speedUp:4;
|
||||
uint8_t speedDown:4;
|
||||
int8_t curveParam;
|
||||
int8_t sOffset;
|
||||
|
||||
operator MixData();
|
||||
t_Open9xMixData_v211() { memset(this, 0, sizeof(t_Open9xMixData_v211)); }
|
||||
}) Open9xMixData_v211;
|
||||
|
||||
PACK(typedef struct t_Open9xLogicalSwitchData_v208 { // Custom Switches data
|
||||
int8_t v1; //input
|
||||
int8_t v2; //offset
|
||||
uint8_t func;
|
||||
|
||||
operator LogicalSwitchData();
|
||||
t_Open9xLogicalSwitchData_v208() { memset(this, 0, sizeof(t_Open9xLogicalSwitchData_v208)); }
|
||||
t_Open9xLogicalSwitchData_v208(LogicalSwitchData&);
|
||||
}) Open9xLogicalSwitchData_v208;
|
||||
|
||||
PACK(typedef struct t_Open9xLogicalSwitchData_v209 { // Custom Switches data
|
||||
int8_t v1; //input
|
||||
int8_t v2; //offset
|
||||
uint8_t func;
|
||||
|
||||
operator LogicalSwitchData();
|
||||
t_Open9xLogicalSwitchData_v209() { memset(this, 0, sizeof(t_Open9xLogicalSwitchData_v209)); }
|
||||
}) Open9xLogicalSwitchData_v209;
|
||||
|
||||
PACK(typedef struct t_Open9xSafetySwData { // Safety Switches data
|
||||
int8_t swtch;
|
||||
int8_t val;
|
||||
|
||||
t_Open9xSafetySwData() { memset(this, 0, sizeof(t_Open9xSafetySwData)); }
|
||||
}) Open9xSafetySwData;
|
||||
|
||||
PACK(typedef struct t_Open9xCustomFunctionData_v201 { // Function Switches data
|
||||
int8_t swtch; // input
|
||||
uint8_t func;
|
||||
|
||||
operator CustomFunctionData();
|
||||
t_Open9xCustomFunctionData_v201() { memset(this, 0, sizeof(t_Open9xCustomFunctionData_v201)); }
|
||||
}) Open9xCustomFunctionData_v201;
|
||||
|
||||
PACK(typedef struct t_Open9xCustomFunctionData_v203 { // Function Switches data
|
||||
int8_t swtch; // input
|
||||
uint8_t func;
|
||||
uint8_t param;
|
||||
|
||||
operator CustomFunctionData();
|
||||
t_Open9xCustomFunctionData_v203() { memset(this, 0, sizeof(t_Open9xCustomFunctionData_v203)); }
|
||||
}) Open9xCustomFunctionData_v203;
|
||||
|
||||
PACK(typedef struct t_Open9xCustomFunctionData_v210 { // Function Switches data
|
||||
int8_t swtch; // input
|
||||
uint8_t func:5;
|
||||
uint8_t delay:3;
|
||||
uint8_t param;
|
||||
|
||||
operator CustomFunctionData();
|
||||
t_Open9xCustomFunctionData_v210() { memset(this, 0, sizeof(t_Open9xCustomFunctionData_v210)); }
|
||||
}) Open9xCustomFunctionData_v210;
|
||||
|
||||
PACK(typedef struct t_Open9xFrSkyChannelData_v201 {
|
||||
uint8_t ratio; // 0.0 means not used, 0.1V steps EG. 6.6 Volts = 66. 25.1V = 251, etc.
|
||||
uint8_t type:4; // channel unit (0=volts, ...)
|
||||
int8_t offset:4; // calibration offset. Signed 0.1V steps. EG. -4 to substract 0.4V
|
||||
uint8_t alarms_value[2]; // 0.1V steps EG. 6.6 Volts = 66. 25.1V = 251, etc.
|
||||
uint8_t alarms_level:4;
|
||||
uint8_t alarms_greater:2; // 0=LT(<), 1=GT(>)
|
||||
uint8_t spare:2;
|
||||
uint8_t barMin; // minimum for bar display
|
||||
uint8_t barMax; // ditto for max display (would usually = ratio)
|
||||
|
||||
operator FrSkyChannelData();
|
||||
t_Open9xFrSkyChannelData_v201() { memset(this, 0, sizeof(t_Open9xFrSkyChannelData_v201)); }
|
||||
}) Open9xFrSkyChannelData_v201;
|
||||
|
||||
PACK(typedef struct t_Open9xFrSkyChannelData_v203 {
|
||||
uint8_t ratio; // 0.0 means not used, 0.1V steps EG. 6.6 Volts = 66. 25.1V = 251, etc.
|
||||
uint8_t type; // channel unit (0=volts, ...)
|
||||
uint8_t alarms_value[2]; // 0.1V steps EG. 6.6 Volts = 66. 25.1V = 251, etc.
|
||||
uint8_t alarms_level:4;
|
||||
uint8_t alarms_greater:2; // 0=LT(<), 1=GT(>)
|
||||
uint8_t spare:2;
|
||||
uint8_t barMin:4; // minimum for bar display
|
||||
uint8_t barMax:4; // ditto for max display (would usually = ratio)
|
||||
int8_t offset; // calibration offset. Signed 0.1V steps. EG. -4 to substract 0.4V
|
||||
|
||||
operator FrSkyChannelData();
|
||||
t_Open9xFrSkyChannelData_v203() { memset(this, 0, sizeof(t_Open9xFrSkyChannelData_v203)); }
|
||||
}) Open9xFrSkyChannelData_v203;
|
||||
|
||||
PACK(typedef struct t_Open9xFrSkyChannelData_v204 {
|
||||
uint8_t ratio; // 0.0 means not used, 0.1V steps EG. 6.6 Volts = 66. 25.1V = 251, etc.
|
||||
uint8_t type; // channel unit (0=volts, ...)
|
||||
uint8_t alarms_value[2]; // 0.1V steps EG. 6.6 Volts = 66. 25.1V = 251, etc.
|
||||
uint8_t alarms_level:4;
|
||||
uint8_t alarms_greater:2; // 0=LT(<), 1=GT(>)
|
||||
uint8_t multiplier:2;
|
||||
int8_t offset; // calibration offset. Signed 0.1V steps. EG. -4 to substract 0.4V
|
||||
|
||||
operator FrSkyChannelData();
|
||||
t_Open9xFrSkyChannelData_v204() { memset(this, 0, sizeof(t_Open9xFrSkyChannelData_v204)); }
|
||||
}) Open9xFrSkyChannelData_v204;
|
||||
|
||||
PACK(typedef struct t_Open9xFrSkyChannelData_v208 {
|
||||
uint8_t ratio; // 0.0 means not used, 0.1V steps EG. 6.6 Volts = 66. 25.1V = 251, etc.
|
||||
int16_t offset:12;
|
||||
uint16_t type:4; // channel unit (0=volts, ...)
|
||||
uint8_t alarms_value[2]; // 0.1V steps EG. 6.6 Volts = 66. 25.1V = 251, etc.
|
||||
uint8_t alarms_level:4;
|
||||
uint8_t alarms_greater:2; // 0=LT(<), 1=GT(>)
|
||||
uint8_t multiplier:2;
|
||||
|
||||
operator FrSkyChannelData();
|
||||
t_Open9xFrSkyChannelData_v208() { memset(this, 0, sizeof(t_Open9xFrSkyChannelData_v208)); }
|
||||
}) Open9xFrSkyChannelData_v208;
|
||||
|
||||
PACK(typedef struct t_Open9xFrSkyData_v201 {
|
||||
Open9xFrSkyChannelData_v201 channels[2];
|
||||
|
||||
operator FrSkyData();
|
||||
t_Open9xFrSkyData_v201() { memset(this, 0, sizeof(t_Open9xFrSkyData_v201)); }
|
||||
}) Open9xFrSkyData_v201;
|
||||
|
||||
PACK(typedef struct t_Open9xFrSkyData_v202 {
|
||||
Open9xFrSkyChannelData_v201 channels[2];
|
||||
uint8_t usrProto:2; // Protocol in FrSky user data, 0=None, 1=FrSky hub, 2=WS HowHigh
|
||||
uint8_t spare:6;
|
||||
|
||||
operator FrSkyData();
|
||||
t_Open9xFrSkyData_v202() { memset(this, 0, sizeof(t_Open9xFrSkyData_v202)); }
|
||||
}) Open9xFrSkyData_v202;
|
||||
|
||||
PACK(typedef struct t_Open9xFrSkyData_v203 {
|
||||
Open9xFrSkyChannelData_v203 channels[2];
|
||||
uint8_t usrProto; // Protocol in FrSky user data, 0=None, 1=FrSky hub, 2=WS HowHigh
|
||||
|
||||
operator FrSkyData();
|
||||
t_Open9xFrSkyData_v203() { memset(this, 0, sizeof(t_Open9xFrSkyData_v203)); }
|
||||
}) Open9xFrSkyData_v203;
|
||||
|
||||
PACK(typedef struct t_Open9xFrSkyBarData_v204 {
|
||||
uint16_t source:4;
|
||||
uint16_t barMin:6; // minimum for bar display
|
||||
uint16_t barMax:6; // ditto for max display (would usually = ratio)
|
||||
|
||||
operator FrSkyBarData();
|
||||
t_Open9xFrSkyBarData_v204() { memset(this, 0, sizeof(t_Open9xFrSkyBarData_v204)); }
|
||||
}) Open9xFrSkyBarData_v204;
|
||||
|
||||
PACK(typedef struct t_Open9xFrSkyData_v204 {
|
||||
Open9xFrSkyChannelData_v204 channels[2];
|
||||
uint8_t usrProto:3; // Protocol in FrSky user data, 0=None, 1=FrSky hub, 2=WS HowHigh
|
||||
uint8_t imperial:1;
|
||||
uint8_t blades:2;
|
||||
uint8_t spare:2;
|
||||
Open9xFrSkyBarData_v204 bars[4];
|
||||
|
||||
operator FrSkyData();
|
||||
t_Open9xFrSkyData_v204() { memset(this, 0, sizeof(t_Open9xFrSkyData_v204)); }
|
||||
}) Open9xFrSkyData_v204;
|
||||
|
||||
PACK(typedef struct t_Open9xFrSkyData_v205 {
|
||||
Open9xFrSkyChannelData_v204 channels[2];
|
||||
uint8_t usrProto:3; // Protocol in FrSky user data, 0=None, 1=FrSky hub, 2=WS HowHigh
|
||||
uint8_t imperial:1;
|
||||
uint8_t blades:2;
|
||||
uint8_t spare:2;
|
||||
Open9xFrSkyBarData_v204 bars[4];
|
||||
Open9xFrSkyRSSIAlarm rssiAlarms[2];
|
||||
|
||||
operator FrSkyData();
|
||||
t_Open9xFrSkyData_v205() { memset(this, 0, sizeof(t_Open9xFrSkyData_v205)); }
|
||||
}) Open9xFrSkyData_v205;
|
||||
|
||||
PACK(typedef struct t_Open9xFrSkyData_v208 {
|
||||
Open9xFrSkyChannelData_v208 channels[2];
|
||||
uint8_t usrProto:2; // Protocol in FrSky user data, 0=None, 1=FrSky hub, 2=WS HowHigh
|
||||
uint8_t voltsSource:2;
|
||||
uint8_t blades:2;
|
||||
uint8_t currentSource:2;
|
||||
Open9xFrSkyBarData_v204 bars[4];
|
||||
Open9xFrSkyRSSIAlarm rssiAlarms[2];
|
||||
|
||||
operator FrSkyData();
|
||||
t_Open9xFrSkyData_v208() { memset(this, 0, sizeof(t_Open9xFrSkyData_v208)); }
|
||||
}) Open9xFrSkyData_v208;
|
||||
|
||||
PACK(typedef struct t_Open9xFrSkyData_v210 {
|
||||
Open9xFrSkyChannelData_v208 channels[2];
|
||||
uint8_t usrProto:2; // Protocol in FrSky user data, 0=None, 1=FrSky hub, 2=WS HowHigh
|
||||
uint8_t blades:2; // How many blades for RPMs, 0=2 blades, 1=3 blades
|
||||
uint8_t spare1:4;
|
||||
uint8_t voltsSource:3;
|
||||
uint8_t currentSource:3;
|
||||
uint8_t spare2:2;
|
||||
Open9xFrSkyBarData_v204 bars[4];
|
||||
Open9xFrSkyRSSIAlarm rssiAlarms[2];
|
||||
uint8_t lines[4];
|
||||
uint16_t linesXtra;
|
||||
uint8_t varioSource:3;
|
||||
uint8_t varioSpeedUpMin:5; // if increment in 0.2m/s = 3.0m/s max
|
||||
uint8_t varioSpeedDownMin;
|
||||
|
||||
operator FrSkyData();
|
||||
t_Open9xFrSkyData_v210() { memset(this, 0, sizeof(t_Open9xFrSkyData_v210)); }
|
||||
}) Open9xFrSkyData_v210;
|
||||
|
||||
PACK(typedef struct t_Open9xSwashRingData_v208 { // Swash Ring data
|
||||
uint8_t invertELE:1;
|
||||
uint8_t invertAIL:1;
|
||||
uint8_t invertCOL:1;
|
||||
uint8_t type:5;
|
||||
uint8_t collectiveSource;
|
||||
uint8_t value;
|
||||
|
||||
operator SwashRingData();
|
||||
t_Open9xSwashRingData_v208() { memset(this, 0, sizeof(t_Open9xSwashRingData_v208)); }
|
||||
}) Open9xSwashRingData_v208;
|
||||
|
||||
PACK(typedef struct t_Open9xSwashRingData_v209 { // Swash Ring data
|
||||
uint8_t invertELE:1;
|
||||
uint8_t invertAIL:1;
|
||||
uint8_t invertCOL:1;
|
||||
uint8_t type:5;
|
||||
uint8_t collectiveSource;
|
||||
uint8_t value;
|
||||
|
||||
operator SwashRingData();
|
||||
t_Open9xSwashRingData_v209() { memset(this, 0, sizeof(t_Open9xSwashRingData_v209)); }
|
||||
}) Open9xSwashRingData_v209;
|
||||
|
||||
PACK(typedef struct t_Open9xFlightModeData_v201 {
|
||||
int8_t trim[4]; // -500..500 => trim value, 501 => use trim of phase 0, 502, 503, 504 => use trim of phases 1|2|3|4 instead
|
||||
int8_t trim_ext:8; // 2 less significant extra bits per trim (10bits trims)
|
||||
int8_t swtch; // swtch of phase[0] is not used
|
||||
char name[6];
|
||||
uint8_t fadeIn:4;
|
||||
uint8_t fadeOut:4;
|
||||
|
||||
operator FlightModeData();
|
||||
t_Open9xFlightModeData_v201() { memset(this, 0, sizeof(t_Open9xFlightModeData_v201)); }
|
||||
}) Open9xFlightModeData_v201;
|
||||
|
||||
PACK(typedef struct t_Open9xTimerData_v201 {
|
||||
int8_t mode; // timer trigger source -> off, abs, stk, stk%, sw/!sw, !m_sw/!m_sw
|
||||
uint16_t val:14;
|
||||
uint16_t persistent:1;
|
||||
uint16_t dir:1; // 0=>Count Down, 1=>Count Up
|
||||
|
||||
operator TimerData();
|
||||
t_Open9xTimerData_v201() { memset(this, 0, sizeof(t_Open9xTimerData_v201)); }
|
||||
}) Open9xTimerData_v201;
|
||||
|
||||
PACK(typedef struct t_Open9xTimerData_v202 {
|
||||
int8_t mode; // timer trigger source -> off, abs, stk, stk%, sw/!sw, !m_sw/!m_sw
|
||||
uint16_t val;
|
||||
|
||||
operator TimerData();
|
||||
t_Open9xTimerData_v202() { memset(this, 0, sizeof(t_Open9xTimerData_v202)); }
|
||||
}) Open9xTimerData_v202;
|
||||
|
||||
PACK(typedef struct t_Open9xTimerDataExtra {
|
||||
uint16_t remanent:1;
|
||||
uint16_t value:15;
|
||||
t_Open9xTimerDataExtra() { memset(this, 0, sizeof(t_Open9xTimerDataExtra)); }
|
||||
}) Open9xTimerDataExtra;
|
||||
|
||||
PACK(typedef struct t_Open9xModelData_v201 {
|
||||
char name[10]; // 10 must be first for eeLoadModelName
|
||||
Open9xTimerData_v201 timer1;
|
||||
uint8_t protocol:3;
|
||||
int8_t ppmNCH:3;
|
||||
uint8_t thrTrim:1; // Enable Throttle Trim
|
||||
uint8_t thrExpo:1; // Enable Throttle Expo
|
||||
uint8_t trimInc:3; // Trim Increments
|
||||
uint8_t spare1:1;
|
||||
uint8_t pulsePol:1;
|
||||
uint8_t extendedLimits:1;
|
||||
uint8_t extendedTrims:1;
|
||||
uint8_t spare2:1;
|
||||
int8_t ppmDelay;
|
||||
uint8_t beepANACenter; // 1<<0->A1.. 1<<6->A7
|
||||
Open9xTimerData_v201 timer2;
|
||||
Open9xMixData_v201 mixData[32];
|
||||
Open9xLimitData_v201 limitData[16];
|
||||
Open9xExpoData_v201 expoData[14];
|
||||
int8_t curves5[8][5];
|
||||
int8_t curves9[8][9];
|
||||
Open9xLogicalSwitchData_v208 logicalSw[12];
|
||||
Open9xSafetySwData safetySw[16];
|
||||
Open9xCustomFunctionData_v201 customFn[12];
|
||||
Open9xSwashRingData_v208 swashR;
|
||||
Open9xFlightModeData_v201 flightModeData[5];
|
||||
Open9xFrSkyData_v201 frsky;
|
||||
|
||||
operator ModelData();
|
||||
t_Open9xModelData_v201() { memset(this, 0, sizeof(t_Open9xModelData_v201)); }
|
||||
}) Open9xModelData_v201;
|
||||
|
||||
PACK(typedef struct t_Open9xModelData_v202 {
|
||||
char name[10]; // 10 must be first for eeLoadModelName
|
||||
Open9xTimerData_v202 timer1;
|
||||
uint8_t protocol:3;
|
||||
uint8_t thrTrim:1; // Enable Throttle Trim
|
||||
int8_t ppmNCH:4;
|
||||
uint8_t trimInc:3; // Trim Increments
|
||||
uint8_t spare1:1;
|
||||
uint8_t pulsePol:1;
|
||||
uint8_t extendedLimits:1;
|
||||
uint8_t extendedTrims:1;
|
||||
uint8_t spare2:1;
|
||||
int8_t ppmDelay;
|
||||
uint8_t beepANACenter; // 1<<0->A1.. 1<<6->A7
|
||||
Open9xTimerData_v202 timer2;
|
||||
Open9xMixData_v201 mixData[32];
|
||||
Open9xLimitData_v201 limitData[16];
|
||||
Open9xExpoData_v201 expoData[14];
|
||||
int8_t curves5[8][5];
|
||||
int8_t curves9[8][9];
|
||||
Open9xLogicalSwitchData_v208 logicalSw[12];
|
||||
Open9xSafetySwData safetySw[16];
|
||||
Open9xCustomFunctionData_v201 customFn[12];
|
||||
Open9xSwashRingData_v208 swashR;
|
||||
Open9xFlightModeData_v201 flightModeData[5];
|
||||
Open9xFrSkyData_v202 frsky;
|
||||
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
|
||||
uint8_t thrTraceSrc;
|
||||
uint8_t modelId;
|
||||
|
||||
operator ModelData();
|
||||
t_Open9xModelData_v202() { memset(this, 0, sizeof(t_Open9xModelData_v202)); }
|
||||
}) Open9xModelData_v202;
|
||||
|
||||
PACK(typedef struct t_Open9xModelData_v203 {
|
||||
char name[10]; // 10 must be first for eeLoadModelName
|
||||
Open9xTimerData_v202 timer1;
|
||||
uint8_t protocol:3;
|
||||
uint8_t thrTrim:1; // Enable Throttle Trim
|
||||
int8_t ppmNCH:4;
|
||||
uint8_t trimInc:3; // Trim Increments
|
||||
uint8_t spare1:1;
|
||||
uint8_t pulsePol:1;
|
||||
uint8_t extendedLimits:1;
|
||||
uint8_t extendedTrims:1;
|
||||
uint8_t spare2:1;
|
||||
int8_t ppmDelay;
|
||||
uint8_t beepANACenter; // 1<<0->A1.. 1<<6->A7
|
||||
Open9xTimerData_v202 timer2;
|
||||
Open9xMixData_v203 mixData[32];
|
||||
Open9xLimitData_v201 limitData[16];
|
||||
Open9xExpoData_v201 expoData[14];
|
||||
int8_t curves5[8][5];
|
||||
int8_t curves9[8][9];
|
||||
Open9xLogicalSwitchData_v208 logicalSw[12];
|
||||
Open9xCustomFunctionData_v203 customFn[16];
|
||||
Open9xSwashRingData_v208 swashR;
|
||||
Open9xFlightModeData_v201 flightModeData[5];
|
||||
Open9xFrSkyData_v202 frsky;
|
||||
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
|
||||
uint8_t thrTraceSrc;
|
||||
uint8_t modelId;
|
||||
|
||||
operator ModelData();
|
||||
t_Open9xModelData_v203() { memset(this, 0, sizeof(t_Open9xModelData_v203)); }
|
||||
}) Open9xModelData_v203;
|
||||
|
||||
PACK(typedef struct t_Open9xModelData_v204 {
|
||||
char name[10]; // 10 must be first for eeLoadModelName
|
||||
Open9xTimerData_v202 timer1;
|
||||
uint8_t protocol:3;
|
||||
uint8_t thrTrim:1; // Enable Throttle Trim
|
||||
int8_t ppmNCH:4;
|
||||
uint8_t trimInc:3; // Trim Increments
|
||||
uint8_t spare1:1;
|
||||
uint8_t pulsePol:1;
|
||||
uint8_t extendedLimits:1;
|
||||
uint8_t extendedTrims:1;
|
||||
uint8_t spare2:1;
|
||||
int8_t ppmDelay;
|
||||
uint8_t beepANACenter; // 1<<0->A1.. 1<<6->A7
|
||||
Open9xTimerData_v202 timer2;
|
||||
Open9xMixData_v203 mixData[32];
|
||||
Open9xLimitData_v201 limitData[16];
|
||||
Open9xExpoData_v201 expoData[14];
|
||||
int8_t curves5[8][5];
|
||||
int8_t curves9[8][9];
|
||||
Open9xLogicalSwitchData_v208 logicalSw[12];
|
||||
Open9xCustomFunctionData_v203 customFn[16];
|
||||
Open9xSwashRingData_v208 swashR;
|
||||
Open9xFlightModeData_v201 flightModeData[5];
|
||||
Open9xFrSkyData_v204 frsky;
|
||||
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
|
||||
uint8_t thrTraceSrc;
|
||||
uint8_t modelId;
|
||||
Open9xFrSkyRSSIAlarm frskyRssiAlarms[2];
|
||||
|
||||
operator ModelData();
|
||||
t_Open9xModelData_v204() { memset(this, 0, sizeof(t_Open9xModelData_v204)); }
|
||||
}) Open9xModelData_v204;
|
||||
|
||||
PACK(typedef struct t_Open9xModelData_v205 {
|
||||
char name[10]; // 10 must be first for eeLoadModelName
|
||||
Open9xTimerData_v202 timers[2];
|
||||
uint8_t protocol:3;
|
||||
uint8_t thrTrim:1; // Enable Throttle Trim
|
||||
int8_t ppmNCH:4;
|
||||
uint8_t trimInc:3; // Trim Increments
|
||||
uint8_t spare1:1;
|
||||
uint8_t pulsePol:1;
|
||||
uint8_t extendedLimits:1;
|
||||
uint8_t extendedTrims:1;
|
||||
uint8_t spare2:1;
|
||||
int8_t ppmDelay;
|
||||
uint8_t beepANACenter; // 1<<0->A1.. 1<<6->A7
|
||||
Open9xMixData_v205 mixData[32];
|
||||
Open9xLimitData_v201 limitData[16];
|
||||
Open9xExpoData_v201 expoData[14];
|
||||
int8_t curves5[8][5];
|
||||
int8_t curves9[8][9];
|
||||
Open9xLogicalSwitchData_v208 logicalSw[12];
|
||||
Open9xCustomFunctionData_v203 customFn[16];
|
||||
Open9xSwashRingData_v208 swashR;
|
||||
Open9xFlightModeData_v201 flightModeData[5];
|
||||
Open9xFrSkyData_v205 frsky;
|
||||
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
|
||||
uint8_t thrTraceSrc;
|
||||
uint8_t modelId;
|
||||
uint8_t frskyLines[4];
|
||||
uint16_t frskyLinesXtra;
|
||||
int8_t servoCenter[16];
|
||||
|
||||
operator ModelData();
|
||||
t_Open9xModelData_v205() { memset(this, 0, sizeof(t_Open9xModelData_v205)); }
|
||||
}) Open9xModelData_v205;
|
||||
|
||||
PACK(typedef struct t_Open9xModelData_v208 {
|
||||
char name[10]; // 10 must be first for eeLoadModelName
|
||||
Open9xTimerData_v202 timers[2];
|
||||
uint8_t protocol:3;
|
||||
uint8_t thrTrim:1; // Enable Throttle Trim
|
||||
int8_t ppmNCH:4;
|
||||
uint8_t trimInc:3; // Trim Increments
|
||||
uint8_t disableThrottleWarning:1;
|
||||
uint8_t pulsePol:1;
|
||||
uint8_t extendedLimits:1;
|
||||
uint8_t extendedTrims:1;
|
||||
uint8_t spare2:1;
|
||||
int8_t ppmDelay;
|
||||
uint8_t beepANACenter; // 1<<0->A1.. 1<<6->A7
|
||||
Open9xMixData_v205 mixData[32];
|
||||
Open9xLimitData_v201 limitData[16];
|
||||
Open9xExpoData_v201 expoData[14];
|
||||
int8_t curves5[8][5];
|
||||
int8_t curves9[8][9];
|
||||
Open9xLogicalSwitchData_v208 logicalSw[12];
|
||||
Open9xCustomFunctionData_v203 customFn[16];
|
||||
Open9xSwashRingData_v208 swashR;
|
||||
Open9xFlightModeData_v201 flightModeData[5];
|
||||
Open9xFrSkyData_v208 frsky;
|
||||
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
|
||||
uint8_t thrTraceSrc;
|
||||
uint8_t modelId;
|
||||
uint8_t frskyLines[4];
|
||||
uint16_t frskyLinesXtra;
|
||||
int8_t servoCenter[16];
|
||||
|
||||
uint8_t varioSource:3;
|
||||
uint8_t varioSpeedUpMin:5; // if increment in 0.2m/s = 3.0m/s max
|
||||
uint8_t varioSpeedDownMin;
|
||||
|
||||
operator ModelData();
|
||||
t_Open9xModelData_v208() { memset(this, 0, sizeof(t_Open9xModelData_v208)); }
|
||||
}) Open9xModelData_v208;
|
||||
|
||||
PACK(typedef struct t_Open9xModelData_v209 {
|
||||
char name[10]; // 10 must be first for eeLoadModelName
|
||||
Open9xTimerData_v202 timers[2];
|
||||
uint8_t protocol:3;
|
||||
uint8_t thrTrim:1; // Enable Throttle Trim
|
||||
int8_t ppmNCH:4;
|
||||
uint8_t trimInc:3; // Trim Increments
|
||||
uint8_t disableThrottleWarning:1;
|
||||
uint8_t pulsePol:1;
|
||||
uint8_t extendedLimits:1;
|
||||
uint8_t extendedTrims:1;
|
||||
uint8_t spare2:1;
|
||||
int8_t ppmDelay;
|
||||
uint8_t beepANACenter; // 1<<0->A1.. 1<<6->A7
|
||||
Open9xMixData_v209 mixData[32];
|
||||
Open9xLimitData_v201 limitData[16];
|
||||
Open9xExpoData_v201 expoData[14];
|
||||
int8_t curves5[8][5];
|
||||
int8_t curves9[8][9];
|
||||
Open9xLogicalSwitchData_v209 logicalSw[12];
|
||||
Open9xCustomFunctionData_v203 customFn[16];
|
||||
Open9xSwashRingData_v209 swashR;
|
||||
Open9xFlightModeData_v201 flightModeData[5];
|
||||
Open9xFrSkyData_v208 frsky;
|
||||
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
|
||||
uint8_t thrTraceSrc;
|
||||
uint8_t modelId;
|
||||
uint8_t frskyLines[4];
|
||||
uint16_t frskyLinesXtra;
|
||||
int8_t servoCenter[16];
|
||||
|
||||
uint8_t varioSource:3;
|
||||
uint8_t varioSpeedUpMin:5; // if increment in 0.2m/s = 3.0m/s max
|
||||
uint8_t varioSpeedDownMin;
|
||||
uint8_t switchWarningStates;
|
||||
|
||||
operator ModelData();
|
||||
t_Open9xModelData_v209() { memset(this, 0, sizeof(t_Open9xModelData_v209)); }
|
||||
}) Open9xModelData_v209;
|
||||
|
||||
PACK(typedef struct t_Open9xModelData_v210 {
|
||||
char name[10]; // 10 must be first for eeLoadModelName
|
||||
Open9xTimerData_v202 timers[2];
|
||||
uint8_t protocol:3;
|
||||
uint8_t thrTrim:1; // Enable Throttle Trim
|
||||
int8_t ppmNCH:4;
|
||||
uint8_t trimInc:3; // Trim Increments
|
||||
uint8_t disableThrottleWarning:1;
|
||||
uint8_t pulsePol:1;
|
||||
uint8_t extendedLimits:1;
|
||||
uint8_t extendedTrims:1;
|
||||
uint8_t spare2:1;
|
||||
int8_t ppmDelay;
|
||||
uint8_t beepANACenter; // 1<<0->A1.. 1<<6->A7
|
||||
Open9xMixData_v209 mixData[32];
|
||||
Open9xLimitData_v201 limitData[16];
|
||||
Open9xExpoData_v201 expoData[14];
|
||||
int8_t curves[8];
|
||||
int8_t points[112-8];
|
||||
Open9xLogicalSwitchData_v209 logicalSw[12];
|
||||
Open9xCustomFunctionData_v210 customFn[16];
|
||||
Open9xSwashRingData_v209 swashR;
|
||||
Open9xFlightModeData_v201 flightModeData[5];
|
||||
|
||||
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
|
||||
uint8_t thrTraceSrc;
|
||||
uint8_t modelId;
|
||||
|
||||
int8_t servoCenter[16];
|
||||
|
||||
uint8_t switchWarningStates;
|
||||
|
||||
Open9xFrSkyData_v210 frsky;
|
||||
|
||||
operator ModelData();
|
||||
t_Open9xModelData_v210() { memset(this, 0, sizeof(t_Open9xModelData_v210)); }
|
||||
}) Open9xModelData_v210;
|
||||
|
||||
PACK(typedef struct t_Open9xModelData_v211 {
|
||||
char name[10]; // 10 must be first for eeLoadModelName
|
||||
Open9xTimerData_v202 timers[2];
|
||||
uint8_t protocol:3;
|
||||
uint8_t thrTrim:1; // Enable Throttle Trim
|
||||
int8_t ppmNCH:4;
|
||||
uint8_t trimInc:3; // Trim Increments
|
||||
uint8_t disableThrottleWarning:1;
|
||||
uint8_t pulsePol:1;
|
||||
uint8_t extendedLimits:1;
|
||||
uint8_t extendedTrims:1;
|
||||
uint8_t spare1:1;
|
||||
int8_t ppmDelay;
|
||||
uint8_t beepANACenter; // 1<<0->A1.. 1<<6->A7
|
||||
Open9xMixData_v211 mixData[32];
|
||||
Open9xLimitData_v211 limitData[16];
|
||||
Open9xExpoData_v211 expoData[14];
|
||||
int8_t curves[8];
|
||||
int8_t points[112-8];
|
||||
Open9xLogicalSwitchData_v209 logicalSw[12];
|
||||
Open9xCustomFunctionData_v210 customFn[16];
|
||||
Open9xSwashRingData_v209 swashR;
|
||||
Open9xFlightModeData_v201 flightModeData[5];
|
||||
|
||||
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
|
||||
uint8_t thrTraceSrc;
|
||||
uint8_t modelId;
|
||||
|
||||
uint8_t switchWarningStates;
|
||||
|
||||
Open9xFrSkyData_v210 frsky;
|
||||
|
||||
operator ModelData();
|
||||
t_Open9xModelData_v211() { memset(this, 0, sizeof(t_Open9xModelData_v211)); }
|
||||
}) Open9xModelData_v211;
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,125 +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 open9xeeprom_h
|
||||
#define open9xeeprom_h
|
||||
|
||||
#include <inttypes.h>
|
||||
#include "eeprominterface.h"
|
||||
#include "eepromimportexport.h"
|
||||
#include <qbytearray.h>
|
||||
|
||||
#define GVARS_VARIANT 0x0001
|
||||
#define FRSKY_VARIANT 0x0002
|
||||
#define POS3_VARIANT 0x0004
|
||||
#define MAVLINK_VARIANT 0x0008
|
||||
#define M128_VARIANT 0x8000
|
||||
#define TARANIS_X9E_VARIANT 0x8000
|
||||
|
||||
#define SIMU_STOCK_VARIANTS (GVARS_VARIANT|FRSKY_VARIANT)
|
||||
#define SIMU_M128_VARIANTS (M128_VARIANT|SIMU_STOCK_VARIANTS)
|
||||
|
||||
class OpenTxGeneralData: public TransformedField {
|
||||
public:
|
||||
OpenTxGeneralData(GeneralSettings & generalData, BoardEnum board, unsigned int version, unsigned int variant=0);
|
||||
|
||||
protected:
|
||||
virtual void beforeExport();
|
||||
virtual void afterImport();
|
||||
|
||||
StructField internalField;
|
||||
GeneralSettings & generalData;
|
||||
BoardEnum board;
|
||||
unsigned int version;
|
||||
int inputsCount;
|
||||
unsigned int chkSum;
|
||||
// unsigned int potsType[4];
|
||||
};
|
||||
|
||||
class ProtocolsConversionTable: public ConversionTable
|
||||
{
|
||||
public:
|
||||
ProtocolsConversionTable(BoardEnum board)
|
||||
{
|
||||
int val = 0;
|
||||
if (IS_ARM(board)) {
|
||||
addConversion(PULSES_OFF, val++);
|
||||
}
|
||||
addConversion(PULSES_PPM, val++);
|
||||
if (!IS_ARM(board)) {
|
||||
addConversion(PULSES_PPM16, val++);
|
||||
addConversion(PULSES_PPMSIM, val++);
|
||||
}
|
||||
if (IS_ARM(board)) {
|
||||
addConversion(PULSES_PXX_XJT_X16, val);
|
||||
addConversion(PULSES_PXX_XJT_D8, val);
|
||||
addConversion(PULSES_PXX_XJT_LR12, val++);
|
||||
}
|
||||
else {
|
||||
addConversion(PULSES_PXX_DJT, val++);
|
||||
}
|
||||
if (IS_ARM(board)) {
|
||||
addConversion(PULSES_LP45, val);
|
||||
addConversion(PULSES_DSM2, val);
|
||||
addConversion(PULSES_DSMX, val++);
|
||||
}
|
||||
else {
|
||||
addConversion(PULSES_LP45, val++);
|
||||
addConversion(PULSES_DSM2, val++);
|
||||
addConversion(PULSES_DSMX, val++);
|
||||
}
|
||||
if (IS_TARANIS(board)) {
|
||||
addConversion(PULSES_CROSSFIRE, val++);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class ChannelsConversionTable: public ConversionTable
|
||||
{
|
||||
public:
|
||||
ChannelsConversionTable()
|
||||
{
|
||||
for (int i=4; i<=16; i+= 2)
|
||||
addConversion(i, -4+i/2);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class OpenTxModelData: public TransformedField {
|
||||
public:
|
||||
OpenTxModelData(ModelData & modelData, BoardEnum board, unsigned int version, unsigned int variant);
|
||||
|
||||
const char * getName() { return name; }
|
||||
|
||||
protected:
|
||||
virtual void beforeExport();
|
||||
virtual void afterImport();
|
||||
|
||||
StructField internalField;
|
||||
ModelData & modelData;
|
||||
BoardEnum board;
|
||||
unsigned int version;
|
||||
unsigned int variant;
|
||||
|
||||
private:
|
||||
char name[256];
|
||||
int subprotocols[C9X_NUM_MODULES+1/*trainer*/];
|
||||
ProtocolsConversionTable protocolsConversionTable;
|
||||
ChannelsConversionTable channelsConversionTable;
|
||||
};
|
||||
|
||||
void OpenTxEepromCleanup(void);
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,135 +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 opentx_interface_h
|
||||
#define opentx_interface_h
|
||||
|
||||
#include "eeprominterface.h"
|
||||
|
||||
class RleFile;
|
||||
|
||||
class OpenTxEepromInterface : public EEPROMInterface
|
||||
{
|
||||
public:
|
||||
|
||||
OpenTxEepromInterface(BoardEnum board);
|
||||
|
||||
virtual ~OpenTxEepromInterface();
|
||||
|
||||
virtual const int getEEpromSize();
|
||||
|
||||
virtual const int getMaxModels();
|
||||
|
||||
virtual unsigned long load(RadioData &, const uint8_t *eeprom, int size);
|
||||
|
||||
virtual unsigned long loadBackup(RadioData &, uint8_t *eeprom, int esize, int index);
|
||||
|
||||
virtual unsigned long loadxml(RadioData &radioData, QDomDocument &doc);
|
||||
|
||||
virtual int save(uint8_t *eeprom, RadioData &radioData, uint32_t variant=0, uint8_t version=0);
|
||||
|
||||
virtual int getSize(const ModelData &);
|
||||
|
||||
virtual int getSize(const GeneralSettings &);
|
||||
|
||||
protected:
|
||||
|
||||
const char * getName();
|
||||
|
||||
EepromLoadErrors checkVersion(unsigned int version);
|
||||
|
||||
bool checkVariant(unsigned int version, unsigned int variant);
|
||||
|
||||
template <class T>
|
||||
bool loadModel(ModelData &model, uint8_t *data, int index, unsigned int stickMode=0);
|
||||
|
||||
template <class T>
|
||||
bool loadModelVariant(unsigned int index, ModelData &model, uint8_t *data, unsigned int version, unsigned int variant);
|
||||
|
||||
bool loadModel(uint8_t version, ModelData &model, uint8_t *data, int index, unsigned int variant, unsigned int stickMode=0);
|
||||
|
||||
template <class T>
|
||||
bool saveModel(unsigned int index, ModelData &model, unsigned int version, unsigned int variant);
|
||||
|
||||
template <class T>
|
||||
bool loadGeneral(GeneralSettings &settings, unsigned int version);
|
||||
|
||||
template <class T>
|
||||
bool saveGeneral(GeneralSettings &settings, BoardEnum board, uint32_t version, uint32_t variant);
|
||||
|
||||
RleFile *efile;
|
||||
|
||||
};
|
||||
|
||||
class OpenTxFirmware: public Firmware {
|
||||
public:
|
||||
OpenTxFirmware(const QString & id, OpenTxFirmware * parent):
|
||||
Firmware(parent, id, parent->getName(), parent->getBoard(), parent->eepromInterface)
|
||||
{
|
||||
}
|
||||
|
||||
OpenTxFirmware(const QString & id, const QString & name, const BoardEnum board):
|
||||
Firmware(id, name, board, new OpenTxEepromInterface(board))
|
||||
{
|
||||
addLanguage("en");
|
||||
addLanguage("cz");
|
||||
addLanguage("de");
|
||||
addLanguage("es");
|
||||
addLanguage("fr");
|
||||
addLanguage("it");
|
||||
addLanguage("nl");
|
||||
addLanguage("pl");
|
||||
addLanguage("pt");
|
||||
addLanguage("se");
|
||||
|
||||
addTTSLanguage("en");
|
||||
addTTSLanguage("cz");
|
||||
addTTSLanguage("de");
|
||||
addTTSLanguage("es");
|
||||
addTTSLanguage("fr");
|
||||
addTTSLanguage("hu");
|
||||
addTTSLanguage("it");
|
||||
addTTSLanguage("nl");
|
||||
addTTSLanguage("pl");
|
||||
addTTSLanguage("pt");
|
||||
addTTSLanguage("se");
|
||||
addTTSLanguage("sk");
|
||||
}
|
||||
|
||||
virtual Firmware * getFirmwareVariant(const QString & id);
|
||||
|
||||
virtual QString getStampUrl();
|
||||
|
||||
virtual QString getReleaseNotesUrl();
|
||||
|
||||
virtual QString getFirmwareUrl();
|
||||
|
||||
virtual int getCapability(const Capability);
|
||||
|
||||
virtual bool isTelemetrySourceAvailable(int source);
|
||||
|
||||
virtual int isAvailable(PulsesProtocol proto, int port=0);
|
||||
|
||||
protected:
|
||||
|
||||
QString getFirmwareBaseUrl();
|
||||
|
||||
};
|
||||
|
||||
void registerOpenTxFirmwares();
|
||||
void unregisterOpenTxFirmwares();
|
||||
|
||||
#endif
|
||||
@@ -1,195 +0,0 @@
|
||||
today(DATE)
|
||||
now(TIME)
|
||||
git_id(GIT_STR)
|
||||
|
||||
configure_file(${RADIO_SRC_DIRECTORY}/stamp.h.in ${RADIO_SRC_DIRECTORY}/stamp.h @ONLY)
|
||||
|
||||
set(OPENTX_SRC_FILES
|
||||
opentxsimulator.cpp
|
||||
)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_BINARY_DIR}/radio/src
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${RADIO_BIN_DIRECTORY}
|
||||
${PROJECT_SOURCE_DIR}
|
||||
${COMPANION_SRC_DIRECTORY}/firmwares/opentx
|
||||
${RADIO_SRC_DIRECTORY}
|
||||
${RADIO_SRC_DIRECTORY}/fonts/std
|
||||
${RADIO_SRC_DIRECTORY}/lua/src
|
||||
${RADIO_SRC_DIRECTORY}/thirdparty
|
||||
${RADIO_SRC_DIRECTORY}/thirdparty/FatFs
|
||||
${RADIO_SRC_DIRECTORY}/thirdparty/FatFs/option
|
||||
${RADIO_SRC_DIRECTORY}/thirdparty/CoOS
|
||||
${RADIO_SRC_DIRECTORY}/thirdparty/Lua/src
|
||||
)
|
||||
|
||||
if(APPLE)
|
||||
# OS X compiler no longer automatically includes /Library/Frameworks in search path
|
||||
set(CMAKE_SHARED_LINKER_FLAGS -F/Library/Frameworks)
|
||||
endif(APPLE)
|
||||
|
||||
if(DEFINED TRANSLATIONS)
|
||||
set(COMMON_DEFINITIONS ${COMMON_DEFINITIONS} TRANSLATIONS_${TRANSLATIONS})
|
||||
string(TOLOWER ${TRANSLATIONS} TRANSLATION_SUFFIX)
|
||||
set(SUFFIX ${SUFFIX}-${TRANSLATION_SUFFIX})
|
||||
endif()
|
||||
|
||||
set(COMMON_DEFINITIONS
|
||||
${COMMON_DEFINITIONS}
|
||||
SUFFIX="${SUFFIX}"
|
||||
HELI
|
||||
GVARS
|
||||
FLIGHT_MODES
|
||||
PPM_CENTER_ADJUSTABLE
|
||||
PPM_LIMITS_SYMETRICAL
|
||||
OVERRIDE_CHANNEL_FUNCTION
|
||||
FAI_CHOICE
|
||||
)
|
||||
|
||||
set(COMMON_LIBRARIES
|
||||
${QT_LIBRARIES}
|
||||
${PTHREAD_LIBRARY}
|
||||
${SDL_LIBRARY}
|
||||
)
|
||||
|
||||
add_library(opentx-9x${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
|
||||
add_library(opentx-9xr${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
|
||||
add_library(opentx-9x128${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
|
||||
add_library(opentx-9xr128${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
|
||||
add_library(opentx-gruvin9x${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
|
||||
add_library(opentx-mega2560${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
|
||||
add_library(opentx-sky9x${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
|
||||
add_library(opentx-9xrpro${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
|
||||
add_library(opentx-ar9x${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
|
||||
add_library(opentx-taranis${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
|
||||
add_library(opentx-taranisplus${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
|
||||
add_library(opentx-taranisx9e${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
|
||||
add_library(opentx-horus${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
|
||||
|
||||
set(dependencies_9x 9x_bitmaps firmware_translations)
|
||||
add_dependencies(opentx-9x${SUFFIX}-simulator ${dependencies_9x})
|
||||
add_dependencies(opentx-9xr${SUFFIX}-simulator ${dependencies_9x})
|
||||
add_dependencies(opentx-9x128${SUFFIX}-simulator ${dependencies_9x})
|
||||
add_dependencies(opentx-9xr128${SUFFIX}-simulator ${dependencies_9x})
|
||||
add_dependencies(opentx-gruvin9x${SUFFIX}-simulator ${dependencies_9x})
|
||||
add_dependencies(opentx-mega2560${SUFFIX}-simulator ${dependencies_9x})
|
||||
add_dependencies(opentx-sky9x${SUFFIX}-simulator ${dependencies_9x})
|
||||
add_dependencies(opentx-9xrpro${SUFFIX}-simulator ${dependencies_9x})
|
||||
add_dependencies(opentx-ar9x${SUFFIX}-simulator ${dependencies_9x})
|
||||
set(dependencies_taranis taranis_bitmaps firmware_translations)
|
||||
add_dependencies(opentx-taranis${SUFFIX}-simulator ${dependencies_taranis} lua_export_taranis)
|
||||
add_dependencies(opentx-taranisplus${SUFFIX}-simulator ${dependencies_taranis} lua_export_taranis)
|
||||
add_dependencies(opentx-taranisx9e${SUFFIX}-simulator ${dependencies_taranis} lua_export_taranis_x9e)
|
||||
|
||||
add_dependencies(opentx-horus${SUFFIX}-simulator horus_bitmaps horus_fonts firmware_translations lua_export_horus)
|
||||
|
||||
set(OPENTX_LIBRARIES
|
||||
opentx-9x${SUFFIX}-simulator
|
||||
opentx-9xr${SUFFIX}-simulator
|
||||
opentx-9x128${SUFFIX}-simulator
|
||||
opentx-9xr128${SUFFIX}-simulator
|
||||
opentx-gruvin9x${SUFFIX}-simulator
|
||||
opentx-mega2560${SUFFIX}-simulator
|
||||
opentx-sky9x${SUFFIX}-simulator
|
||||
opentx-9xrpro${SUFFIX}-simulator
|
||||
opentx-ar9x${SUFFIX}-simulator
|
||||
opentx-taranis${SUFFIX}-simulator
|
||||
opentx-taranisplus${SUFFIX}-simulator
|
||||
opentx-taranisx9e${SUFFIX}-simulator
|
||||
opentx-horus${SUFFIX}-simulator
|
||||
)
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
install(TARGETS ${OPENTX_LIBRARIES} LIBRARY DESTINATION ${SIMULATOR_LIB_PATH})
|
||||
endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
|
||||
# 9X with ATmega64
|
||||
target_include_directories(opentx-9x${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/9x PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/9x)
|
||||
target_compile_definitions(opentx-9x${SUFFIX}-simulator PRIVATE PCBSTD PCB9X CPUM64 EEPROM EEPROM_RLC ${COMMON_DEFINITIONS})
|
||||
target_link_libraries(opentx-9x${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES})
|
||||
|
||||
# 9XR with ATmega64
|
||||
target_include_directories(opentx-9xr${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/9x PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/9x)
|
||||
target_compile_definitions(opentx-9xr${SUFFIX}-simulator PRIVATE PCBSTD PCB9XR CPUM64 EEPROM EEPROM_RLC ${COMMON_DEFINITIONS})
|
||||
target_link_libraries(opentx-9xr${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES})
|
||||
|
||||
# 9X with ATmega128
|
||||
target_include_directories(opentx-9x128${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/9x PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/9x)
|
||||
target_compile_definitions(opentx-9x128${SUFFIX}-simulator PRIVATE PCBSTD PCB9X CPUM128 EEPROM EEPROM_RLC ${COMMON_DEFINITIONS})
|
||||
target_link_libraries(opentx-9x128${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES})
|
||||
|
||||
# 9XR with ATmega128
|
||||
target_include_directories(opentx-9xr128${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/9x PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/9x)
|
||||
target_compile_definitions(opentx-9xr128${SUFFIX}-simulator PRIVATE PCBSTD PCB9XR CPUM128 EEPROM EEPROM_RLC ${COMMON_DEFINITIONS})
|
||||
target_link_libraries(opentx-9xr128${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES})
|
||||
|
||||
# Gruvin9x
|
||||
target_include_directories(opentx-gruvin9x${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/gruvin9x PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/9x)
|
||||
target_compile_definitions(opentx-gruvin9x${SUFFIX}-simulator PRIVATE PCBGRUVIN9X CPUM2560 EEPROM EEPROM_RLC VOICE SDCARD ${COMMON_DEFINITIONS})
|
||||
target_link_libraries(opentx-gruvin9x${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES})
|
||||
|
||||
# Mega2560
|
||||
target_include_directories(opentx-mega2560${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/mega2560 PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/9x)
|
||||
target_compile_definitions(opentx-mega2560${SUFFIX}-simulator PRIVATE PCBMEGA2560 CPUM2560 EEPROM EEPROM_RLC SDCARD ROTARY_ENCODERS=2 ${COMMON_DEFINITIONS})
|
||||
target_link_libraries(opentx-mega2560${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES})
|
||||
|
||||
# Sky9x
|
||||
target_include_directories(opentx-sky9x${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/sky9x PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/9x)
|
||||
target_compile_definitions(opentx-sky9x${SUFFIX}-simulator PRIVATE PCBSKY9X CPUARM VOICE EEPROM SDCARD ${COMMON_DEFINITIONS})
|
||||
target_link_libraries(opentx-sky9x${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES})
|
||||
|
||||
# 9XR-PRO
|
||||
target_include_directories(opentx-9xrpro${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/sky9x PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/9x)
|
||||
target_compile_definitions(opentx-9xrpro${SUFFIX}-simulator PRIVATE PCBSKY9X REVX CPUARM VOICE EEPROM SDCARD ${COMMON_DEFINITIONS})
|
||||
target_link_libraries(opentx-9xrpro${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES})
|
||||
|
||||
# AR9X
|
||||
target_include_directories(opentx-ar9x${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/sky9x PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/9x)
|
||||
target_compile_definitions(opentx-ar9x${SUFFIX}-simulator PRIVATE PCBSKY9X AR9X CPUARM VOICE EEPROM SDCARD ${COMMON_DEFINITIONS})
|
||||
target_link_libraries(opentx-ar9x${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES})
|
||||
|
||||
# Taranis standard
|
||||
target_include_directories(opentx-taranis${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/taranis PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/taranis)
|
||||
target_compile_definitions(opentx-taranis${SUFFIX}-simulator PRIVATE PCBTARANIS CPUARM CPUSTM32 EEPROM EEPROM_RLC VOICE SDCARD ${COMMON_DEFINITIONS})
|
||||
target_link_libraries(opentx-taranis${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES})
|
||||
|
||||
# Taranis Plus
|
||||
target_include_directories(opentx-taranisplus${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/taranis PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/taranis)
|
||||
target_compile_definitions(opentx-taranisplus${SUFFIX}-simulator PRIVATE PCBTARANIS REVPLUS CPUARM CPUSTM32 EEPROM EEPROM_RLC VOICE SDCARD ${COMMON_DEFINITIONS})
|
||||
target_link_libraries(opentx-taranisplus${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES})
|
||||
|
||||
# Taranis X9E
|
||||
target_include_directories(opentx-taranisx9e${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/taranis PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/taranis)
|
||||
target_compile_definitions(opentx-taranisx9e${SUFFIX}-simulator PRIVATE PCBTARANIS REVPLUS REV9E CPUARM CPUSTM32 STM32F40_41xxx EEPROM EEPROM_RLC VOICE SDCARD ${COMMON_DEFINITIONS})
|
||||
target_link_libraries(opentx-taranisx9e${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES})
|
||||
|
||||
# Horus
|
||||
target_include_directories(opentx-horus${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/horus PRIVATE ${RADIO_SRC_DIRECTORY}/fonts/horus PRIVATE ${CMAKE_BINARY_DIR}/radio/src/bitmaps/horus)
|
||||
target_compile_definitions(opentx-horus${SUFFIX}-simulator PRIVATE PCBHORUS CPUARM CPUSTM32 STM32F40_41xxx COLORLCD VOICE SDCARD ${COMMON_DEFINITIONS})
|
||||
target_link_libraries(opentx-horus${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES})
|
||||
|
||||
add_custom_target(opentx-simulators
|
||||
DEPENDS ${OPENTX_LIBRARIES}
|
||||
)
|
||||
|
||||
if(APPLE)
|
||||
set(SIMULATOR_BUNDLES)
|
||||
foreach(_file ${OPENTX_LIBRARIES})
|
||||
set(SIMULATOR_BUNDLE "${_file}-bundle")
|
||||
add_custom_target(${SIMULATOR_BUNDLE}
|
||||
COMMAND install_name_tool -change /opt/local/Library/Frameworks/QtCore.framework/Versions/4/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore lib${_file}.dylib
|
||||
COMMAND install_name_tool -change /opt/local/Library/Frameworks/QtNetwork.framework/Versions/4/QtNetwork @executable_path/../Frameworks/QtNetwork.framework/Versions/4/QtNetwork lib${_file}.dylib
|
||||
COMMAND install_name_tool -change /opt/local/Library/Frameworks/QtXml.framework/Versions/4/QtXml @executable_path/../Frameworks/QtXml.framework/Versions/4/QtXml lib${_file}.dylib
|
||||
COMMAND install_name_tool -change /opt/local/Library/Frameworks/QtGui.framework/Versions/4/QtGui @executable_path/../Frameworks/QtGui.framework/Versions/4/QtGui lib${_file}.dylib
|
||||
COMMAND install_name_tool -change @rpath/SDL.framework/Versions/A/SDL @executable_path/../Frameworks/SDL.framework/Versions/A/SDL lib${_file}.dylib
|
||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
|
||||
COMMAND pwd
|
||||
COMMAND cp lib${_file}.dylib companion.app/Contents/Resources/
|
||||
DEPENDS ${_file}
|
||||
)
|
||||
list(APPEND SIMULATOR_BUNDLES ${SIMULATOR_BUNDLE})
|
||||
endforeach()
|
||||
add_custom_target(opentx-simulators-bundle DEPENDS ${SIMULATOR_BUNDLES})
|
||||
endif(APPLE)
|
||||
|
||||
@@ -1,695 +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 "opentxsimulator.h"
|
||||
#include <QDebug>
|
||||
#include <stdio.h>
|
||||
#include <exception>
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#define COMPANION
|
||||
#define SIMU
|
||||
#define SIMU_EXCEPTIONS
|
||||
#define GUI
|
||||
#define SPLASH
|
||||
#define FRSKY
|
||||
#define FRSKY_HUB
|
||||
#define GPS
|
||||
#define VARIO
|
||||
#define GAUGES
|
||||
#define PPM_UNIT_PERCENT_PREC1
|
||||
#define AUDIO
|
||||
#define PXX
|
||||
#define DSM2
|
||||
#define DSM2_PPM
|
||||
#define DBLKEYS
|
||||
#define AUTOSWITCH
|
||||
#define GRAPHICS
|
||||
#define CURVES
|
||||
#if defined(PCBFLAMENCO)
|
||||
#define RTCLOCK
|
||||
#define XCURVES
|
||||
#define VIRTUALINPUTS
|
||||
#elif defined(PCBTARANIS) || defined(PCBHORUS)
|
||||
#define RTCLOCK
|
||||
#define XCURVES
|
||||
#define VIRTUALINPUTS
|
||||
#define LUA
|
||||
#define LUA_MODEL_SCRIPTS
|
||||
#define LUAINPUTS
|
||||
#else
|
||||
#define BUZZER
|
||||
#define TEMPLATES
|
||||
#endif
|
||||
#define BOLD_FONT
|
||||
#define HAPTIC
|
||||
#define THRTRACE
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define TIMERS 3
|
||||
#else
|
||||
#define TIMERS 2
|
||||
#endif
|
||||
|
||||
#if defined(PCBSKY9X) && !defined(REVX)
|
||||
#define ROTARY_ENCODERS 1
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
#define ROTARY_ENCODERS 2
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define FRSKY_SPORT
|
||||
#endif
|
||||
|
||||
#if defined (PCBTARANIS)
|
||||
#define MIXERS_MONITOR
|
||||
#endif
|
||||
|
||||
#undef min
|
||||
#undef max
|
||||
|
||||
namespace NAMESPACE {
|
||||
|
||||
#if defined(CPUARM)
|
||||
#include "radio/src/pulses/ppm_arm.cpp"
|
||||
#include "radio/src/pulses/pxx_arm.cpp"
|
||||
#include "radio/src/pulses/dsm2_arm.cpp"
|
||||
#include "radio/src/main_arm.cpp"
|
||||
#include "radio/src/pulses/pulses_arm.cpp"
|
||||
#include "radio/src/tasks_arm.cpp"
|
||||
#include "radio/src/audio_arm.cpp"
|
||||
#include "radio/src/telemetry/telemetry.cpp"
|
||||
#include "radio/src/telemetry/frsky_sport.cpp"
|
||||
#include "radio/src/sbus.cpp"
|
||||
#include "radio/src/crc16.cpp"
|
||||
#else
|
||||
#include "radio/src/main_avr.cpp"
|
||||
#include "radio/src/audio_avr.cpp"
|
||||
#include "radio/src/pulses/pulses_avr.cpp"
|
||||
#endif
|
||||
|
||||
#include "radio/src/storage/storage_common.cpp"
|
||||
#if defined(EEPROM_RLC)
|
||||
#include "radio/src/storage/eeprom_common.cpp"
|
||||
#include "radio/src/storage/eeprom_rlc.cpp"
|
||||
#elif defined(EEPROM)
|
||||
#include "radio/src/storage/eeprom_common.cpp"
|
||||
#include "radio/src/storage/eeprom_raw.cpp"
|
||||
#elif defined(SDCARD)
|
||||
#include "radio/src/storage/sdcard_raw.cpp"
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS) || defined(PCBSKY9X)
|
||||
#include "radio/src/storage/eeprom_conversions.cpp"
|
||||
#endif
|
||||
|
||||
#include "radio/src/opentx.cpp"
|
||||
#include "radio/src/debug.cpp"
|
||||
#include "radio/src/strhelpers.cpp"
|
||||
#include "radio/src/switches.cpp"
|
||||
#include "radio/src/functions.cpp"
|
||||
#include "radio/src/curves.cpp"
|
||||
#include "radio/src/mixer.cpp"
|
||||
#if defined(SDCARD)
|
||||
#include "radio/src/sdcard.cpp"
|
||||
#endif
|
||||
#include "radio/src/timers.cpp"
|
||||
#include "radio/src/stamp.cpp"
|
||||
#include "radio/src/maths.cpp"
|
||||
#include "radio/src/vario.cpp"
|
||||
#include "radio/src/trainer_input.cpp"
|
||||
|
||||
#if defined(PCBHORUS)
|
||||
#include "radio/src/bmp.cpp"
|
||||
#include "radio/src/gui/horus/bitmaps.cpp"
|
||||
#include "radio/src/gui/horus/curves.cpp"
|
||||
#include "radio/src/gui/horus/fonts.cpp"
|
||||
#include "radio/src/gui/horus/widgets.cpp"
|
||||
#include "radio/src/gui/horus/navigation.cpp"
|
||||
#include "radio/src/gui/horus/popups.cpp"
|
||||
#include "radio/src/gui/horus/helpers.cpp"
|
||||
#include "radio/src/gui/horus/menus.cpp"
|
||||
#include "radio/src/gui/horus/menu_model.cpp"
|
||||
#include "radio/src/gui/horus/menu_model_select.cpp"
|
||||
#include "radio/src/gui/horus/menu_model_setup.cpp"
|
||||
#include "radio/src/gui/horus/menu_model_heli.cpp"
|
||||
#include "radio/src/gui/horus/menu_model_flightmodes.cpp"
|
||||
#include "radio/src/gui/horus/menu_model_inputs_mixes.cpp"
|
||||
#include "radio/src/gui/horus/menu_model_curves.cpp"
|
||||
#include "radio/src/gui/horus/menu_model_logical_switches.cpp"
|
||||
#include "radio/src/gui/horus/menu_model_custom_functions.cpp"
|
||||
#include "radio/src/gui/horus/menu_model_custom_scripts.cpp"
|
||||
#include "radio/src/gui/horus/menu_model_gvars.cpp"
|
||||
#include "radio/src/gui/horus/menu_model_limits.cpp"
|
||||
#include "radio/src/gui/horus/menu_model_telemetry.cpp"
|
||||
#include "radio/src/gui/horus/menu_general.cpp"
|
||||
#include "radio/src/gui/horus/menu_general_setup.cpp"
|
||||
#include "radio/src/gui/horus/menu_general_sdmanager.cpp"
|
||||
#include "radio/src/gui/horus/menu_general_trainer.cpp"
|
||||
#include "radio/src/gui/horus/menu_general_version.cpp"
|
||||
// #include "radio/src/gui/horus/menu_general_hardware.cpp"
|
||||
#include "radio/src/gui/horus/menu_general_calib.cpp"
|
||||
#include "radio/src/gui/horus/view_main.cpp"
|
||||
#include "radio/src/gui/horus/view_statistics.cpp"
|
||||
#include "radio/src/gui/horus/view_channels.cpp"
|
||||
#include "radio/src/gui/horus/view_telemetry.cpp"
|
||||
#include "radio/src/gui/horus/view_text.cpp"
|
||||
#include "radio/src/gui/horus/view_about.cpp"
|
||||
#include "radio/src/gui/horus/lcd.cpp"
|
||||
#include "radio/src/gui/horus/splash.cpp"
|
||||
#elif defined(PCBFLAMENCO)
|
||||
#include "radio/src/gui/Flamenco/fonts.cpp"
|
||||
#include "radio/src/gui/Flamenco/widgets.cpp"
|
||||
#include "radio/src/gui/Flamenco/navigation.cpp"
|
||||
#include "radio/src/gui/Flamenco/popups.cpp"
|
||||
#include "radio/src/gui/Flamenco/helpers.cpp"
|
||||
#include "radio/src/gui/Flamenco/menus.cpp"
|
||||
#include "radio/src/gui/Flamenco/menu_model.cpp"
|
||||
#include "radio/src/gui/Flamenco/menu_model_select.cpp"
|
||||
#include "radio/src/gui/Flamenco/menu_model_setup.cpp"
|
||||
#include "radio/src/gui/Flamenco/menu_model_heli.cpp"
|
||||
#include "radio/src/gui/Flamenco/menu_model_flightmodes.cpp"
|
||||
#include "radio/src/gui/Flamenco/menu_model_inputs_mixes.cpp"
|
||||
#include "radio/src/gui/Flamenco/menu_model_curves.cpp"
|
||||
#include "radio/src/gui/Flamenco/menu_model_logical_switches.cpp"
|
||||
#include "radio/src/gui/Flamenco/menu_model_custom_functions.cpp"
|
||||
// #include "radio/src/gui/Flamenco/menu_model_custom_scripts.cpp"
|
||||
#include "radio/src/gui/Flamenco/menu_model_gvars.cpp"
|
||||
#include "radio/src/gui/Flamenco/menu_model_limits.cpp"
|
||||
#include "radio/src/gui/Flamenco/menu_model_telemetry.cpp"
|
||||
#include "radio/src/gui/Flamenco/menu_general.cpp"
|
||||
#include "radio/src/gui/Flamenco/menu_general_setup.cpp"
|
||||
#include "radio/src/gui/Flamenco/menu_general_sdmanager.cpp"
|
||||
#include "radio/src/gui/Flamenco/menu_general_trainer.cpp"
|
||||
#include "radio/src/gui/Flamenco/menu_general_version.cpp"
|
||||
// #include "radio/src/gui/Flamenco/menu_general_hardware.cpp"
|
||||
#include "radio/src/gui/Flamenco/menu_general_calib.cpp"
|
||||
#include "radio/src/gui/Flamenco/view_main.cpp"
|
||||
#include "radio/src/gui/Flamenco/view_statistics.cpp"
|
||||
#include "radio/src/gui/Flamenco/view_channels.cpp"
|
||||
#include "radio/src/gui/Flamenco/view_telemetry.cpp"
|
||||
#include "radio/src/gui/Flamenco/view_text.cpp"
|
||||
#include "radio/src/gui/Flamenco/view_about.cpp"
|
||||
#include "radio/src/gui/Flamenco/lcd.cpp"
|
||||
#include "radio/src/gui/Flamenco/splash.cpp"
|
||||
#include "radio/src/targets/flamenco/tw8823_driver.cpp"
|
||||
#elif defined(PCBTARANIS)
|
||||
#include "radio/src/bmp.cpp"
|
||||
#include "radio/src/gui/taranis/fonts.cpp"
|
||||
#include "radio/src/gui/taranis/widgets.cpp"
|
||||
#include "radio/src/gui/taranis/navigation.cpp"
|
||||
#include "radio/src/gui/taranis/popups.cpp"
|
||||
#include "radio/src/gui/taranis/helpers.cpp"
|
||||
#include "radio/src/gui/taranis/menus.cpp"
|
||||
#include "radio/src/gui/taranis/menu_model.cpp"
|
||||
#include "radio/src/gui/taranis/menu_model_select.cpp"
|
||||
#include "radio/src/gui/taranis/menu_model_setup.cpp"
|
||||
#include "radio/src/gui/taranis/menu_model_heli.cpp"
|
||||
#include "radio/src/gui/taranis/menu_model_flightmodes.cpp"
|
||||
#include "radio/src/gui/taranis/menu_model_inputs_mixes.cpp"
|
||||
#include "radio/src/gui/taranis/menu_model_curves.cpp"
|
||||
#include "radio/src/gui/taranis/menu_model_logical_switches.cpp"
|
||||
#include "radio/src/gui/taranis/menu_model_custom_functions.cpp"
|
||||
#include "radio/src/gui/taranis/menu_model_custom_scripts.cpp"
|
||||
#include "radio/src/gui/taranis/menu_model_gvars.cpp"
|
||||
#include "radio/src/gui/taranis/menu_model_limits.cpp"
|
||||
#include "radio/src/gui/taranis/menu_model_telemetry.cpp"
|
||||
#include "radio/src/gui/taranis/menu_general.cpp"
|
||||
#include "radio/src/gui/taranis/menu_general_setup.cpp"
|
||||
#include "radio/src/gui/taranis/menu_general_sdmanager.cpp"
|
||||
#include "radio/src/gui/taranis/menu_general_trainer.cpp"
|
||||
#include "radio/src/gui/taranis/menu_general_version.cpp"
|
||||
#include "radio/src/gui/taranis/menu_general_diagkeys.cpp"
|
||||
#include "radio/src/gui/taranis/menu_general_diaganas.cpp"
|
||||
#include "radio/src/gui/taranis/menu_general_hardware.cpp"
|
||||
#include "radio/src/gui/taranis/menu_general_calib.cpp"
|
||||
#include "radio/src/gui/taranis/view_main.cpp"
|
||||
#include "radio/src/gui/taranis/view_statistics.cpp"
|
||||
#include "radio/src/gui/taranis/view_channels.cpp"
|
||||
#include "radio/src/gui/taranis/view_telemetry.cpp"
|
||||
#include "radio/src/gui/taranis/view_text.cpp"
|
||||
#include "radio/src/gui/taranis/view_about.cpp"
|
||||
#include "radio/src/gui/taranis/lcd.cpp"
|
||||
#include "radio/src/gui/taranis/splash.cpp"
|
||||
#else
|
||||
#include "radio/src/gui/9x/fonts.cpp"
|
||||
#include "radio/src/gui/9x/widgets.cpp"
|
||||
#include "radio/src/gui/9x/navigation.cpp"
|
||||
#include "radio/src/gui/9x/popups.cpp"
|
||||
#include "radio/src/gui/9x/helpers.cpp"
|
||||
#include "radio/src/gui/9x/menus.cpp"
|
||||
#include "radio/src/gui/9x/menu_model.cpp"
|
||||
#include "radio/src/gui/9x/menu_model_select.cpp"
|
||||
#include "radio/src/gui/9x/menu_model_setup.cpp"
|
||||
#include "radio/src/gui/9x/menu_model_heli.cpp"
|
||||
#include "radio/src/gui/9x/menu_model_flightmodes.cpp"
|
||||
#include "radio/src/gui/9x/menu_model_inputs_mixes.cpp"
|
||||
#include "radio/src/gui/9x/menu_model_curves.cpp"
|
||||
#include "radio/src/gui/9x/menu_model_logical_switches.cpp"
|
||||
#include "radio/src/gui/9x/menu_model_custom_functions.cpp"
|
||||
#include "radio/src/gui/9x/menu_model_limits.cpp"
|
||||
#include "radio/src/gui/9x/menu_model_telemetry.cpp"
|
||||
#include "radio/src/gui/9x/menu_model_templates.cpp"
|
||||
#include "radio/src/gui/9x/menu_general.cpp"
|
||||
#include "radio/src/gui/9x/menu_general_setup.cpp"
|
||||
#if defined(SDCARD)
|
||||
#include "radio/src/gui/9x/menu_general_sdmanager.cpp"
|
||||
#include "radio/src/gui/9x/view_text.cpp"
|
||||
#endif
|
||||
#include "radio/src/gui/9x/menu_general_trainer.cpp"
|
||||
#include "radio/src/gui/9x/menu_general_version.cpp"
|
||||
#include "radio/src/gui/9x/menu_general_diagkeys.cpp"
|
||||
#include "radio/src/gui/9x/menu_general_diaganas.cpp"
|
||||
#if defined(CPUARM)
|
||||
#include "radio/src/gui/9x/menu_general_hardware.cpp"
|
||||
#endif
|
||||
#include "radio/src/gui/9x/menu_general_calib.cpp"
|
||||
#include "radio/src/gui/9x/view_main.cpp"
|
||||
#include "radio/src/gui/9x/view_statistics.cpp"
|
||||
#include "radio/src/gui/9x/view_telemetry.cpp"
|
||||
#if !defined(CPUM64)
|
||||
#include "radio/src/gui/9x/view_about.cpp"
|
||||
#endif
|
||||
#include "radio/src/gui/9x/lcd.cpp"
|
||||
#include "radio/src/gui/9x/splash.cpp"
|
||||
#endif
|
||||
|
||||
#if !defined(VIRTUALINPUTS)
|
||||
#include "radio/src/templates.cpp"
|
||||
#endif
|
||||
|
||||
#if defined(SDCARD)
|
||||
#include "radio/src/logs.cpp"
|
||||
#endif
|
||||
|
||||
#if defined(RTCLOCK)
|
||||
#include "radio/src/rtc.cpp"
|
||||
#endif
|
||||
|
||||
#if defined(BUZZER)
|
||||
#include "radio/src/buzzer.cpp"
|
||||
#endif
|
||||
|
||||
#if defined(PCBHORUS)
|
||||
#include "radio/src/targets/horus/board_horus.cpp"
|
||||
#include "radio/src/targets/horus/keys_driver.cpp"
|
||||
#include "radio/src/targets/horus/audio_driver.cpp"
|
||||
#include "radio/src/targets/horus/telemetry_driver.cpp"
|
||||
#include "radio/src/targets/horus/haptic_driver.cpp"
|
||||
#include "radio/src/targets/horus/pulses_driver.cpp"
|
||||
#include "radio/src/targets/taranis/rtc_driver.cpp"
|
||||
#include "radio/src/targets/horus/trainer_driver.cpp"
|
||||
#include "radio/src/targets/horus/serial2_driver.cpp"
|
||||
#elif defined(PCBFLAMENCO)
|
||||
#include "radio/src/targets/flamenco/board_flamenco.cpp"
|
||||
#include "radio/src/targets/flamenco/keys_driver.cpp"
|
||||
#include "radio/src/targets/flamenco/audio_driver.cpp"
|
||||
#include "radio/src/targets/flamenco/telemetry_driver.cpp"
|
||||
#include "radio/src/targets/flamenco/eeprom_driver.cpp"
|
||||
// #include "radio/src/targets/flamenco/haptic_driver.cpp"
|
||||
#include "radio/src/targets/flamenco/pulses_driver.cpp"
|
||||
#include "radio/src/targets/flamenco/rtc_driver.cpp"
|
||||
#include "radio/src/targets/flamenco/trainer_driver.cpp"
|
||||
#elif defined(PCBTARANIS)
|
||||
#include "radio/src/targets/taranis/board_taranis.cpp"
|
||||
#include "radio/src/targets/taranis/keys_driver.cpp"
|
||||
#include "radio/src/targets/taranis/audio_driver.cpp"
|
||||
#include "radio/src/targets/taranis/telemetry_driver.cpp"
|
||||
#include "radio/src/targets/taranis/haptic_driver.cpp"
|
||||
#if defined(REV9E)
|
||||
#include "radio/src/targets/taranis/top_lcd_driver.cpp"
|
||||
#endif
|
||||
#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/serial2_driver.cpp"
|
||||
#elif defined(PCBSKY9X)
|
||||
#include "radio/src/targets/sky9x/board_sky9x.cpp"
|
||||
#include "radio/src/targets/sky9x/telemetry_driver.cpp"
|
||||
#include "radio/src/targets/sky9x/pwr_driver.cpp"
|
||||
#include "radio/src/targets/sky9x/eeprom_driver.cpp"
|
||||
#include "radio/src/targets/sky9x/keys_driver.cpp"
|
||||
#include "radio/src/targets/sky9x/audio_driver.cpp"
|
||||
#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/serial2_driver.cpp"
|
||||
#include "radio/src/targets/sky9x/pulses_driver.cpp"
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
#include "radio/src/targets/gruvin9x/board_gruvin9x.cpp"
|
||||
#include "radio/src/targets/gruvin9x/somo14d.cpp"
|
||||
#elif defined(PCBMEGA2560)
|
||||
#include "radio/src/targets/mega2560/board_mega2560.cpp"
|
||||
#else
|
||||
#include "radio/src/targets/9x/board_stock.cpp"
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#include "radio/src/gui/gui_helpers.cpp"
|
||||
#endif
|
||||
|
||||
#include "radio/src/keys.cpp"
|
||||
#include "radio/src/haptic.cpp"
|
||||
#include "radio/src/targets/simu/simpgmspace.cpp"
|
||||
#include "radio/src/translations.cpp"
|
||||
#include "radio/src/telemetry/frsky.cpp"
|
||||
#if defined(CPUARM)
|
||||
#include "radio/src/telemetry/frsky_d_arm.cpp"
|
||||
#else
|
||||
#include "radio/src/telemetry/frsky_d.cpp"
|
||||
#endif
|
||||
#include "radio/src/translations/tts_en.cpp"
|
||||
|
||||
#if defined(CPUARM)
|
||||
#include "radio/src/translations/tts_cz.cpp"
|
||||
#include "radio/src/translations/tts_de.cpp"
|
||||
#include "radio/src/translations/tts_es.cpp"
|
||||
#include "radio/src/translations/tts_fr.cpp"
|
||||
#include "radio/src/translations/tts_hu.cpp"
|
||||
#include "radio/src/translations/tts_it.cpp"
|
||||
#include "radio/src/translations/tts_nl.cpp"
|
||||
#include "radio/src/translations/tts_pl.cpp"
|
||||
#include "radio/src/translations/tts_pt.cpp"
|
||||
#include "radio/src/translations/tts_se.cpp"
|
||||
#include "radio/src/translations/tts_sk.cpp"
|
||||
#endif
|
||||
|
||||
#if defined(LUA)
|
||||
#include "radio/src/lua/interface.cpp"
|
||||
#include "radio/src/lua/api_general.cpp"
|
||||
#include "radio/src/lua/api_lcd.cpp"
|
||||
#include "radio/src/lua/api_model.cpp"
|
||||
#include "radio/src/thirdparty/Lua/src/lapi.c"
|
||||
#include "radio/src/thirdparty/Lua/src/lcode.c"
|
||||
#include "radio/src/thirdparty/Lua/src/lctype.c"
|
||||
#include "radio/src/thirdparty/Lua/src/ldebug.c"
|
||||
#include "radio/src/thirdparty/Lua/src/ldo.c"
|
||||
#include "radio/src/thirdparty/Lua/src/ldump.c"
|
||||
#include "radio/src/thirdparty/Lua/src/lfunc.c"
|
||||
#include "radio/src/thirdparty/Lua/src/lgc.c"
|
||||
#include "radio/src/thirdparty/Lua/src/llex.c"
|
||||
#include "radio/src/thirdparty/Lua/src/lmem.c"
|
||||
#include "radio/src/thirdparty/Lua/src/lobject.c"
|
||||
#include "radio/src/thirdparty/Lua/src/lopcodes.c"
|
||||
#include "radio/src/thirdparty/Lua/src/lparser.c"
|
||||
#include "radio/src/thirdparty/Lua/src/lstate.c"
|
||||
#include "radio/src/thirdparty/Lua/src/lstring.c"
|
||||
#include "radio/src/thirdparty/Lua/src/ltable.c"
|
||||
#include "radio/src/thirdparty/Lua/src/lrotable.c"
|
||||
#include "radio/src/thirdparty/Lua/src/ltm.c"
|
||||
#include "radio/src/thirdparty/Lua/src/lundump.c"
|
||||
#include "radio/src/thirdparty/Lua/src/lvm.c"
|
||||
#include "radio/src/thirdparty/Lua/src/lzio.c"
|
||||
#include "radio/src/thirdparty/Lua/src/lbaselib.c"
|
||||
#include "radio/src/thirdparty/Lua/src/linit.c"
|
||||
#include "radio/src/thirdparty/Lua/src/lmathlib.c"
|
||||
#include "radio/src/thirdparty/Lua/src/lbitlib.c"
|
||||
#include "radio/src/thirdparty/Lua/src/loadlib.c"
|
||||
#include "radio/src/thirdparty/Lua/src/lauxlib.c"
|
||||
#include "radio/src/thirdparty/Lua/src/ltablib.c"
|
||||
#include "radio/src/thirdparty/Lua/src/lcorolib.c"
|
||||
#include "radio/src/thirdparty/Lua/src/liolib.c"
|
||||
#include "radio/src/thirdparty/Lua/src/lstrlib.c"
|
||||
#endif
|
||||
|
||||
int16_t g_anas[NUM_STICKS+NUM_POTS];
|
||||
|
||||
uint16_t anaIn(uint8_t chan)
|
||||
{
|
||||
return g_anas[chan];
|
||||
}
|
||||
|
||||
bool hasExtendedTrims()
|
||||
{
|
||||
return g_model.extendedTrims;
|
||||
}
|
||||
|
||||
uint8_t getStickMode()
|
||||
{
|
||||
return limit<uint8_t>(0, g_eeGeneral.stickMode, 3);
|
||||
}
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
void resetTrims()
|
||||
{
|
||||
TRIMS_GPIO_REG_RVD |= TRIMS_GPIO_PIN_RVD;
|
||||
TRIMS_GPIO_REG_RVU |= TRIMS_GPIO_PIN_RVU;
|
||||
TRIMS_GPIO_REG_RHL |= TRIMS_GPIO_PIN_RHL;
|
||||
TRIMS_GPIO_REG_RHR |= TRIMS_GPIO_PIN_RHR;
|
||||
TRIMS_GPIO_REG_LVD |= TRIMS_GPIO_PIN_LVD;
|
||||
TRIMS_GPIO_REG_LVU |= TRIMS_GPIO_PIN_LVU;
|
||||
TRIMS_GPIO_REG_LHL |= TRIMS_GPIO_PIN_LHL;
|
||||
TRIMS_GPIO_REG_LHR |= TRIMS_GPIO_PIN_LHR;
|
||||
}
|
||||
#endif
|
||||
|
||||
void delay_01us(::uint16_t nb)
|
||||
{
|
||||
}
|
||||
|
||||
OpenTxSimulator::OpenTxSimulator()
|
||||
{
|
||||
}
|
||||
|
||||
void OpenTxSimulator::setSdPath(const QString &sdPath)
|
||||
{
|
||||
#if defined(SDCARD)
|
||||
strncpy(simuSdDirectory, sdPath.toAscii().constData(), sizeof(simuSdDirectory)-1);
|
||||
simuSdDirectory[sizeof(simuSdDirectory)-1] = '\0';
|
||||
#endif
|
||||
}
|
||||
|
||||
void OpenTxSimulator::setVolumeGain(int value)
|
||||
{
|
||||
volumeGain = value;
|
||||
}
|
||||
|
||||
bool OpenTxSimulator::timer10ms()
|
||||
{
|
||||
#define TIMER10MS_IMPORT
|
||||
#include "simulatorimport.h"
|
||||
}
|
||||
|
||||
::uint8_t * OpenTxSimulator::getLcd()
|
||||
{
|
||||
return (::uint8_t *)simuLcdBuf;
|
||||
}
|
||||
|
||||
bool OpenTxSimulator::lcdChanged(bool & lightEnable)
|
||||
{
|
||||
#define LCDCHANGED_IMPORT
|
||||
#include "simulatorimport.h"
|
||||
}
|
||||
|
||||
void OpenTxSimulator::start(QByteArray & eeprom, bool tests)
|
||||
{
|
||||
memcpy(NAMESPACE::eeprom, eeprom.data(), std::min<int>(sizeof(NAMESPACE::eeprom), eeprom.size()));
|
||||
start((const char *)0, tests);
|
||||
}
|
||||
|
||||
void OpenTxSimulator::start(const char * filename, bool tests)
|
||||
{
|
||||
#if defined(PCBSKY9X) && !defined(REVX)
|
||||
g_rotenc[0] = 0;
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
g_rotenc[0] = 0;
|
||||
g_rotenc[1] = 0;
|
||||
#endif
|
||||
|
||||
StartEepromThread(filename);
|
||||
StartAudioThread(volumeGain);
|
||||
StartMainThread(tests);
|
||||
}
|
||||
|
||||
void OpenTxSimulator::stop()
|
||||
{
|
||||
StopMainThread();
|
||||
#if defined(CPUARM)
|
||||
StopAudioThread();
|
||||
#endif
|
||||
StopEepromThread();
|
||||
}
|
||||
|
||||
void OpenTxSimulator::getValues(TxOutputs &outputs)
|
||||
{
|
||||
#define GETVALUES_IMPORT
|
||||
#define g_chans512 channelOutputs
|
||||
#include "simulatorimport.h"
|
||||
#if defined(PCBSKY9X)
|
||||
outputs.beep = g_beepCnt;
|
||||
g_beepCnt = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void OpenTxSimulator::setValues(TxInputs &inputs)
|
||||
{
|
||||
#define SETVALUES_IMPORT
|
||||
#include "simulatorimport.h"
|
||||
}
|
||||
|
||||
void OpenTxSimulator::setTrim(unsigned int idx, int value)
|
||||
{
|
||||
idx = NAMESPACE::modn12x3[4*getStickMode() + idx];
|
||||
::uint8_t phase = getTrimFlightPhase(getFlightMode(), idx);
|
||||
setTrimValue(phase, idx, value);
|
||||
}
|
||||
|
||||
void OpenTxSimulator::getTrims(Trims & trims)
|
||||
{
|
||||
::uint8_t phase = getFlightMode();
|
||||
trims.extended = hasExtendedTrims();
|
||||
for (::uint8_t idx=0; idx<4; idx++) {
|
||||
trims.values[idx] = getTrimValue(getTrimFlightPhase(phase, idx), idx);
|
||||
}
|
||||
|
||||
for (int i=0; i<2; i++) {
|
||||
::uint8_t idx = NAMESPACE::modn12x3[4*getStickMode() + i];
|
||||
::int16_t tmp = trims.values[i];
|
||||
trims.values[i] = trims.values[idx];
|
||||
trims.values[idx] = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
void OpenTxSimulator::wheelEvent(int steps)
|
||||
{
|
||||
#if defined(PCBHORUS) || defined(PCBFLAMENCO)
|
||||
if (steps > 0)
|
||||
rotencValue -= 2;
|
||||
else
|
||||
rotencValue += 2;
|
||||
#elif defined(REV9E)
|
||||
if (steps == 255)
|
||||
rotencValue -= 2;
|
||||
else
|
||||
rotencValue += 2;
|
||||
#elif defined(PCBSKY9X) && !defined(REVX)
|
||||
g_rotenc[0] += steps*4;
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
g_rotenc[0] += steps;
|
||||
#endif
|
||||
}
|
||||
|
||||
unsigned int OpenTxSimulator::getPhase()
|
||||
{
|
||||
return getFlightMode();
|
||||
}
|
||||
|
||||
const char * OpenTxSimulator::getPhaseName(unsigned int phase)
|
||||
{
|
||||
static char buff[sizeof(g_model.flightModeData[0].name)+1];
|
||||
zchar2str(buff, g_model.flightModeData[phase].name, sizeof(g_model.flightModeData[0].name));
|
||||
return buff;
|
||||
}
|
||||
|
||||
const char * OpenTxSimulator::getError()
|
||||
{
|
||||
#define GETERROR_IMPORT
|
||||
#include "simulatorimport.h"
|
||||
}
|
||||
|
||||
void OpenTxSimulator::sendTelemetry(::uint8_t * data, unsigned int len)
|
||||
{
|
||||
#if defined(FRSKY_SPORT)
|
||||
processSportPacket(data);
|
||||
#endif
|
||||
}
|
||||
|
||||
uint8_t OpenTxSimulator::getSensorInstance(uint16_t id)
|
||||
{
|
||||
#if defined(FRSKY_SPORT)
|
||||
for (int i = 0; i<MAX_SENSORS; i++) {
|
||||
if (isTelemetryFieldAvailable(i)) {
|
||||
TelemetrySensor * sensor = &g_model.telemetrySensors[i];
|
||||
if (sensor->id == id) {
|
||||
return sensor->instance;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint16_t OpenTxSimulator::getSensorRatio(uint16_t id)
|
||||
{
|
||||
#if defined(FRSKY_SPORT)
|
||||
for (int i = 0; i<MAX_SENSORS; i++) {
|
||||
if (isTelemetryFieldAvailable(i)) {
|
||||
TelemetrySensor * sensor = &g_model.telemetrySensors[i];
|
||||
if (sensor->id == id) {
|
||||
return sensor->custom.ratio;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
void OpenTxSimulator::setTrainerInput(unsigned int inputNumber, ::int16_t value)
|
||||
{
|
||||
#define SETTRAINER_IMPORT
|
||||
#include "simulatorimport.h"
|
||||
}
|
||||
|
||||
void OpenTxSimulator::setLuaStateReloadPermanentScripts()
|
||||
{
|
||||
#if defined(LUA)
|
||||
luaState = INTERPRETER_RELOAD_PERMANENT_SCRIPTS;
|
||||
#endif
|
||||
}
|
||||
|
||||
void OpenTxSimulator::installTraceHook(void (*callback)(const char *))
|
||||
{
|
||||
traceCallback = callback;
|
||||
}
|
||||
|
||||
class OpenTxSimulatorFactory: public SimulatorFactory
|
||||
{
|
||||
public:
|
||||
OpenTxSimulatorFactory()
|
||||
{
|
||||
}
|
||||
|
||||
virtual SimulatorInterface *create()
|
||||
{
|
||||
return new OpenTxSimulator();
|
||||
}
|
||||
|
||||
virtual QString name()
|
||||
{
|
||||
return QString("opentx-" FLAVOUR SUFFIX);
|
||||
}
|
||||
|
||||
virtual BoardEnum type()
|
||||
{
|
||||
#if defined(PCBHORUS)
|
||||
return BOARD_HORUS;
|
||||
#elif defined(PCBFLAMENCO)
|
||||
return BOARD_FLAMENCO;
|
||||
#elif defined(PCBTARANIS)
|
||||
return BOARD_TARANIS;
|
||||
#else
|
||||
return BOARD_STOCK;
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
extern "C" DLLEXPORT SimulatorFactory *registerSimu()
|
||||
{
|
||||
return new NAMESPACE::OpenTxSimulatorFactory();
|
||||
}
|
||||
@@ -1,146 +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 opentx_taranis_simulator_h
|
||||
#define opentx_taranis_simulator_h
|
||||
|
||||
#include "simulatorinterface.h"
|
||||
|
||||
#if defined(PCBHORUS)
|
||||
#define FLAVOUR "horus"
|
||||
#define NAMESPACE HORUS
|
||||
#define EEPROM_VARIANT 0
|
||||
#elif defined(PCBFLAMENCO)
|
||||
#define FLAVOUR "flamenco"
|
||||
#define NAMESPACE FLAMENCO
|
||||
#define EEPROM_VARIANT 0
|
||||
#elif defined(PCBTARANIS) && defined(REV9E)
|
||||
#define FLAVOUR "taranisx9e"
|
||||
#define NAMESPACE TaranisX9E
|
||||
#define EEPROM_VARIANT 0x8000
|
||||
#elif defined(PCBTARANIS) && defined(REVPLUS)
|
||||
#define FLAVOUR "taranisplus"
|
||||
#define NAMESPACE TaranisPlus
|
||||
#define EEPROM_VARIANT 0
|
||||
#elif defined(PCBTARANIS)
|
||||
#define FLAVOUR "taranis"
|
||||
#define NAMESPACE Taranis
|
||||
#define EEPROM_VARIANT 0
|
||||
#elif defined(PCBSKY9X) && defined(REVX)
|
||||
#define FLAVOUR "9xrpro"
|
||||
#define NAMESPACE Sky9xPro
|
||||
#define EEPROM_VARIANT 0
|
||||
#elif defined(PCBSKY9X) && defined(AR9X)
|
||||
#define FLAVOUR "ar9x"
|
||||
#define NAMESPACE Ar9x
|
||||
#define EEPROM_VARIANT 0
|
||||
#elif defined(PCBSKY9X)
|
||||
#define FLAVOUR "sky9x"
|
||||
#define NAMESPACE Sky9X
|
||||
#define EEPROM_VARIANT 0
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
#define FLAVOUR "gruvin9x"
|
||||
#define NAMESPACE Gruvin9X
|
||||
#define EEPROM_VARIANT 0
|
||||
#elif defined(PCBMEGA2560)
|
||||
#define FLAVOUR "mega2560"
|
||||
#define NAMESPACE Mega2560
|
||||
#define EEPROM_VARIANT 0
|
||||
#elif defined(PCB9XR) && defined(CPUM128)
|
||||
#define FLAVOUR "9xr128"
|
||||
#define NAMESPACE M128XR
|
||||
#define EEPROM_VARIANT 0x8003
|
||||
#elif defined(PCB9X) && defined(CPUM128)
|
||||
#define FLAVOUR "9x128"
|
||||
#define NAMESPACE M128
|
||||
#define EEPROM_VARIANT 0x8003
|
||||
#elif defined(PCB9XR) && defined(CPUM64)
|
||||
#define FLAVOUR "9xr"
|
||||
#define NAMESPACE M64XR
|
||||
#define EEPROM_VARIANT 0x0003
|
||||
#elif defined(PCB9X) && defined(CPUM64)
|
||||
#define FLAVOUR "9x"
|
||||
#define NAMESPACE M64
|
||||
#define EEPROM_VARIANT 0x0003
|
||||
#else
|
||||
#error "Unknown board"
|
||||
#endif
|
||||
|
||||
#if defined __GNUC__
|
||||
#define DLLEXPORT
|
||||
#else
|
||||
#define DLLEXPORT __declspec(dllexport)
|
||||
#endif
|
||||
|
||||
namespace NAMESPACE {
|
||||
|
||||
class DLLEXPORT OpenTxSimulator : public SimulatorInterface {
|
||||
|
||||
private:
|
||||
int volumeGain;
|
||||
|
||||
public:
|
||||
|
||||
OpenTxSimulator();
|
||||
|
||||
virtual void setSdPath(const QString &sdPath);
|
||||
|
||||
virtual void setVolumeGain(int value);
|
||||
|
||||
virtual void start(QByteArray & eeprom, bool tests=true);
|
||||
|
||||
virtual void start(const char * filename, bool tests=true);
|
||||
|
||||
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();
|
||||
|
||||
virtual const char * getPhaseName(unsigned int phase);
|
||||
|
||||
virtual void wheelEvent(int steps);
|
||||
|
||||
virtual const char * getError();
|
||||
|
||||
virtual void sendTelemetry(uint8_t * data, unsigned int len);
|
||||
|
||||
virtual uint8_t getSensorInstance(uint16_t id);
|
||||
|
||||
virtual uint16_t getSensorRatio(uint16_t id);
|
||||
|
||||
virtual void setTrainerInput(unsigned int inputNumber, int16_t value);
|
||||
|
||||
virtual void installTraceHook(void (*callback)(const char *));
|
||||
|
||||
virtual void setLuaStateReloadPermanentScripts();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,15 +0,0 @@
|
||||
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
|
||||
)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${PROJECT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
add_library(th9x-simulator th9xsimulator.cpp)
|
||||
@@ -1,232 +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 TRIMS_GPIO_REG_LHL pind
|
||||
#define TRIMS_GPIO_REG_LVD pind
|
||||
#define TRIMS_GPIO_REG_RVU pind
|
||||
#define TRIMS_GPIO_REG_RHL pind
|
||||
#define TRIMS_GPIO_REG_LHR pind
|
||||
#define TRIMS_GPIO_REG_LVU pind
|
||||
#define TRIMS_GPIO_REG_RVD pind
|
||||
#define TRIMS_GPIO_REG_RHR 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, TRIMS_GPIO_REG_LHL, PIN_TRIM_LH_L)
|
||||
TRIM_CASE(1, TRIMS_GPIO_REG_LHR, PIN_TRIM_LH_R)
|
||||
TRIM_CASE(2, TRIMS_GPIO_REG_LVD, PIN_TRIM_LV_DN)
|
||||
TRIM_CASE(3, TRIMS_GPIO_REG_LVU, PIN_TRIM_LV_UP)
|
||||
TRIM_CASE(4, TRIMS_GPIO_REG_RVD, PIN_TRIM_RV_DN)
|
||||
TRIM_CASE(5, TRIMS_GPIO_REG_RVU, PIN_TRIM_RV_UP)
|
||||
TRIM_CASE(6, TRIMS_GPIO_REG_RHL, PIN_TRIM_RH_L)
|
||||
TRIM_CASE(7, TRIMS_GPIO_REG_RHR, 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 isBacklightEnable() (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()
|
||||
{
|
||||
return (::uint8_t *)simuLcdBuf;
|
||||
}
|
||||
|
||||
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,58 +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 const char * getError();
|
||||
|
||||
protected:
|
||||
|
||||
Th9xInterface * th9xInterface;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,322 +0,0 @@
|
||||
#include <algorithm>
|
||||
#include "helpers.h"
|
||||
#include "th9xeeprom.h"
|
||||
|
||||
RawSwitch th9xToSwitch(int8_t sw)
|
||||
{
|
||||
if (sw == 0)
|
||||
return RawSwitch(SWITCH_TYPE_NONE);
|
||||
else if (sw <= 9)
|
||||
return RawSwitch(SWITCH_TYPE_SWITCH, sw);
|
||||
else
|
||||
return RawSwitch(SWITCH_TYPE_VIRTUAL, sw > 0 ? sw-9 : sw+9);
|
||||
}
|
||||
|
||||
t_Th9xTrainerMix::t_Th9xTrainerMix()
|
||||
{
|
||||
memset(this, 0, sizeof(t_Th9xTrainerMix));
|
||||
}
|
||||
|
||||
t_Th9xTrainerMix::operator TrainerMix()
|
||||
{
|
||||
TrainerMix c9x;
|
||||
c9x.src = srcChn;
|
||||
c9x.swtch = th9xToSwitch(swtch);
|
||||
c9x.weight = (25 * studWeight) / 8;
|
||||
c9x.mode = mode;
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Th9xTrainerData::t_Th9xTrainerData()
|
||||
{
|
||||
memset(this, 0, sizeof(t_Th9xTrainerData));
|
||||
}
|
||||
|
||||
t_Th9xTrainerData::operator TrainerData ()
|
||||
{
|
||||
TrainerData c9x;
|
||||
for (int i=0; i<NUM_STICKS; i++) {
|
||||
c9x.calib[i] = calib[i];
|
||||
c9x.mix[i] = mix[i];
|
||||
}
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Th9xGeneral::t_Th9xGeneral()
|
||||
{
|
||||
memset(this, 0, sizeof(t_Th9xGeneral));
|
||||
}
|
||||
|
||||
Th9xGeneral::operator GeneralSettings ()
|
||||
{
|
||||
GeneralSettings result;
|
||||
|
||||
result.version = myVers;
|
||||
|
||||
for (int i=0; i<NUM_STICKSnPOTS; i++) {
|
||||
result.calibMid[i] = calibMid[i];
|
||||
result.calibSpanNeg[i] = calibSpanNeg[i];
|
||||
result.calibSpanPos[i] = calibSpanPos[i];
|
||||
}
|
||||
|
||||
result.currModel = currModel;
|
||||
result.contrast = contrast;
|
||||
result.vBatWarn = vBatWarn;
|
||||
result.txVoltageCalibration = txVoltageCalibration;
|
||||
// result.lightSw = th9xToSwitch(lightSw);
|
||||
result.trainer = trainer;
|
||||
result.view = view;
|
||||
result.disableThrottleWarning = disableThrottleWarning;
|
||||
result.switchWarning = disableSwitchWarning ? 0 : -1;
|
||||
result.disableMemoryWarning = disableMemoryWarning;
|
||||
switch (beeperVal) {
|
||||
case 0:
|
||||
result.beeperMode = GeneralSettings::BEEPER_QUIET;
|
||||
break;
|
||||
case 1:
|
||||
result.beeperMode = GeneralSettings::BEEPER_NOKEYS;
|
||||
break;
|
||||
case 2:
|
||||
result.beeperMode = GeneralSettings::BEEPER_ALL;
|
||||
break;
|
||||
case 3:
|
||||
result.beeperMode = GeneralSettings::BEEPER_ALL;
|
||||
result.beeperLength = 2;
|
||||
}
|
||||
result.stickMode = stickMode;
|
||||
result.inactivityTimer = inactivityMin;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
t_Th9xExpoData::t_Th9xExpoData()
|
||||
{
|
||||
memset(this, 0, sizeof(t_Th9xExpoData));
|
||||
}
|
||||
|
||||
t_Th9xExpoData::operator ExpoData ()
|
||||
{
|
||||
ExpoData c9x;
|
||||
if (exp5) {
|
||||
c9x.curve.type = CurveReference::CURVE_REF_EXPO;
|
||||
c9x.curve.value = exp5;
|
||||
}
|
||||
else if (curve > 6) {
|
||||
c9x.curve.type = CurveReference::CURVE_REF_CUSTOM;
|
||||
c9x.curve.value = curve - 6;
|
||||
}
|
||||
else if (curve > 0) {
|
||||
c9x.curve.type = CurveReference::CURVE_REF_FUNC;
|
||||
c9x.curve.value = curve;
|
||||
}
|
||||
c9x.mode = mode3;
|
||||
c9x.weight = weight6;
|
||||
c9x.chn = chn;
|
||||
c9x.swtch = th9xToSwitch(drSw);
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Th9xLimitData::t_Th9xLimitData()
|
||||
{
|
||||
memset(this, 0, sizeof(t_Th9xLimitData));
|
||||
}
|
||||
|
||||
t_Th9xLimitData::operator LimitData ()
|
||||
{
|
||||
LimitData c9x;
|
||||
c9x.min = 10*(min-100);
|
||||
c9x.max = 10*(max+100);
|
||||
c9x.revert = revert;
|
||||
c9x.offset = offset;
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Th9xMixData::t_Th9xMixData()
|
||||
{
|
||||
memset(this, 0, sizeof(t_Th9xMixData));
|
||||
}
|
||||
|
||||
t_Th9xMixData::operator MixData ()
|
||||
{
|
||||
MixData c9x;
|
||||
c9x.destCh = destCh;
|
||||
if (srcRaw < 7)
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_STICK, srcRaw);
|
||||
else if (srcRaw < 10)
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_NONE); // TODO
|
||||
else if (srcRaw == 10)
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_MAX);
|
||||
else if (srcRaw == 11)
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_NONE); // TODO CUR
|
||||
else if (srcRaw < 24)
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-12);
|
||||
else /* always true if (srcRaw < 32) */
|
||||
c9x.srcRaw = RawSource(SOURCE_TYPE_PPM, srcRaw-24);
|
||||
c9x.weight = weight;
|
||||
c9x.swtch = th9xToSwitch(swtch);
|
||||
if (curve > 6) {
|
||||
c9x.curve.type = CurveReference::CURVE_REF_CUSTOM;
|
||||
c9x.curve.value = curve - 6;
|
||||
}
|
||||
else if (curve > 0) {
|
||||
c9x.curve.type = CurveReference::CURVE_REF_FUNC;
|
||||
c9x.curve.value = curve;
|
||||
}
|
||||
c9x.speedUp = speedUp;
|
||||
c9x.speedDown = speedDown;
|
||||
c9x.mltpx = (MltpxValue)mixMode;
|
||||
return c9x;
|
||||
}
|
||||
|
||||
t_Th9xLogicalSwitchData::operator LogicalSwitchData ()
|
||||
{
|
||||
LogicalSwitchData c9x;
|
||||
c9x.func = opCmp;
|
||||
c9x.val1 = val1;
|
||||
c9x.val2 = val2;
|
||||
|
||||
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val1 = toSource(val1).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= LS_FN_EQUAL) {
|
||||
c9x.val2 = toSource(val2).toValue();
|
||||
}
|
||||
|
||||
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
|
||||
c9x.val1 = th9xToSwitch(val1).toValue();
|
||||
c9x.val2 = th9xToSwitch(val2).toValue();
|
||||
}
|
||||
|
||||
return c9x;
|
||||
}
|
||||
|
||||
int8_t t_Th9xLogicalSwitchData::fromSource(RawSource source)
|
||||
{
|
||||
int v1 = 0;
|
||||
if (source.type == SOURCE_TYPE_STICK)
|
||||
v1 = 1+source.index;
|
||||
else if (source.type == SOURCE_TYPE_ROTARY_ENCODER) {
|
||||
EEPROMWarnings.push_back(::QObject::tr("th9x on this board doesn't have Rotary Encoders"));
|
||||
v1 = 5+source.index;
|
||||
}
|
||||
else if (source.type == SOURCE_TYPE_MAX)
|
||||
v1 = 8;
|
||||
/* else if (source.type == SOURCE_TYPE_3POS)
|
||||
v1 = 9; */
|
||||
else if (source.type == SOURCE_TYPE_CYC)
|
||||
v1 = 10+source.index;
|
||||
else if (source.type == SOURCE_TYPE_PPM)
|
||||
v1 = 13+source.index;
|
||||
else if (source.type == SOURCE_TYPE_CH)
|
||||
v1 = 21+source.index;
|
||||
else if (source.type == SOURCE_TYPE_TELEMETRY)
|
||||
v1 = 36+source.index;
|
||||
return v1;
|
||||
}
|
||||
|
||||
RawSource t_Th9xLogicalSwitchData::toSource(int8_t value)
|
||||
{
|
||||
if (value == 0) {
|
||||
return RawSource(SOURCE_TYPE_NONE);
|
||||
}
|
||||
else if (value <= 7) {
|
||||
return RawSource(SOURCE_TYPE_STICK, value - 1);
|
||||
}
|
||||
else if (value == 8) {
|
||||
return RawSource(SOURCE_TYPE_MAX);
|
||||
}
|
||||
/* else if (value == 9) {
|
||||
return RawSource(SOURCE_TYPE_3POS);
|
||||
} */
|
||||
else if (value <= 12) {
|
||||
return RawSource(SOURCE_TYPE_CYC, value-10);
|
||||
}
|
||||
else if (value <= 20) {
|
||||
return RawSource(SOURCE_TYPE_PPM, value-13);
|
||||
}
|
||||
else if (value <= 36) {
|
||||
return RawSource(SOURCE_TYPE_CH, value-21);
|
||||
}
|
||||
else {
|
||||
return RawSource(SOURCE_TYPE_TELEMETRY, value-36);
|
||||
}
|
||||
}
|
||||
|
||||
t_Th9xModelData::t_Th9xModelData()
|
||||
{
|
||||
memset(this, 0, sizeof(t_Th9xModelData));
|
||||
}
|
||||
|
||||
t_Th9xModelData::operator ModelData ()
|
||||
{
|
||||
ModelData c9x;
|
||||
c9x.used = true;
|
||||
getEEPROMString(c9x.name, name, sizeof(name));
|
||||
/*switch(tmrMode) {
|
||||
case 1:
|
||||
c9x.timers[0].mode = TMRMODE_ABS;
|
||||
break;
|
||||
case 2:
|
||||
c9x.timers[0].mode = TMRMODE_THs;
|
||||
break;
|
||||
case 3:
|
||||
c9x.timers[0].mode = TMRMODE_THp;
|
||||
break;
|
||||
default:
|
||||
c9x.timers[0].mode = TMRMODE_OFF;
|
||||
break;
|
||||
}*/
|
||||
// c9x.timers[0].dir = tmrDir;
|
||||
c9x.timers[0].val = tmrVal;
|
||||
/*c9x.protocol = (Protocol)protocol;
|
||||
c9x.moduleData[0].channelsCount = 8 + 2 * ppmNCH;
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.trimInc = trimInc;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.customFn[0].func = FuncTrims2Offsets;
|
||||
if (trimSw) {
|
||||
c9x.customFn[0].swtch = trimSw;
|
||||
}
|
||||
c9x.beepANACenter = beepANACenter;
|
||||
c9x.pulsePol = pulsePol;
|
||||
c9x.extendedLimits = extendedLimits;
|
||||
c9x.swashRingData.invertELE = swashInvertELE;
|
||||
c9x.swashRingData.invertAIL = swashInvertAIL;
|
||||
c9x.swashRingData.invertCOL = swashInvertCOL;
|
||||
c9x.swashRingData.type = swashType;
|
||||
c9x.swashRingData.collectiveSource = swashCollectiveSource;
|
||||
c9x.swashRingData.value = swashRingValue;*/
|
||||
for (int i=0; i<TH9X_NUM_CHNOUT; i++)
|
||||
c9x.limitData[i] = limitData[i];
|
||||
for (int i=0; i<TH9X_MAX_EXPOS; i++)
|
||||
c9x.expoData[i] = expoTab[i];
|
||||
for (int i=0; i<TH9X_MAX_MIXERS; i++)
|
||||
c9x.mixData[i] = mixData[i];
|
||||
for (int i=0; i<NUM_STICKS; i++)
|
||||
c9x.flightModeData[0].trim[i] = trimData[i].itrim;
|
||||
for (int i=0; i<TH9X_MAX_CURVES3; i++) {
|
||||
c9x.curves[i].count = 3;
|
||||
for (int j=0; j<3; j++) {
|
||||
c9x.curves[i].points[j].x = -100 + 100*i;
|
||||
c9x.curves[i].points[j].y = curves3[i][j];
|
||||
}
|
||||
}
|
||||
for (int i=0; i<TH9X_MAX_CURVES5; i++) {
|
||||
c9x.curves[i+TH9X_MAX_CURVES3].count = 5;
|
||||
for (int j=0; j<5; j++) {
|
||||
c9x.curves[i+TH9X_MAX_CURVES3].points[j].x = -100 + 50*i;
|
||||
c9x.curves[i+TH9X_MAX_CURVES3].points[j].y = curves5[i][j];
|
||||
}
|
||||
}
|
||||
for (int i=0; i<TH9X_MAX_CURVES9; i++) {
|
||||
c9x.curves[i+TH9X_MAX_CURVES3+TH9X_MAX_CURVES5].count = 5;
|
||||
for (int j=0; j<9; j++) {
|
||||
c9x.curves[i+TH9X_MAX_CURVES3+TH9X_MAX_CURVES5].points[j].x = -100 + 50*i;
|
||||
c9x.curves[i+TH9X_MAX_CURVES3+TH9X_MAX_CURVES5].points[j].y = curves9[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
return c9x;
|
||||
}
|
||||
|
||||
@@ -1,182 +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 th9xeeprom_h
|
||||
#define th9xeeprom_h
|
||||
|
||||
#include <inttypes.h>
|
||||
#include "eeprominterface.h"
|
||||
|
||||
//eeprom data
|
||||
#define TH9X_NUM_CHNOUT 8
|
||||
#define TH9X_MAX_EXPOS 15
|
||||
#define TH9X_MAX_MIXERS 25
|
||||
#define TH9X_MAX_SWITCHES 16
|
||||
#define TH9X_MAX_CURVES3 3
|
||||
#define TH9X_MAX_CURVES5 2
|
||||
#define TH9X_MAX_CURVES9 2
|
||||
#define TH9X_MAX_CSFUNC 13
|
||||
|
||||
#define MDVERS 6
|
||||
|
||||
#define TH9X_NUM_CSW 12 //number of custom switches
|
||||
#define NUM_STICKSnPOTS 7 //number of sticks and pots
|
||||
|
||||
PACK(typedef struct t_Th9xTrainerMix {
|
||||
uint8_t srcChn:3; //0-7 = ch1-8
|
||||
int8_t swtch:5;
|
||||
int8_t studWeight:6;
|
||||
uint8_t mode:2; // off, add-mode, subst-mode
|
||||
|
||||
operator TrainerMix();
|
||||
t_Th9xTrainerMix();
|
||||
}) Th9xTrainerMix; //
|
||||
|
||||
PACK(typedef struct t_Th9xTrainerData {
|
||||
int16_t calib[8];
|
||||
Th9xTrainerMix mix[4];
|
||||
|
||||
operator TrainerData();
|
||||
t_Th9xTrainerData();
|
||||
}) Th9xTrainerData;
|
||||
|
||||
PACK(typedef struct t_Th9xGeneral {
|
||||
uint8_t myVers;
|
||||
int16_t calibMid[NUM_STICKSnPOTS];
|
||||
int16_t calibSpanNeg[NUM_STICKSnPOTS];
|
||||
int16_t calibSpanPos[NUM_STICKSnPOTS];
|
||||
uint8_t inactivityMin; //ge150
|
||||
uint8_t iTrimSwitch:4; //ge192
|
||||
uint8_t iTrimTme1:2;
|
||||
uint8_t iTrimTme2:2;
|
||||
uint8_t currModel; //0..15
|
||||
uint8_t contrast;
|
||||
uint8_t vBatWarn;
|
||||
int8_t txVoltageCalibration;
|
||||
int8_t lightSw;
|
||||
Th9xTrainerData trainer;
|
||||
uint8_t adcFilt:2;
|
||||
uint8_t keySpeed:2;
|
||||
uint8_t thr0pos:4;
|
||||
uint8_t disableThrottleWarning:1;
|
||||
uint8_t disableSwitchWarning:1;
|
||||
uint8_t disableMemoryWarning:1;
|
||||
uint8_t beeperVal:2;
|
||||
uint8_t view:3;
|
||||
uint8_t stickMode:2;
|
||||
uint8_t naviMode:2;
|
||||
|
||||
operator GeneralSettings();
|
||||
t_Th9xGeneral();
|
||||
}) Th9xGeneral;
|
||||
|
||||
/*
|
||||
* ModelData
|
||||
*/
|
||||
|
||||
PACK(typedef struct t_Th9xExpoData {
|
||||
int8_t exp5:5;
|
||||
uint8_t mode3:3; //0=end 1=pos 2=neg 3=both 4=trimNeg
|
||||
|
||||
int8_t weight6:6;
|
||||
uint8_t chn:2; //
|
||||
|
||||
int8_t drSw:5;
|
||||
uint8_t curve:3; //
|
||||
|
||||
operator ExpoData();
|
||||
t_Th9xExpoData();
|
||||
}) Th9xExpoData;
|
||||
|
||||
|
||||
PACK(typedef struct t_Th9xLimitData {
|
||||
int8_t min:7;
|
||||
bool scale:1;
|
||||
int8_t max:7;
|
||||
bool resv:1;
|
||||
bool revert:1;
|
||||
int8_t offset:7;
|
||||
|
||||
operator LimitData();
|
||||
t_Th9xLimitData();
|
||||
}) Th9xLimitData;
|
||||
|
||||
#define MLTPX_ADD 0
|
||||
#define MLTPX_MUL 1
|
||||
#define MLTPX_REP 2
|
||||
|
||||
PACK(typedef struct t_Th9xMixData {
|
||||
uint8_t destCh:4; // 1..C9X_NUM_CHNOUT,X1-X4
|
||||
uint8_t mixMode:2; // + * =
|
||||
uint8_t dmy1:2; //
|
||||
|
||||
uint8_t srcRaw:5; // S1-4,P1-3,max,cur,X1-X4,p1-3,T1-8 24
|
||||
uint8_t switchMode:2; // switchMode oOff\tiNeg\tiNul\tiPos
|
||||
uint8_t curveNeg:1; // Cv cV
|
||||
|
||||
int8_t weight;
|
||||
|
||||
int8_t swtch:5;
|
||||
uint8_t curve:3; // 0=off 1..7=cv1..7
|
||||
|
||||
uint8_t speedUp:4; // Servogeschwindigkeit aus Tabelle (10ms Cycle)
|
||||
uint8_t speedDown:4; // 0 nichts
|
||||
|
||||
operator MixData();
|
||||
t_Th9xMixData();
|
||||
}) Th9xMixData;
|
||||
|
||||
PACK(typedef struct t_Th9xLogicalSwitchData {
|
||||
uint8_t sw:3; // 0..7
|
||||
uint8_t opCmp:2; // < & | ^
|
||||
uint8_t opRes:3; // 0 => 1=> 0=> !=> & | ^
|
||||
int8_t val1;
|
||||
int8_t val2;
|
||||
|
||||
operator LogicalSwitchData();
|
||||
t_Th9xLogicalSwitchData() { memset(this, 0, sizeof(t_Th9xLogicalSwitchData)); }
|
||||
int8_t fromSource(RawSource source);
|
||||
RawSource toSource(int8_t value);
|
||||
}) Th9xLogicalSwitchData;
|
||||
|
||||
PACK(typedef struct t_Th9xTrimData {
|
||||
int8_t itrim:6; //trim index
|
||||
uint8_t tmode:2;
|
||||
|
||||
t_Th9xTrimData() { }
|
||||
}) Th9xTrimData;
|
||||
|
||||
PACK(typedef struct t_Th9xModelData {
|
||||
char name[10]; // 10 must be first for eeLoadModelName
|
||||
uint8_t mdVers; // 1
|
||||
uint8_t tmrMode:3; // 1
|
||||
int8_t tmrSw:5; //
|
||||
uint16_t tmrVal; // 2
|
||||
uint8_t protocol:5; // 1
|
||||
uint8_t protocolPar:3; //
|
||||
char res[3]; // 3
|
||||
Th9xLimitData limitData[TH9X_NUM_CHNOUT];// 3*8
|
||||
Th9xExpoData expoTab[TH9X_MAX_EXPOS]; // 5*4 -> 3*15
|
||||
Th9xMixData mixData[TH9X_MAX_MIXERS]; //0 5*25
|
||||
int8_t curves3[TH9X_MAX_CURVES3][3]; // 9 new143
|
||||
int8_t curves5[TH9X_MAX_CURVES5][5]; // 10
|
||||
int8_t curves9[TH9X_MAX_CURVES9][9]; // 18
|
||||
Th9xLogicalSwitchData switchTab[TH9X_MAX_SWITCHES];//
|
||||
Th9xTrimData trimData[NUM_STICKS]; // 3*4 -> 1*4
|
||||
operator ModelData();
|
||||
t_Th9xModelData();
|
||||
}) Th9xModelData;
|
||||
|
||||
#endif
|
||||
@@ -1,167 +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 <iostream>
|
||||
#include "th9xinterface.h"
|
||||
#include "th9xeeprom.h"
|
||||
#include "simulator/th9xsimulator.h"
|
||||
#include "file.h"
|
||||
#include "appdata.h"
|
||||
|
||||
#define FILE_TYP_GENERAL 1
|
||||
#define FILE_TYP_MODEL 2
|
||||
|
||||
#define FILE_GENERAL 0
|
||||
#define FILE_MODEL(n) (1+n)
|
||||
|
||||
Th9xInterface::Th9xInterface():
|
||||
EEPROMInterface(BOARD_STOCK),
|
||||
efile(new RleFile())
|
||||
{
|
||||
}
|
||||
|
||||
Th9xInterface::~Th9xInterface()
|
||||
{
|
||||
delete efile;
|
||||
}
|
||||
|
||||
const char * Th9xInterface::getName()
|
||||
{
|
||||
return "Th9x";
|
||||
}
|
||||
|
||||
const int Th9xInterface::getEEpromSize()
|
||||
{
|
||||
QString avrMCU = g.mcu();
|
||||
if (avrMCU==QString("m128")) {
|
||||
return 2*EESIZE_STOCK;
|
||||
}
|
||||
return EESIZE_STOCK;
|
||||
}
|
||||
|
||||
const int Th9xInterface::getMaxModels()
|
||||
{
|
||||
return 16;
|
||||
}
|
||||
|
||||
unsigned long Th9xInterface::loadxml(RadioData &radioData, QDomDocument &doc)
|
||||
{
|
||||
std::bitset<NUM_ERRORS> errors;
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
unsigned long Th9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
|
||||
{
|
||||
std::cout << "trying th9x import... ";
|
||||
|
||||
std::bitset<NUM_ERRORS> errors;
|
||||
|
||||
if (size != getEEpromSize()) {
|
||||
std::cout << "wrong size\n";
|
||||
errors.set(WRONG_SIZE);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
if (!efile->EeFsOpen((uint8_t *)eeprom, size, BOARD_STOCK)) {
|
||||
std::cout << "wrong file system\n";
|
||||
errors.set(WRONG_FILE_SYSTEM);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
efile->openRd(FILE_GENERAL);
|
||||
Th9xGeneral th9xGeneral;
|
||||
|
||||
if (efile->readRlc2((uint8_t*)&th9xGeneral, 1) != 1) {
|
||||
std::cout << "no\n";
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
std::cout << "version " << (unsigned int)th9xGeneral.myVers << " ";
|
||||
|
||||
switch(th9xGeneral.myVers) {
|
||||
case 6:
|
||||
break;
|
||||
default:
|
||||
std::cout << "not th9x\n";
|
||||
errors.set(NOT_TH9X);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
efile->openRd(FILE_GENERAL);
|
||||
int len = efile->readRlc2((uint8_t*)&th9xGeneral, sizeof(Th9xGeneral));
|
||||
if (len != sizeof(Th9xGeneral)) {
|
||||
std::cout << "not th9x\n";
|
||||
errors.set(NOT_TH9X);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
radioData.generalSettings = th9xGeneral;
|
||||
|
||||
for (int i=0; i<getMaxModels(); i++) {
|
||||
Th9xModelData th9xModel;
|
||||
efile->openRd(FILE_MODEL(i));
|
||||
if (!efile->readRlc2((uint8_t*)&th9xModel, sizeof(Th9xModelData))) {
|
||||
radioData.models[i].clear();
|
||||
}
|
||||
else {
|
||||
radioData.models[i] = th9xModel;
|
||||
}
|
||||
}
|
||||
|
||||
std::cout << "ok\n";
|
||||
errors.set(NO_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
unsigned long Th9xInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index)
|
||||
{
|
||||
std::bitset<NUM_ERRORS> errors;
|
||||
errors.set(UNKNOWN_ERROR);
|
||||
return errors.to_ulong();
|
||||
}
|
||||
|
||||
int Th9xInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t variant, uint8_t version)
|
||||
{
|
||||
std::cout << "NO!\n";
|
||||
// TODO a warning
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Th9xInterface::getSize(const ModelData & model)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Th9xInterface::getSize(const GeneralSettings & settings)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Th9xInterface::isAvailable(PulsesProtocol proto, int port)
|
||||
{
|
||||
switch (proto) {
|
||||
case PULSES_PPM:
|
||||
case PULSES_SILV_A:
|
||||
case PULSES_SILV_B:
|
||||
case PULSES_SILV_C:
|
||||
case PULSES_CTP1009:
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -1,57 +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_interface_h
|
||||
#define th9x_interface_h
|
||||
|
||||
#include "eeprominterface.h"
|
||||
|
||||
class RleFile;
|
||||
|
||||
class Th9xInterface : public EEPROMInterface
|
||||
{
|
||||
public:
|
||||
|
||||
Th9xInterface();
|
||||
|
||||
virtual ~Th9xInterface();
|
||||
|
||||
virtual const char * getName();
|
||||
|
||||
virtual const int getEEpromSize();
|
||||
|
||||
virtual const int getMaxModels();
|
||||
|
||||
virtual unsigned long load(RadioData &, const uint8_t *eeprom, int size);
|
||||
|
||||
virtual unsigned long loadBackup(RadioData &, uint8_t *eeprom, int esize, int index);
|
||||
|
||||
virtual unsigned long loadxml(RadioData &radioData, QDomDocument &doc);
|
||||
|
||||
virtual int save(uint8_t *eeprom, RadioData &radioData, uint32_t variant=0, uint8_t version=0);
|
||||
|
||||
virtual int getSize(const ModelData &);
|
||||
|
||||
virtual int getSize(const GeneralSettings &);
|
||||
|
||||
virtual int isAvailable(PulsesProtocol proto, int port=0);
|
||||
|
||||
protected:
|
||||
|
||||
RleFile *efile;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,360 +0,0 @@
|
||||
#include "flasheepromdialog.h"
|
||||
#include "ui_flasheepromdialog.h"
|
||||
#include "eeprominterface.h"
|
||||
#include "helpers.h"
|
||||
#include "firmwareinterface.h"
|
||||
#include "hexinterface.h"
|
||||
#include "appdata.h"
|
||||
#include "progressdialog.h"
|
||||
#include "radiointerface.h"
|
||||
#include "converteeprom.h"
|
||||
#include "splashlibrarydialog.h"
|
||||
|
||||
FlashEEpromDialog::FlashEEpromDialog(QWidget *parent, const QString &filename):
|
||||
QDialog(parent),
|
||||
ui(new Ui::FlashEEpromDialog),
|
||||
eepromFilename(filename),
|
||||
radioData(new RadioData())
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->profileLabel->setText(tr("Current profile: %1").arg(g.profile[g.id()].name()));
|
||||
if (!filename.isEmpty()) {
|
||||
ui->eepromFilename->hide();
|
||||
ui->eepromLoad->hide();
|
||||
}
|
||||
QString backupPath = g.profile[g.id()].pBackupDir();
|
||||
if (backupPath.isEmpty()) {
|
||||
backupPath=g.backupDir();
|
||||
ui->backupBeforeWrite->setChecked(g.enableBackup() || g.profile[g.id()].penableBackup());
|
||||
}
|
||||
if (backupPath.isEmpty() || !QDir(backupPath).exists()) {
|
||||
ui->backupBeforeWrite->setEnabled(false);
|
||||
}
|
||||
updateUI();
|
||||
}
|
||||
|
||||
FlashEEpromDialog::~FlashEEpromDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void FlashEEpromDialog::updateUI()
|
||||
{
|
||||
// ui->burnButton->setEnabled(true);
|
||||
ui->eepromFilename->setText(eepromFilename);
|
||||
if (getEEpromVersion(eepromFilename) >= 0) {
|
||||
ui->profileLabel->show();
|
||||
ui->patchCalibration->show();
|
||||
ui->patchHardwareSettings->show();
|
||||
QString name = g.profile[g.id()].name();
|
||||
QString calib = g.profile[g.id()].stickPotCalib();
|
||||
QString trainercalib = g.profile[g.id()].trainerCalib();
|
||||
QString DisplaySet = g.profile[g.id()].display();
|
||||
QString BeeperSet = g.profile[g.id()].beeper();
|
||||
QString HapticSet = g.profile[g.id()].haptic();
|
||||
QString SpeakerSet = g.profile[g.id()].speaker();
|
||||
if (!name.isEmpty()) {
|
||||
ui->profileLabel->show();
|
||||
ui->patchCalibration->show();
|
||||
ui->patchHardwareSettings->show();
|
||||
// TODO I hardcode the number of pots here, should be dependant on the board?
|
||||
if (!((calib.length()==(NUM_STICKS+3)*12) && (trainercalib.length()==16))) {
|
||||
ui->patchCalibration->setDisabled(true);
|
||||
}
|
||||
if (!((DisplaySet.length()==6) && (BeeperSet.length()==4) && (HapticSet.length()==6) && (SpeakerSet.length()==6))) {
|
||||
ui->patchHardwareSettings->setDisabled(true);
|
||||
}
|
||||
}
|
||||
else {
|
||||
ui->profileLabel->hide();
|
||||
}
|
||||
ui->burnButton->setEnabled(true);
|
||||
}
|
||||
else {
|
||||
ui->profileLabel->hide();
|
||||
ui->patchCalibration->hide();
|
||||
ui->patchHardwareSettings->hide();
|
||||
}
|
||||
QTimer::singleShot(0, this, SLOT(shrink()));
|
||||
}
|
||||
|
||||
void FlashEEpromDialog::on_eepromLoad_clicked()
|
||||
{
|
||||
QString filename = QFileDialog::getOpenFileName(this, tr("Choose Radio Backup file"), g.eepromDir(), tr(EXTERNAL_EEPROM_FILES_FILTER));
|
||||
if (!filename.isEmpty()) {
|
||||
eepromFilename = filename;
|
||||
updateUI();
|
||||
}
|
||||
}
|
||||
|
||||
int FlashEEpromDialog::getEEpromVersion(const QString &filename)
|
||||
{
|
||||
int result = -1;
|
||||
int eeprom_size = 0;
|
||||
|
||||
if (filename.isEmpty()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
QFile file(filename);
|
||||
if (!file.exists()) {
|
||||
QMessageBox::warning(this, tr("Error"), tr("Unable to find file %1!").arg(filename));
|
||||
return -1;
|
||||
}
|
||||
|
||||
QByteArray eeprom(EESIZE_MAX, 0);
|
||||
int fileType = getFileType(filename);
|
||||
|
||||
#if 0
|
||||
if (fileType==FILE_TYPE_XML) {
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
QMessageBox::critical(this, tr("Error"),tr("Error opening file %1:\n%2.").arg(filename).arg(file.errorString()));
|
||||
return -1;
|
||||
}
|
||||
QTextStream inputStream(&file);
|
||||
XmlInterface(inputStream).load(testData);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (fileType==FILE_TYPE_HEX || fileType==FILE_TYPE_EEPE) {
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
QMessageBox::warning(this, tr("Error"),tr("Error opening file %1:\n%2.").arg(filename).arg(file.errorString()));
|
||||
return -1;
|
||||
}
|
||||
QDomDocument doc(ER9X_EEPROM_FILE_TYPE);
|
||||
bool xmlOK = doc.setContent(&file);
|
||||
if (xmlOK) {
|
||||
RadioData * radioData = new RadioData();
|
||||
std::bitset<NUM_ERRORS> errors((unsigned long long)LoadEepromXml(*radioData, doc));
|
||||
if (!errors.test(NO_ERROR)) {
|
||||
QMessageBox::warning(this, tr("Error"), tr("Invalid Models and Settings File %1").arg(filename));
|
||||
}
|
||||
else {
|
||||
result = radioData->generalSettings.version;
|
||||
}
|
||||
delete radioData;
|
||||
return result;
|
||||
}
|
||||
file.reset();
|
||||
|
||||
QTextStream inputStream(&file);
|
||||
if (fileType==FILE_TYPE_EEPE) { // read EEPE file header
|
||||
QString hline = inputStream.readLine();
|
||||
if (hline!=EEPE_EEPROM_FILE_HEADER) {
|
||||
QMessageBox::warning(this, tr("Error"), tr("Invalid Models and Settings File %1").arg(filename));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
eeprom_size = HexInterface(inputStream).load((uint8_t *)eeprom.data(), EESIZE_MAX);
|
||||
}
|
||||
else if (fileType==FILE_TYPE_BIN) { //read binary
|
||||
eeprom_size = file.size();
|
||||
if (!file.open(QFile::ReadOnly)) { //reading binary file - TODO HEX support
|
||||
QMessageBox::warning(this, tr("Error"), tr("Error opening file %1:\n%2.").arg(filename).arg(file.errorString()));
|
||||
return -1;
|
||||
}
|
||||
int len = file.read(eeprom.data(), eeprom_size);
|
||||
if (len != eeprom_size) {
|
||||
QMessageBox::warning(this, tr("Error"), tr("Error reading file %1:\n%2.").arg(filename).arg(file.errorString()));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
RadioData * radioData = new RadioData();
|
||||
std::bitset<NUM_ERRORS> errors((unsigned long long)LoadEeprom(*radioData, (const uint8_t *)eeprom.data(), eeprom_size));
|
||||
if (eeprom_size == 0 || !errors.test(NO_ERROR)) {
|
||||
QMessageBox::warning(this, tr("Error"), tr("Invalid Models and Settings file %1").arg(filename));
|
||||
}
|
||||
else {
|
||||
result = radioData->generalSettings.version;
|
||||
}
|
||||
delete radioData;
|
||||
return result;
|
||||
}
|
||||
|
||||
bool FlashEEpromDialog::patchCalibration()
|
||||
{
|
||||
QString calib = g.profile[g.id()].stickPotCalib();
|
||||
QString trainercalib = g.profile[g.id()].trainerCalib();
|
||||
int potsnum=GetCurrentFirmware()->getCapability(Pots);
|
||||
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)) {
|
||||
QString Byte;
|
||||
int16_t byte16;
|
||||
bool ok;
|
||||
for (int i=0; i<(NUM_STICKS+potsnum); i++) {
|
||||
Byte=calib.mid(i*12,4);
|
||||
byte16=(int16_t)Byte.toInt(&ok,16);
|
||||
if (ok)
|
||||
radioData->generalSettings.calibMid[i]=byte16;
|
||||
Byte=calib.mid(4+i*12,4);
|
||||
byte16=(int16_t)Byte.toInt(&ok,16);
|
||||
if (ok)
|
||||
radioData->generalSettings.calibSpanNeg[i]=byte16;
|
||||
Byte=calib.mid(8+i*12,4);
|
||||
byte16=(int16_t)Byte.toInt(&ok,16);
|
||||
if (ok)
|
||||
radioData->generalSettings.calibSpanPos[i]=byte16;
|
||||
}
|
||||
for (int i=0; i<4; i++) {
|
||||
Byte = trainercalib.mid(i*4,4);
|
||||
byte16 = (int16_t)Byte.toInt(&ok,16);
|
||||
if (ok) {
|
||||
radioData->generalSettings.trainer.calib[i] = byte16;
|
||||
}
|
||||
}
|
||||
radioData->generalSettings.txCurrentCalibration = txCurrentCalibration;
|
||||
radioData->generalSettings.txVoltageCalibration = txVoltageCalibration;
|
||||
radioData->generalSettings.PPM_Multiplier = PPM_Multiplier;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
QMessageBox::critical(this, tr("Warning"), tr("Wrong radio calibration data in profile, Settings not patched"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool FlashEEpromDialog::patchHardwareSettings()
|
||||
{
|
||||
QString DisplaySet = g.profile[g.id()].display();
|
||||
QString BeeperSet = g.profile[g.id()].beeper();
|
||||
QString HapticSet = g.profile[g.id()].haptic();
|
||||
QString SpeakerSet = g.profile[g.id()].speaker();
|
||||
uint8_t GSStickMode=(uint8_t) g.profile[g.id()].gsStickMode();
|
||||
uint8_t vBatWarn=(uint8_t) g.profile[g.id()].vBatWarn();
|
||||
|
||||
if ((DisplaySet.length()==6) && (BeeperSet.length()==4) && (HapticSet.length()==6) && (SpeakerSet.length()==6)) {
|
||||
radioData->generalSettings.vBatWarn = vBatWarn;
|
||||
radioData->generalSettings.stickMode = GSStickMode;
|
||||
uint8_t byte8u;
|
||||
int8_t byte8;
|
||||
bool ok;
|
||||
byte8=(int8_t)DisplaySet.mid(0,2).toInt(&ok,16);
|
||||
if (ok) radioData->generalSettings.optrexDisplay=(byte8==1 ? true : false);
|
||||
byte8u=(uint8_t)DisplaySet.mid(2,2).toUInt(&ok,16);
|
||||
if (ok) radioData->generalSettings.contrast=byte8u;
|
||||
byte8u=(uint8_t)DisplaySet.mid(4,2).toUInt(&ok,16);
|
||||
if (ok) radioData->generalSettings.backlightBright=byte8u;
|
||||
byte8u=(uint8_t)BeeperSet.mid(0,2).toUInt(&ok,16);
|
||||
if (ok) radioData->generalSettings.beeperMode=(GeneralSettings::BeeperMode)byte8u;
|
||||
byte8=(int8_t)BeeperSet.mid(2,2).toInt(&ok,16);
|
||||
if (ok) radioData->generalSettings.beeperLength=byte8;
|
||||
byte8u=(uint8_t)HapticSet.mid(0,2).toUInt(&ok,16);
|
||||
if (ok) radioData->generalSettings.hapticMode=(GeneralSettings::BeeperMode)byte8u;
|
||||
byte8u=(uint8_t)HapticSet.mid(2,2).toUInt(&ok,16);
|
||||
if (ok) radioData->generalSettings.hapticStrength=byte8u;
|
||||
byte8=(int8_t)HapticSet.mid(4,2).toInt(&ok,16);
|
||||
if (ok) radioData->generalSettings.hapticLength=byte8;
|
||||
byte8u=(uint8_t)SpeakerSet.mid(0,2).toUInt(&ok,16);
|
||||
if (ok) radioData->generalSettings.speakerMode=byte8u;
|
||||
byte8u=(uint8_t)SpeakerSet.mid(2,2).toUInt(&ok,16);
|
||||
if (ok) radioData->generalSettings.speakerPitch=byte8u;
|
||||
byte8u=(uint8_t)SpeakerSet.mid(4,2).toUInt(&ok,16);
|
||||
if (ok) radioData->generalSettings.speakerVolume=byte8u;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
QMessageBox::critical(this, tr("Warning"), tr("Wrong radio setting data in profile, Settings not patched"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void FlashEEpromDialog::on_burnButton_clicked()
|
||||
{
|
||||
// patch the eeprom if needed
|
||||
bool patch = false;
|
||||
if (ui->patchCalibration->isChecked()) {
|
||||
patch |= patchCalibration();
|
||||
}
|
||||
if (ui->patchHardwareSettings->isChecked()) {
|
||||
patch |= patchHardwareSettings();
|
||||
}
|
||||
QString filename = eepromFilename;
|
||||
if (patch) {
|
||||
QString filename = generateProcessUniqueTempFileName("temp.bin");
|
||||
QFile file(filename);
|
||||
uint8_t *eeprom = (uint8_t*)malloc(GetEepromInterface()->getEEpromSize());
|
||||
int eeprom_size = GetEepromInterface()->save(eeprom, *radioData, GetCurrentFirmware()->getVariantNumber());
|
||||
if (!eeprom_size) {
|
||||
QMessageBox::warning(this, tr("Error"), tr("Cannot write file %1:\n%2.").arg(filename).arg(file.errorString()));
|
||||
return;
|
||||
}
|
||||
if (!file.open(QIODevice::WriteOnly)) {
|
||||
QMessageBox::warning(this, tr("Error"), tr("Cannot write file %1:\n%2.").arg(filename).arg(file.errorString()));
|
||||
return;
|
||||
}
|
||||
QTextStream outputStream(&file);
|
||||
long result = file.write((char*)eeprom, eeprom_size);
|
||||
if (result != eeprom_size) {
|
||||
QMessageBox::warning(this, tr("Error"), tr("Error writing file %1:\n%2.").arg(filename).arg(file.errorString()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
close();
|
||||
|
||||
ProgressDialog progressDialog(this, tr("Write Models and Settings to Radio"), CompanionIcon("write_eeprom.png"));
|
||||
|
||||
// backup previous EEPROM if requested
|
||||
QString backupFilename;
|
||||
QString backupPath;
|
||||
if (ui->backupBeforeWrite->isChecked()) {
|
||||
backupPath = g.profile[g.id()].pBackupDir();
|
||||
if (backupPath.isEmpty()) {
|
||||
backupPath=g.backupDir();
|
||||
}
|
||||
backupFilename = backupPath + "/backup-" + QDateTime().currentDateTime().toString("yyyy-MM-dd-HHmmss") + ".bin";
|
||||
}
|
||||
else if (ui->checkFirmwareCompatibility->isChecked()) {
|
||||
backupFilename = generateProcessUniqueTempFileName("eeprom.bin");
|
||||
}
|
||||
if (!backupFilename.isEmpty()) {
|
||||
if (!readEeprom(backupFilename, progressDialog.progress())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// check EEPROM compatibility if requested
|
||||
if (ui->checkFirmwareCompatibility->isChecked()) {
|
||||
int eepromVersion = getEEpromVersion(filename);
|
||||
QString firmwareFilename = generateProcessUniqueTempFileName("flash.bin");
|
||||
if (!readFirmware(firmwareFilename, progressDialog.progress()))
|
||||
return;
|
||||
QString compatEEprom = generateProcessUniqueTempFileName("compat.bin");
|
||||
if (convertEEprom(filename, compatEEprom, firmwareFilename)) {
|
||||
int compatVersion = getEEpromVersion(compatEEprom);
|
||||
if ((compatVersion / 100) != (eepromVersion / 100)) {
|
||||
QMessageBox::warning(this, tr("Warning"), tr("The radio firmware belongs to another product family, check file and preferences!"));
|
||||
return;
|
||||
}
|
||||
else if (compatVersion < eepromVersion) {
|
||||
QMessageBox::warning(this, tr("Warning"), tr("The radio firmware is outdated, please upgrade!"));
|
||||
return;
|
||||
}
|
||||
filename = compatEEprom;
|
||||
}
|
||||
else if (QMessageBox::question(this, "Error", tr("Cannot check Models and Settings compatibility! Continue anyway?"), QMessageBox::Yes|QMessageBox::No) == QMessageBox::No) {
|
||||
return;
|
||||
}
|
||||
qunlink(firmwareFilename);
|
||||
}
|
||||
|
||||
// and write...
|
||||
writeEeprom(filename, progressDialog.progress());
|
||||
|
||||
progressDialog.exec();
|
||||
}
|
||||
|
||||
void FlashEEpromDialog::on_cancelButton_clicked()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
void FlashEEpromDialog::shrink()
|
||||
{
|
||||
resize(0, 0);
|
||||
}
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
#ifndef FLASHEEPROMDIALOG_H_
|
||||
#define FLASHEEPROMDIALOG_H_
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
#define ER9X_EEPROM_FILE_TYPE "ER9X_EEPROM_FILE"
|
||||
#define EEPE_EEPROM_FILE_HEADER "EEPE EEPROM FILE"
|
||||
#define HEX_FILES_FILTER "HEX files (*.hex);;"
|
||||
#define BIN_FILES_FILTER "BIN files (*.bin);;"
|
||||
#define EXTERNAL_EEPROM_FILES_FILTER "EEPROM files (*.bin *.hex);;" BIN_FILES_FILTER HEX_FILES_FILTER
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class FlashEEpromDialog;
|
||||
}
|
||||
|
||||
class RadioData;
|
||||
|
||||
class FlashEEpromDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit FlashEEpromDialog(QWidget *parent, const QString &fileName="");
|
||||
~FlashEEpromDialog();
|
||||
|
||||
private slots:
|
||||
void on_eepromLoad_clicked();
|
||||
void on_burnButton_clicked();
|
||||
void on_cancelButton_clicked();
|
||||
void shrink();
|
||||
|
||||
protected:
|
||||
void updateUI();
|
||||
bool isValidEEprom(const QString &filename);
|
||||
int getEEpromVersion(const QString &filename);
|
||||
bool patchCalibration();
|
||||
bool patchHardwareSettings();
|
||||
|
||||
private:
|
||||
Ui::FlashEEpromDialog *ui;
|
||||
QString eepromFilename;
|
||||
RadioData *radioData;
|
||||
};
|
||||
|
||||
#endif // FLASHEEPROMDIALOG_H_
|
||||
@@ -1,198 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>FlashEEpromDialog</class>
|
||||
<widget class="QDialog" name="FlashEEpromDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>399</width>
|
||||
<height>201</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Write Models and Settings to Radio</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="companion.qrc">
|
||||
<normaloff>:/themes/classic/16/write_eeprom.png</normaloff>:/themes/classic/16/write_eeprom.png</iconset>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="filanameLayout">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="eepromFilename">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>250</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="eepromLoad">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Load...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="profileLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Current Profile</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkFirmwareCompatibility">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Allows Companion to write to older version of the firmware</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Check Firmware compatibility</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="backupBeforeWrite">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Saves a dated copy of your eeprom to the backup folder you specified in the Companion settings before writing the current model to the radio.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Backup before Write</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="patchCalibration">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Modify calibration parameters using settings from current profile</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Patch calibration setting from profile</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="patchHardwareSettings">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Modify HW parameters using settings from current profile</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Patch HW settings from profile</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="buttonsLayout">
|
||||
<item>
|
||||
<spacer name="spacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="cancelButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="burnButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Write to TX</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>burnButton</tabstop>
|
||||
<tabstop>eepromFilename</tabstop>
|
||||
<tabstop>eepromLoad</tabstop>
|
||||
<tabstop>cancelButton</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="companion.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -1,319 +0,0 @@
|
||||
#include "flashfirmwaredialog.h"
|
||||
#include "ui_flashfirmwaredialog.h"
|
||||
#include "appdata.h"
|
||||
#include "converteeprom.h"
|
||||
#include "eeprominterface.h"
|
||||
#include "firmwareinterface.h"
|
||||
#include "process_flash.h"
|
||||
#include "helpers.h"
|
||||
#include "hexinterface.h"
|
||||
#include "progressdialog.h"
|
||||
#include "radiointerface.h"
|
||||
#include "progresswidget.h"
|
||||
#include "splashlibrarydialog.h"
|
||||
|
||||
#if defined WIN32 || !defined __GNUC__
|
||||
#include <windows.h>
|
||||
#define sleep(x) Sleep(x*1000)
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
FlashFirmwareDialog::FlashFirmwareDialog(QWidget *parent):
|
||||
QDialog(parent),
|
||||
ui(new Ui::FlashFirmwareDialog),
|
||||
fwName(g.profile[g.id()].fwName())
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
if (!g.profile[g.id()].splashFile().isEmpty()){
|
||||
imageSource = PROFILE;
|
||||
imageFile = g.profile[g.id()].splashFile();
|
||||
ui->useProfileSplash->setChecked(true);
|
||||
}
|
||||
else {
|
||||
imageSource = FIRMWARE;
|
||||
imageFile = "";
|
||||
ui->useProfileSplash->setDisabled(true);
|
||||
}
|
||||
|
||||
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
|
||||
// No backup on Taranis ... could be done if in massstorage
|
||||
ui->backupEEprom->hide();
|
||||
ui->backupEEprom->setCheckState(Qt::Unchecked);
|
||||
}
|
||||
else {
|
||||
ui->backupEEprom->setCheckState(g.backupOnFlash() ? Qt::Checked : Qt::Unchecked);
|
||||
}
|
||||
|
||||
QString backupPath = g.profile[g.id()].pBackupDir();
|
||||
if (backupPath.isEmpty()) {
|
||||
backupPath=g.backupDir();
|
||||
}
|
||||
if (backupPath.isEmpty() || !QDir(backupPath).exists()) {
|
||||
ui->backupEEprom->setEnabled(false);
|
||||
}
|
||||
|
||||
ui->checkHardwareCompatibility->setChecked(g.checkHardwareCompatibility());
|
||||
|
||||
updateUI();
|
||||
|
||||
resize(0, 0); // TODO needed?
|
||||
}
|
||||
|
||||
FlashFirmwareDialog::~FlashFirmwareDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void FlashFirmwareDialog::updateUI()
|
||||
{
|
||||
ui->firmwareFilename->setText(fwName);
|
||||
ui->burnButton->setEnabled(QFile(fwName).exists());
|
||||
|
||||
FirmwareInterface firmware(fwName);
|
||||
if (firmware.isValid()) {
|
||||
ui->firmwareInfoFrame->show();
|
||||
ui->date->setText(firmware.getDate() + " " + firmware.getTime());
|
||||
ui->version->setText(firmware.getVersion());
|
||||
ui->variant->setText(firmware.getEEpromId());
|
||||
ui->date->setEnabled(true);
|
||||
ui->version->setEnabled(true);
|
||||
ui->variant->setEnabled(true);
|
||||
if (firmware.hasSplash()) {
|
||||
ui->splashFrame->show();
|
||||
ui->splash->setFixedSize(firmware.getSplashWidth(), firmware.getSplashHeight());
|
||||
}
|
||||
else {
|
||||
ui->splashFrame->hide();
|
||||
}
|
||||
}
|
||||
else {
|
||||
imageSource = FIRMWARE;
|
||||
ui->firmwareInfoFrame->hide();
|
||||
ui->splashFrame->hide();
|
||||
}
|
||||
|
||||
QImage image;
|
||||
switch(imageSource) {
|
||||
case FIRMWARE:
|
||||
ui->useFirmwareSplash->setChecked(true);
|
||||
image = firmware.getSplash();
|
||||
break;
|
||||
case PROFILE:
|
||||
ui->useProfileSplash->setChecked(true);
|
||||
image.load(g.profile[g.id()].splashFile());
|
||||
break;
|
||||
case LIBRARY:
|
||||
ui->useLibrarySplash->setChecked(true);
|
||||
image.load(imageFile);
|
||||
break;
|
||||
case EXTERNAL:
|
||||
ui->useExternalSplash->setChecked(true);
|
||||
image.load(imageFile);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!image.isNull()) {
|
||||
ui->splash->setPixmap(makePixMap(image, g.profile[g.id()].fwType()));
|
||||
}
|
||||
}
|
||||
|
||||
void FlashFirmwareDialog::on_firmwareLoad_clicked()
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Open Firmware File"), g.flashDir(), FLASH_FILES_FILTER);
|
||||
if (!fileName.isEmpty()) {
|
||||
fwName = fileName;
|
||||
if (!fwName.isEmpty() && !FirmwareInterface(fwName).isValid()) {
|
||||
QMessageBox::warning(this, tr("Warning"), tr("%1 may not be a valid firmware file").arg(fwName));
|
||||
}
|
||||
updateUI();
|
||||
}
|
||||
}
|
||||
|
||||
void FlashFirmwareDialog::on_useFirmwareSplash_clicked()
|
||||
{
|
||||
FirmwareInterface firmware(fwName);
|
||||
if (!firmware.isValid()) {
|
||||
QMessageBox::warning(this, tr("Error"), tr( "The firmware file is not valid." ));
|
||||
}
|
||||
else if (!firmware.hasSplash()) {
|
||||
QMessageBox::warning(this, tr("Error"), tr( "There is no start screen image in the firmware file." ));
|
||||
}
|
||||
else {
|
||||
imageSource = FIRMWARE;
|
||||
}
|
||||
updateUI();
|
||||
}
|
||||
|
||||
void FlashFirmwareDialog::on_useProfileSplash_clicked()
|
||||
{
|
||||
QString fileName = g.profile[g.id()].splashFile();
|
||||
if (!fileName.isEmpty()) {
|
||||
QImage image(fileName);
|
||||
if (image.isNull()) {
|
||||
QMessageBox::critical(this, tr("Error"), tr("Profile image %1 is invalid.").arg(fileName));
|
||||
}
|
||||
else {
|
||||
imageSource = PROFILE;
|
||||
}
|
||||
}
|
||||
updateUI();
|
||||
}
|
||||
|
||||
void FlashFirmwareDialog::on_useExternalSplash_clicked()
|
||||
{
|
||||
QString supportedImageFormats;
|
||||
for (int formatIndex = 0; formatIndex < QImageReader::supportedImageFormats().count(); formatIndex++) {
|
||||
supportedImageFormats += QLatin1String(" *.") + QImageReader::supportedImageFormats()[formatIndex];
|
||||
}
|
||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Open image file to use as radio start screen"), g.imagesDir(), tr("Images (%1)").arg(supportedImageFormats));
|
||||
if (!fileName.isEmpty()){
|
||||
g.imagesDir( QFileInfo(fileName).dir().absolutePath() );
|
||||
QImage image(fileName);
|
||||
if (image.isNull()) {
|
||||
QMessageBox::critical(this, tr("Error"), tr("Image could not be loaded from %1").arg(fileName));
|
||||
}
|
||||
else{
|
||||
imageSource = EXTERNAL;
|
||||
imageFile = fileName;
|
||||
}
|
||||
}
|
||||
updateUI();
|
||||
}
|
||||
|
||||
void FlashFirmwareDialog::on_useLibrarySplash_clicked()
|
||||
{
|
||||
QString fileName;
|
||||
SplashLibraryDialog *ld = new SplashLibraryDialog(this, &fileName);
|
||||
ld->exec();
|
||||
if (!fileName.isEmpty()) {
|
||||
QImage image(fileName);
|
||||
if (image.isNull()) {
|
||||
QMessageBox::critical(this, tr("Error"), tr("The library image could not be loaded"));
|
||||
}
|
||||
else {
|
||||
imageSource = LIBRARY;
|
||||
imageFile = fileName;
|
||||
}
|
||||
}
|
||||
updateUI();
|
||||
}
|
||||
|
||||
void FlashFirmwareDialog::on_burnButton_clicked()
|
||||
{
|
||||
g.flashDir(QFileInfo(fwName).dir().absolutePath());
|
||||
g.profile[g.id()].fwName(fwName);
|
||||
g.checkHardwareCompatibility(ui->checkHardwareCompatibility->isChecked());
|
||||
g.backupOnFlash(ui->backupEEprom->isChecked());
|
||||
|
||||
qDebug() << "FlashFirmwareDialog: flashing" << fwName;
|
||||
|
||||
if (imageSource != FIRMWARE) {
|
||||
// load the splash image
|
||||
const QPixmap * pixmap = ui->splash->pixmap();
|
||||
QImage image;
|
||||
if (pixmap) {
|
||||
image = pixmap->toImage().scaled(ui->splash->width(), ui->splash->height());
|
||||
}
|
||||
if (image.isNull()) {
|
||||
QMessageBox::critical(this, tr("Warning"), tr("Splash image not found"));
|
||||
return;
|
||||
}
|
||||
// write the customized firmware
|
||||
QString tempFile;
|
||||
if (getFileType(fwName) == FILE_TYPE_HEX)
|
||||
tempFile = generateProcessUniqueTempFileName("flash.hex");
|
||||
else
|
||||
tempFile = generateProcessUniqueTempFileName("flash.bin");
|
||||
qDebug() << "FlashFirmwareDialog: patching" << fwName << "with custom splash screen and saving to" << tempFile;
|
||||
FirmwareInterface firmware(fwName);
|
||||
firmware.setSplash(image);
|
||||
if (firmware.save(tempFile) <= 0) {
|
||||
QMessageBox::critical(this, tr("Warning"), tr("Cannot save customized firmware"));
|
||||
return;
|
||||
}
|
||||
startFlash(tempFile);
|
||||
}
|
||||
else {
|
||||
startFlash(fwName);
|
||||
}
|
||||
}
|
||||
|
||||
void FlashFirmwareDialog::on_cancelButton_clicked()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
void FlashFirmwareDialog::shrink()
|
||||
{
|
||||
resize(0, 0);
|
||||
}
|
||||
|
||||
void FlashFirmwareDialog::startFlash(const QString &filename)
|
||||
{
|
||||
bool backup = g.backupOnFlash();
|
||||
|
||||
close();
|
||||
|
||||
ProgressDialog progressDialog(this, tr("Write Firmware to Radio"), CompanionIcon("write_flash.png"));
|
||||
|
||||
// check hardware compatibility if requested
|
||||
if (g.checkHardwareCompatibility()) {
|
||||
QString tempFirmware = generateProcessUniqueTempFileName("flash-check.bin");
|
||||
if (!readFirmware(tempFirmware, progressDialog.progress())) {
|
||||
QMessageBox::warning(this, tr("Firmware check failed"), tr("Could not check firmware from radio"));
|
||||
return;
|
||||
}
|
||||
FirmwareInterface previousFirmware(tempFirmware);
|
||||
qunlink(tempFirmware);
|
||||
FirmwareInterface newFirmware(filename);
|
||||
qDebug() << "startFlash: checking firmware compatibility between " << tempFirmware << "and" << filename;
|
||||
if (!newFirmware.isHardwareCompatible(previousFirmware)) {
|
||||
QMessageBox::warning(this, tr("Firmware check failed"), tr("New firmware is not compatible with the one currently installed!"));
|
||||
if (isTempFileName(filename)) {
|
||||
qDebug() << "startFlash: removing temporary file" << filename;
|
||||
qunlink(filename);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// backup if requested
|
||||
bool result = true;
|
||||
QString backupFilename;
|
||||
QString backupPath;
|
||||
if (backup) {
|
||||
backupPath = g.profile[g.id()].pBackupDir();
|
||||
if (backupPath.isEmpty()) {
|
||||
backupPath=g.backupDir();
|
||||
}
|
||||
backupFilename = backupPath + "/backup-" + QDateTime().currentDateTime().toString("yyyy-MM-dd-HHmmss") + ".bin";
|
||||
result = readEeprom(backupFilename, progressDialog.progress());
|
||||
sleep(2);
|
||||
}
|
||||
|
||||
// flash
|
||||
result = (result && writeFirmware(filename, progressDialog.progress()));
|
||||
|
||||
// restore if backup requested
|
||||
if (backup && result) {
|
||||
sleep(2);
|
||||
QString restoreFilename = generateProcessUniqueTempFileName("restore.bin");
|
||||
if (!convertEEprom(backupFilename, restoreFilename, filename)) {
|
||||
QMessageBox::warning(this, tr("Conversion failed"), tr("Cannot convert Models and Settings for use with this firmware, original data will be used"));
|
||||
restoreFilename = backupFilename;
|
||||
}
|
||||
if (!writeEeprom(restoreFilename, progressDialog.progress())) {
|
||||
QMessageBox::warning(this, tr("Restore failed"), tr("Could not restore Models and Settings to Radio. The models and settings data file can be found at: %1").arg(backupFilename));
|
||||
}
|
||||
}
|
||||
|
||||
progressDialog.progress()->setInfo(tr("Flashing done"));
|
||||
progressDialog.exec();
|
||||
|
||||
if (isTempFileName(filename)) {
|
||||
qDebug() << "startFlash: removing temporary file" << filename;
|
||||
qunlink(filename);
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
#ifndef FLASH_FIRMWARE_DIALOG_H
|
||||
#define FLASH_FIRMWARE_DIALOG_H
|
||||
|
||||
#include <QtGui>
|
||||
#include <QDialog>
|
||||
#include "eeprominterface.h"
|
||||
#include "firmwareinterface.h"
|
||||
#include "xmlinterface.h"
|
||||
|
||||
#define HEX_FILES_FILTER "HEX files (*.hex);;"
|
||||
#define BIN_FILES_FILTER "BIN files (*.bin);;"
|
||||
#define EEPE_FILES_FILTER "EEPE EEPROM files (*.eepe);;"
|
||||
#define EEPROM_FILES_FILTER "EEPE files (*.eepe *.bin *.hex);;" EEPE_FILES_FILTER BIN_FILES_FILTER HEX_FILES_FILTER
|
||||
#define FLASH_FILES_FILTER "FLASH files (*.bin *.hex);;" BIN_FILES_FILTER HEX_FILES_FILTER
|
||||
#define EXTERNAL_EEPROM_FILES_FILTER "EEPROM files (*.bin *.hex);;" BIN_FILES_FILTER HEX_FILES_FILTER
|
||||
#define ER9X_EEPROM_FILE_TYPE "ER9X_EEPROM_FILE"
|
||||
#define EEPE_EEPROM_FILE_HEADER "EEPE EEPROM FILE"
|
||||
#define EEPE_MODEL_FILE_HEADER "EEPE MODEL FILE"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class FlashFirmwareDialog;
|
||||
}
|
||||
|
||||
class FlashFirmwareDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FlashFirmwareDialog(QWidget *parent = 0);
|
||||
~FlashFirmwareDialog();
|
||||
|
||||
private slots:
|
||||
void on_firmwareLoad_clicked();
|
||||
void on_burnButton_clicked();
|
||||
void on_cancelButton_clicked();
|
||||
void on_useProfileSplash_clicked();
|
||||
void on_useFirmwareSplash_clicked();
|
||||
void on_useLibrarySplash_clicked();
|
||||
void on_useExternalSplash_clicked();
|
||||
void shrink();
|
||||
|
||||
protected:
|
||||
void updateUI();
|
||||
void startFlash(const QString &filename);
|
||||
|
||||
private:
|
||||
Ui::FlashFirmwareDialog *ui;
|
||||
QString fwName;
|
||||
RadioData radioData;
|
||||
enum ImageSource {FIRMWARE, PROFILE, LIBRARY, EXTERNAL};
|
||||
ImageSource imageSource;
|
||||
QString imageFile;
|
||||
};
|
||||
|
||||
#endif // FLASH_FIRMWARE_DIALOG_H
|
||||
@@ -1,321 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>FlashFirmwareDialog</class>
|
||||
<widget class="QDialog" name="FlashFirmwareDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>421</width>
|
||||
<height>375</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Flash Firmware</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="companion.qrc">
|
||||
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout2">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="firmwareFilename">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>250</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="firmwareLoad">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Load...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="firmwareInfoFrame">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="dateLabel">
|
||||
<property name="text">
|
||||
<string>Date & Time</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="version">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="buildLabel">
|
||||
<property name="text">
|
||||
<string>Variant</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="variant">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="versionLabel">
|
||||
<property name="text">
|
||||
<string>Version</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="date">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="splashFrame">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="useProfileSplash">
|
||||
<property name="text">
|
||||
<string>Use profile start screen</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="useFirmwareSplash">
|
||||
<property name="text">
|
||||
<string>Use firmware start screen</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="useLibrarySplash">
|
||||
<property name="text">
|
||||
<string>Use library start screen</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="useExternalSplash">
|
||||
<property name="text">
|
||||
<string>Use another start screen</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="splash">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>128</width>
|
||||
<height>64</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>214</width>
|
||||
<height>66</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Panel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkHardwareCompatibility">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Allows Companion to write to older version of the firmware</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Check Hardware compatibility</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="backupEEprom">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Backup and restore Models and Settings</string>
|
||||
</property>
|
||||
<property name="tristate">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="spacer2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout1">
|
||||
<item>
|
||||
<spacer name="spacer1">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="cancelButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="burnButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Write to TX</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>burnButton</tabstop>
|
||||
<tabstop>firmwareFilename</tabstop>
|
||||
<tabstop>firmwareLoad</tabstop>
|
||||
<tabstop>version</tabstop>
|
||||
<tabstop>variant</tabstop>
|
||||
<tabstop>cancelButton</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="companion.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -1,36 +0,0 @@
|
||||
#include "fusesdialog.h"
|
||||
#include "ui_fusesdialog.h"
|
||||
#include "helpers.h"
|
||||
#include "progressdialog.h"
|
||||
#include "radiointerface.h"
|
||||
|
||||
FusesDialog::FusesDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::FusesDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setWindowIcon(CompanionIcon("fuses.png"));
|
||||
}
|
||||
|
||||
FusesDialog::~FusesDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void FusesDialog::on_resetFuses_EEprotect_clicked()
|
||||
{
|
||||
ProgressDialog progressDialog(this, tr("Reset Radio Fuses"), CompanionIcon("fuses.png"), true);
|
||||
return resetAvrdudeFuses(true, progressDialog.progress());
|
||||
}
|
||||
|
||||
void FusesDialog::on_resetFuses_EEdelete_clicked()
|
||||
{
|
||||
ProgressDialog progressDialog(this, tr("Reset Radio Fuses"), CompanionIcon("fuses.png"), true);
|
||||
return resetAvrdudeFuses(false, progressDialog.progress());
|
||||
}
|
||||
|
||||
void FusesDialog::on_readFuses_clicked()
|
||||
{
|
||||
ProgressDialog progressDialog(this, tr("Read Fuses from Radio"), CompanionIcon("fuses.png"), true);
|
||||
return readAvrdudeFuses(progressDialog.progress());
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
#ifndef FUSESDIALOG_H_
|
||||
#define FUSESDIALOG_H_
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class FusesDialog;
|
||||
}
|
||||
|
||||
class FusesDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit FusesDialog(QWidget *parent = 0);
|
||||
~FusesDialog();
|
||||
|
||||
private slots:
|
||||
void on_readFuses_clicked();
|
||||
void on_resetFuses_EEdelete_clicked();
|
||||
void on_resetFuses_EEprotect_clicked();
|
||||
|
||||
private:
|
||||
Ui::FusesDialog *ui;
|
||||
|
||||
};
|
||||
|
||||
#endif // FUSESDIALOG_H_
|
||||
@@ -1,118 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>FusesDialog</class>
|
||||
<widget class="QDialog" name="FusesDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>374</width>
|
||||
<height>207</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Fuses</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QPushButton" name="readFuses">
|
||||
<property name="whatsThis">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt;">Reads the current fuses in the AVR controller.</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:8pt;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt;">Proper states for </span><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt;">AtMega 64 </span><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt;">:</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt;">EEPROM erase fuse not set: 0E, 81, FF</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt;">EEPROM erase fuse set: 0E, 89, FF</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:8pt;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt;">Proper states for AtMega 2560 :</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt;">EEPROM erase fuse not set: D7, 11, FC</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt;">EEPROM erase fuse set: D7, 19, FC</span></p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Read Fuses</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QPushButton" name="resetFuses_EEprotect">
|
||||
<property name="whatsThis">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt; font-weight:600; text-decoration: underline;">Reset Fuses</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt;">Fuses in the AVR tell it how to behave. Pressing this button sets the fuses to the default parameters needed in the FW. These parameters are different for stock and 4.1 MB, please verify you selected the appropriate processor type in preferences.</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:8pt;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt;">This button also sets the &quot;EEPROM protect&quot; Fuse.</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt;">This prevents erasing of the EEPROM when the flash memory is written.</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:8pt;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt; font-weight:600; text-decoration: underline;">WARNING</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt;">Setting fuses can lead to problems and even a total lockout from your controller. Do this only if you know what you are doing.</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:8pt;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt;">When in doubt consult either the project's page or the 9xforum (http://9xforums.com/forum/)</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt;">If you do get locked out - google lookup for &quot;dealing with Fuse Bricks&quot;.</span></p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Reset Fuses
|
||||
EEPROM - PROTECT</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QPushButton" name="resetFuses_EEdelete">
|
||||
<property name="whatsThis">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt; font-weight:600; text-decoration: underline;">Reset Fuses</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt;">Fuses in the AVR tell it how to behave. Pressing this button sets the fuses to the default parameters needed in the </span><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt;">FW. These parameters are different for stock and 4.1 MB, please verify you selected the appropriate processor type in preferences.</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:8pt;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt;">This button also clears the &quot;EEPROM protect&quot; Fuse.</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt;">This causes erasing of the EEPROM when the flash memory is written.</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:8pt;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt; font-weight:600; text-decoration: underline;">WARNING</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt;">Setting fuses can lead to problems and even a total lockout from your controller. Do this only if you know what you are doing.</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:8pt;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt;">When in doubt consult either the project's page or the 9xforum (http://9xforums.com/forum/)</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt;">If you do get locked out - google lookup for &quot;dealing with Fuse Bricks&quot;.</span></p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Reset Fuses
|
||||
EEPROM - DELETE</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Panel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;">
|
||||
<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600; text-decoration: underline;">WARNING</span></p>
|
||||
<p align="center" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-weight:600; text-decoration: underline;"></p>
|
||||
<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Changing the fuses can mess up your radio.</p>
|
||||
<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Proceed only if you know what you are doing.</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="companion.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -1,63 +0,0 @@
|
||||
#include "fwpreferencesdialog.h"
|
||||
#include "ui_fwpreferencesdialog.h"
|
||||
#include "mainwindow.h"
|
||||
#include "eeprominterface.h"
|
||||
#include "helpers.h"
|
||||
#include "appdata.h"
|
||||
#include <QDesktopServices>
|
||||
#include <QtGui>
|
||||
|
||||
FirmwarePreferencesDialog::FirmwarePreferencesDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::FirmwarePreferencesDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setWindowIcon(CompanionIcon("fwpreferences.png"));
|
||||
initSettings();
|
||||
|
||||
foreach(const char *lang, GetCurrentFirmware()->getFirmwareBase()->ttslanguages) {
|
||||
ui->voiceCombo->addItem(lang);
|
||||
if (current_firmware_variant->getId().contains(QString("-tts%1").arg(lang)))
|
||||
ui->voiceCombo->setCurrentIndex(ui->voiceCombo->count() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
FirmwarePreferencesDialog::~FirmwarePreferencesDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void FirmwarePreferencesDialog::initSettings()
|
||||
{
|
||||
ui->fwTypeLbl->setText(g.profile[g.id()].fwType());
|
||||
int version = g.fwRev.get(g.profile[g.id()].fwType());
|
||||
if (version > 0) {
|
||||
ui->lastRevisionLbl->setText(index2version(version));
|
||||
}
|
||||
}
|
||||
|
||||
void FirmwarePreferencesDialog::on_checkFWUpdates_clicked()
|
||||
{
|
||||
MainWindow * mw = (MainWindow *)this->parent();
|
||||
mw->checkForFirmwareUpdate();
|
||||
initSettings();
|
||||
}
|
||||
|
||||
void FirmwarePreferencesDialog::on_fw_dnld_clicked()
|
||||
{
|
||||
MainWindow * mw = (MainWindow *)this->parent();
|
||||
mw->dowloadLastFirmwareUpdate();
|
||||
initSettings();
|
||||
}
|
||||
|
||||
void FirmwarePreferencesDialog::on_voice_dnld_clicked()
|
||||
{
|
||||
QString url = "http://voices-21.open-tx.org/";
|
||||
QString fwType = g.profile[g.id()].fwType();
|
||||
QStringList list = fwType.split("-");
|
||||
QString firmware = QString("%1-%2").arg(list[0]).arg(list[1]);
|
||||
url.append(QString("%1/%2/").arg(firmware).arg(ui->voiceCombo->currentText().toLower()));
|
||||
QDesktopServices::openUrl(url);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
#ifndef FWPREFERENCESDIALOG_H
|
||||
#define FWPREFERENCESDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QCheckBox>
|
||||
#include "eeprominterface.h"
|
||||
|
||||
namespace Ui {
|
||||
class FirmwarePreferencesDialog;
|
||||
}
|
||||
|
||||
class Joystick;
|
||||
|
||||
class FirmwarePreferencesDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit FirmwarePreferencesDialog(QWidget *parent = 0);
|
||||
~FirmwarePreferencesDialog();
|
||||
|
||||
private:
|
||||
Ui::FirmwarePreferencesDialog *ui;
|
||||
void initSettings();
|
||||
|
||||
private slots:
|
||||
void on_fw_dnld_clicked();
|
||||
void on_voice_dnld_clicked();
|
||||
void on_checkFWUpdates_clicked();
|
||||
};
|
||||
|
||||
#endif // FWPREFERENCESDIALOG_H
|
||||
@@ -1,207 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>FirmwarePreferencesDialog</class>
|
||||
<widget class="QDialog" name="FirmwarePreferencesDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>416</width>
|
||||
<height>154</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Downloads</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="verticalSpacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="24" column="5">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="5">
|
||||
<widget class="QPushButton" name="checkFWUpdates">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Check for updates</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="voiceLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Sans Serif</family>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Voice</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="2">
|
||||
<widget class="QComboBox" name="voiceCombo">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Set voice language.
|
||||
May be different from firmware language</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="5">
|
||||
<widget class="QPushButton" name="voice_dnld">
|
||||
<property name="text">
|
||||
<string>Download Voice</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="5">
|
||||
<widget class="QPushButton" name="fw_dnld">
|
||||
<property name="text">
|
||||
<string>Download FW</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="3">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="6">
|
||||
<widget class="Line" name="voiceLine">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="23" column="0" colspan="6">
|
||||
<widget class="Line" name="line_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Sans Serif</family>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Firmware</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" colspan="4">
|
||||
<widget class="QLabel" name="fwTypeLbl">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">FwType</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2" colspan="2">
|
||||
<widget class="QLabel" name="lastRevisionLbl">
|
||||
<property name="text">
|
||||
<string notr="true">-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Latest Download</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>checkFWUpdates</tabstop>
|
||||
<tabstop>fw_dnld</tabstop>
|
||||
<tabstop>voiceCombo</tabstop>
|
||||
<tabstop>voice_dnld</tabstop>
|
||||
<tabstop>buttonBox</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="companion.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>FirmwarePreferencesDialog</receiver>
|
||||
<slot>close()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>345</x>
|
||||
<y>133</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>207</x>
|
||||
<y>76</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
@@ -1,30 +0,0 @@
|
||||
include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
set(generaledit_NAMES
|
||||
generaledit
|
||||
generalsetup
|
||||
trainer
|
||||
hardware
|
||||
)
|
||||
|
||||
set(generaledit_SRCS
|
||||
calibration.cpp
|
||||
)
|
||||
|
||||
set(generaledit_HDRS
|
||||
calibration.h
|
||||
)
|
||||
|
||||
set(generaledit_UIS
|
||||
)
|
||||
|
||||
foreach(name ${generaledit_NAMES})
|
||||
set(generaledit_SRCS ${generaledit_SRCS} ${name}.cpp)
|
||||
set(generaledit_HDRS ${generaledit_HDRS} ${name}.h)
|
||||
set(generaledit_UIS ${generaledit_UIS} ${name}.ui)
|
||||
endforeach()
|
||||
|
||||
qt4_wrap_ui(generaledit_SRCS ${generaledit_UIS})
|
||||
qt4_wrap_cpp(generaledit_SRCS ${generaledit_HDRS})
|
||||
|
||||
add_library(generaledit ${generaledit_SRCS})
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user