mirror of
https://github.com/opentx/opentx.git
synced 2025-07-14 20:10:08 +03:00
Indentation fixed so that cpplint is ok
This commit is contained in:
parent
933f866e93
commit
d465ee80a2
10 changed files with 125 additions and 154 deletions
|
@ -227,7 +227,7 @@ void audioQueue::event(uint8_t e, uint8_t f)
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
const static pm_uint8_t singleSounds[] PROGMEM = {
|
static const pm_uint8_t singleSounds[] PROGMEM = {
|
||||||
70, 10, 2, PLAY_REPEAT(2)|PLAY_NOW, // INACTIVITY
|
70, 10, 2, PLAY_REPEAT(2)|PLAY_NOW, // INACTIVITY
|
||||||
BEEP_DEFAULT_FREQ, 40, 1, PLAY_NOW, // ERROR
|
BEEP_DEFAULT_FREQ, 40, 1, PLAY_NOW, // ERROR
|
||||||
BEEP_KEY_UP_FREQ, 10, 1, PLAY_NOW, // KEYPAD_UP
|
BEEP_KEY_UP_FREQ, 10, 1, PLAY_NOW, // KEYPAD_UP
|
||||||
|
|
|
@ -545,52 +545,24 @@ void ee32_process()
|
||||||
Eeprom32_process_state = E32_READSENDING ;
|
Eeprom32_process_state = E32_READSENDING ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( Eeprom32_process_state == E32_READSENDING )
|
if (Eeprom32_process_state == E32_READSENDING) {
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
if ( Spi_complete )
|
|
||||||
{
|
|
||||||
uint32_t blank = 1 ;
|
|
||||||
x = Eeprom32_data_size + sizeof( struct t_eeprom_header ) ; // Size needing to be checked
|
|
||||||
p = (uint8_t *) &Eeprom_buffer ;
|
|
||||||
while ( x )
|
|
||||||
{
|
|
||||||
if ( *p++ != 0xFF )
|
|
||||||
{
|
|
||||||
blank = 0 ;
|
|
||||||
break ;
|
|
||||||
}
|
|
||||||
x -= 1 ;
|
|
||||||
}
|
|
||||||
// If not blank, sort erasing here
|
|
||||||
if ( blank )
|
|
||||||
{
|
|
||||||
Eeprom32_state_after_erase = E32_IDLE ; // TODO really needed?
|
|
||||||
Eeprom32_process_state = E32_WRITESTART ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
#endif
|
|
||||||
#ifdef SIMU
|
#ifdef SIMU
|
||||||
Eeprom32_process_state = E32_WRITESTART ;
|
Eeprom32_process_state = E32_WRITESTART ;
|
||||||
#else
|
#else
|
||||||
eeAddress = Eeprom32_address ;
|
eeAddress = Eeprom32_address ;
|
||||||
eeprom_write_enable() ;
|
eeprom_write_enable() ;
|
||||||
p = Spi_tx_buf ;
|
p = Spi_tx_buf ;
|
||||||
*p = 0x20 ; // Block Erase command
|
*p = 0x20 ; // Block Erase command
|
||||||
*(p+1) = eeAddress >> 16 ;
|
*(p+1) = eeAddress >> 16 ;
|
||||||
*(p+2) = eeAddress >> 8 ;
|
*(p+2) = eeAddress >> 8 ;
|
||||||
*(p+3) = eeAddress ; // 3 bytes address
|
*(p+3) = eeAddress ; // 3 bytes address
|
||||||
spi_PDC_action( p, 0, 0, 4, 0 ) ;
|
spi_PDC_action( p, 0, 0, 4, 0 ) ;
|
||||||
Eeprom32_process_state = E32_ERASESENDING ;
|
Eeprom32_process_state = E32_ERASESENDING ;
|
||||||
Eeprom32_state_after_erase = E32_WRITESTART ;
|
Eeprom32_state_after_erase = E32_WRITESTART ;
|
||||||
#endif
|
#endif
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( Eeprom32_process_state == E32_WRITESTART )
|
if (Eeprom32_process_state == E32_WRITESTART) {
|
||||||
{
|
|
||||||
uint32_t total_size ;
|
uint32_t total_size ;
|
||||||
p = Eeprom32_source_address;
|
p = Eeprom32_source_address;
|
||||||
q = (uint8_t *) &Eeprom_buffer.data;
|
q = (uint8_t *) &Eeprom_buffer.data;
|
||||||
|
|
|
@ -746,8 +746,7 @@ void RlcFile::nextRlcWriteStep()
|
||||||
|
|
||||||
if (m_rlc_len==0) goto close;
|
if (m_rlc_len==0) goto close;
|
||||||
|
|
||||||
for (i=1; 1; i++) // !! laeuft ein byte zu weit !!
|
for (i=1; 1; i++) { // !! laeuft ein byte zu weit !!
|
||||||
{
|
|
||||||
bool cur0 = m_rlc_buf[i] == 0;
|
bool cur0 = m_rlc_buf[i] == 0;
|
||||||
if (cur0 != run0 || cnt==0x3f || (cnt0 && cnt==0x0f) || i==m_rlc_len) {
|
if (cur0 != run0 || cnt==0x3f || (cnt0 && cnt==0x0f) || i==m_rlc_len) {
|
||||||
if (run0) {
|
if (run0) {
|
||||||
|
@ -782,59 +781,57 @@ void RlcFile::nextRlcWriteStep()
|
||||||
|
|
||||||
close:
|
close:
|
||||||
|
|
||||||
switch(m_write_step) {
|
switch(m_write_step) {
|
||||||
case WRITE_START_STEP:
|
case WRITE_START_STEP: {
|
||||||
{
|
blkid_t fri = 0;
|
||||||
blkid_t fri=0;
|
|
||||||
|
|
||||||
if (m_currBlk && (fri=EeFsGetLink(m_currBlk))) {
|
if (m_currBlk && (fri = EeFsGetLink(m_currBlk))) {
|
||||||
// TODO reuse EeFsFree!!!
|
// TODO reuse EeFsFree!!!
|
||||||
blkid_t prev_freeList = eeFs.freeList;
|
blkid_t prev_freeList = eeFs.freeList;
|
||||||
eeFs.freeList = fri;
|
eeFs.freeList = fri;
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
freeBlocks++;
|
freeBlocks++;
|
||||||
#endif
|
#endif
|
||||||
while( EeFsGetLink(fri)) {
|
while (EeFsGetLink(fri)) {
|
||||||
fri = EeFsGetLink(fri);
|
fri = EeFsGetLink(fri);
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
freeBlocks++;
|
freeBlocks++;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
m_write_step = WRITE_FREE_UNUSED_BLOCKS_STEP1;
|
m_write_step = WRITE_FREE_UNUSED_BLOCKS_STEP1;
|
||||||
EeFsSetLink(fri, prev_freeList);
|
EeFsSetLink(fri, prev_freeList);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
case WRITE_FINAL_DIRENT_STEP:
|
case WRITE_FINAL_DIRENT_STEP: {
|
||||||
{
|
m_currBlk = eeFs.files[FILE_TMP].startBlk;
|
||||||
m_currBlk = eeFs.files[FILE_TMP].startBlk;
|
DirEnt & f = eeFs.files[m_fileId];
|
||||||
DirEnt & f = eeFs.files[m_fileId];
|
eeFs.files[FILE_TMP].startBlk = f.startBlk;
|
||||||
eeFs.files[FILE_TMP].startBlk = f.startBlk;
|
eeFs.files[FILE_TMP].size = f.size;
|
||||||
eeFs.files[FILE_TMP].size = f.size;
|
f.startBlk = m_currBlk;
|
||||||
f.startBlk = m_currBlk;
|
f.size = m_pos;
|
||||||
f.size = m_pos;
|
f.typ = eeFs.files[FILE_TMP].typ;
|
||||||
f.typ = eeFs.files[FILE_TMP].typ;
|
m_write_step = WRITE_TMP_DIRENT_STEP;
|
||||||
m_write_step = WRITE_TMP_DIRENT_STEP;
|
EeFsFlushDirEnt(m_fileId);
|
||||||
EeFsFlushDirEnt(m_fileId);
|
return;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
case WRITE_TMP_DIRENT_STEP:
|
case WRITE_TMP_DIRENT_STEP:
|
||||||
m_write_step = 0;
|
m_write_step = 0;
|
||||||
EeFsFlushDirEnt(FILE_TMP);
|
EeFsFlushDirEnt(FILE_TMP);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case WRITE_FREE_UNUSED_BLOCKS_STEP1:
|
case WRITE_FREE_UNUSED_BLOCKS_STEP1:
|
||||||
m_write_step = WRITE_FREE_UNUSED_BLOCKS_STEP2;
|
m_write_step = WRITE_FREE_UNUSED_BLOCKS_STEP2;
|
||||||
EeFsSetLink(m_currBlk, 0);
|
EeFsSetLink(m_currBlk, 0);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case WRITE_FREE_UNUSED_BLOCKS_STEP2:
|
case WRITE_FREE_UNUSED_BLOCKS_STEP2:
|
||||||
m_write_step = WRITE_FINAL_DIRENT_STEP;
|
m_write_step = WRITE_FINAL_DIRENT_STEP;
|
||||||
EeFsFlushFreelist();
|
EeFsFlushFreelist();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RlcFile::flush()
|
void RlcFile::flush()
|
||||||
|
|
|
@ -161,10 +161,10 @@ inline uint8_t write_errno() { return s_write_err; }
|
||||||
|
|
||||||
class RlcFile: public EFile
|
class RlcFile: public EFile
|
||||||
{
|
{
|
||||||
uint8_t m_bRlc; // control byte for run length decoder
|
uint8_t m_bRlc; // control byte for run length decoder
|
||||||
uint8_t m_zeroes;
|
uint8_t m_zeroes;
|
||||||
|
|
||||||
uint8_t m_flags;
|
uint8_t m_flags;
|
||||||
#define WRITE_FIRST_LINK 0x01
|
#define WRITE_FIRST_LINK 0x01
|
||||||
#define WRITE_NEXT_LINK_1 0x02
|
#define WRITE_NEXT_LINK_1 0x02
|
||||||
#define WRITE_NEXT_LINK_2 0x03
|
#define WRITE_NEXT_LINK_2 0x03
|
||||||
|
@ -173,41 +173,41 @@ class RlcFile: public EFile
|
||||||
#define WRITE_FREE_UNUSED_BLOCKS_STEP2 0x30
|
#define WRITE_FREE_UNUSED_BLOCKS_STEP2 0x30
|
||||||
#define WRITE_FINAL_DIRENT_STEP 0x40
|
#define WRITE_FINAL_DIRENT_STEP 0x40
|
||||||
#define WRITE_TMP_DIRENT_STEP 0x50
|
#define WRITE_TMP_DIRENT_STEP 0x50
|
||||||
uint8_t m_write_step;
|
uint8_t m_write_step;
|
||||||
uint16_t m_rlc_len;
|
uint16_t m_rlc_len;
|
||||||
uint8_t * m_rlc_buf;
|
uint8_t * m_rlc_buf;
|
||||||
uint8_t m_cur_rlc_len;
|
uint8_t m_cur_rlc_len;
|
||||||
uint8_t m_write1_byte;
|
uint8_t m_write1_byte;
|
||||||
uint8_t m_write_len;
|
uint8_t m_write_len;
|
||||||
uint8_t * m_write_buf;
|
uint8_t * m_write_buf;
|
||||||
#if defined (EEPROM_PROGRESS_BAR)
|
#if defined (EEPROM_PROGRESS_BAR)
|
||||||
uint8_t m_ratio;
|
uint8_t m_ratio;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
void openRlc(uint8_t i_fileId);
|
void openRlc(uint8_t i_fileId);
|
||||||
|
|
||||||
void create(uint8_t i_fileId, uint8_t typ, uint8_t sync_write);
|
void create(uint8_t i_fileId, uint8_t typ, uint8_t sync_write);
|
||||||
|
|
||||||
/// copy contents of i_fileSrc to i_fileDst
|
/// copy contents of i_fileSrc to i_fileDst
|
||||||
bool copy(uint8_t i_fileDst, uint8_t i_fileSrc);
|
bool copy(uint8_t i_fileDst, uint8_t i_fileSrc);
|
||||||
|
|
||||||
inline bool isWriting() { return m_write_step != 0; }
|
inline bool isWriting() { return m_write_step != 0; }
|
||||||
void write(uint8_t *buf, uint8_t i_len);
|
void write(uint8_t *buf, uint8_t i_len);
|
||||||
void write1(uint8_t b);
|
void write1(uint8_t b);
|
||||||
void nextWriteStep();
|
void nextWriteStep();
|
||||||
void nextRlcWriteStep();
|
void nextRlcWriteStep();
|
||||||
void writeRlc(uint8_t i_fileId, uint8_t typ, uint8_t *buf, uint16_t i_len, uint8_t sync_write);
|
void writeRlc(uint8_t i_fileId, uint8_t typ, uint8_t *buf, uint16_t i_len, uint8_t sync_write);
|
||||||
|
|
||||||
// flush the current write operation if any
|
// flush the current write operation if any
|
||||||
void flush();
|
void flush();
|
||||||
|
|
||||||
// read from opened file and decode rlc-coded data
|
// read from opened file and decode rlc-coded data
|
||||||
uint16_t readRlc(uint8_t *buf, uint16_t i_len);
|
uint16_t readRlc(uint8_t *buf, uint16_t i_len);
|
||||||
|
|
||||||
#if defined (EEPROM_PROGRESS_BAR)
|
#if defined (EEPROM_PROGRESS_BAR)
|
||||||
void DisplayProgressBar(uint8_t x);
|
void DisplayProgressBar(uint8_t x);
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -829,9 +829,9 @@ enum AdjustGvarFunctionParam {
|
||||||
|
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
#define LEN_CFN_NAME 8
|
#define LEN_CFN_NAME 8
|
||||||
#else
|
#else
|
||||||
#define LEN_CFN_NAME 6
|
#define LEN_CFN_NAME 6
|
||||||
#endif
|
#endif
|
||||||
PACK(typedef struct t_CustomFnData { // Function Switches data
|
PACK(typedef struct t_CustomFnData { // Function Switches data
|
||||||
int8_t swtch;
|
int8_t swtch;
|
||||||
|
|
|
@ -585,24 +585,28 @@ extern uint8_t channel_order(uint8_t x);
|
||||||
class Key
|
class Key
|
||||||
{
|
{
|
||||||
#define FILTERBITS 4
|
#define FILTERBITS 4
|
||||||
|
|
||||||
#ifdef SIMU
|
#ifdef SIMU
|
||||||
#define FFVAL 1
|
#define FFVAL 1
|
||||||
#else
|
#else
|
||||||
#define FFVAL ((1<<FILTERBITS)-1)
|
#define FFVAL ((1<<FILTERBITS)-1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define KSTATE_OFF 0
|
#define KSTATE_OFF 0
|
||||||
#define KSTATE_RPTDELAY 95 // gruvin: delay state before key repeating starts
|
#define KSTATE_RPTDELAY 95 // gruvin: delay state before key repeating starts
|
||||||
#define KSTATE_START 97
|
#define KSTATE_START 97
|
||||||
#define KSTATE_PAUSE 98
|
#define KSTATE_PAUSE 98
|
||||||
#define KSTATE_KILLED 99
|
#define KSTATE_KILLED 99
|
||||||
uint8_t m_vals; // key debounce? 4 = 40ms
|
|
||||||
uint8_t m_cnt;
|
private:
|
||||||
uint8_t m_state;
|
uint8_t m_vals; // key debounce? 4 = 40ms
|
||||||
public:
|
uint8_t m_cnt;
|
||||||
void input(bool val, EnumKeys enuk);
|
uint8_t m_state;
|
||||||
bool state() { return m_vals > 0; }
|
public:
|
||||||
void pauseEvents() { m_state = KSTATE_PAUSE; m_cnt = 0; }
|
void input(bool val, EnumKeys enuk);
|
||||||
void killEvents() { m_state = KSTATE_KILLED; }
|
bool state() { return m_vals > 0; }
|
||||||
|
void pauseEvents() { m_state = KSTATE_PAUSE; m_cnt = 0; }
|
||||||
|
void killEvents() { m_state = KSTATE_KILLED; }
|
||||||
};
|
};
|
||||||
|
|
||||||
extern Key keys[NUM_KEYS];
|
extern Key keys[NUM_KEYS];
|
||||||
|
|
|
@ -51,10 +51,7 @@ extern void rtcdriver_settime(struct gtm * t);
|
||||||
implementations (e.g., UNICOS 9.0 on a Cray Y-MP EL) don't shift
|
implementations (e.g., UNICOS 9.0 on a Cray Y-MP EL) don't shift
|
||||||
right in the usual way when A < 0, so SHR falls back on division if
|
right in the usual way when A < 0, so SHR falls back on division if
|
||||||
ordinary A >> B doesn't seem to be the usual signed shift. */
|
ordinary A >> B doesn't seem to be the usual signed shift. */
|
||||||
#define SHR(a, b) \
|
#define SHR(a, b) (-1 >> 1 == -1 ? (a) >> (b) : (a) / (1 << (b)) - ((a) % (1 << (b)) < 0))
|
||||||
(-1 >> 1 == -1 \
|
|
||||||
? (a) >> (b) \
|
|
||||||
: (a) / (1 << (b)) - ((a) % (1 << (b)) < 0))
|
|
||||||
|
|
||||||
/* The extra casts in the following macros work around compiler bugs,
|
/* The extra casts in the following macros work around compiler bugs,
|
||||||
e.g., in Cray C 5.0.3.0. */
|
e.g., in Cray C 5.0.3.0. */
|
||||||
|
@ -487,7 +484,7 @@ __mktime_internal (struct gtm *tp,
|
||||||
gtime_t
|
gtime_t
|
||||||
gmktime (struct gtm *tp)
|
gmktime (struct gtm *tp)
|
||||||
{
|
{
|
||||||
// no time zone stuff. Just do the math ;)
|
// no time zone stuff. Just do the math ;)
|
||||||
static gtime_t localtime_offset;
|
static gtime_t localtime_offset;
|
||||||
return __mktime_internal (tp, __localtime_r, &localtime_offset);
|
return __mktime_internal (tp, __localtime_r, &localtime_offset);
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,23 +51,24 @@ int g_snapshot_idx = 0;
|
||||||
class Open9xSim: public FXMainWindow
|
class Open9xSim: public FXMainWindow
|
||||||
{
|
{
|
||||||
FXDECLARE(Open9xSim)
|
FXDECLARE(Open9xSim)
|
||||||
public:
|
|
||||||
Open9xSim(){};
|
|
||||||
Open9xSim(FXApp* a);
|
|
||||||
long onKeypress(FXObject*,FXSelector,void*);
|
|
||||||
long onTimeout(FXObject*,FXSelector,void*);
|
|
||||||
void makeSnapshot(const FXDrawable* drawable);
|
|
||||||
void doEvents();
|
|
||||||
void refreshDiplay();
|
|
||||||
|
|
||||||
private:
|
public:
|
||||||
FXImage *bmp;
|
Open9xSim(){};
|
||||||
FXImageFrame *bmf;
|
Open9xSim(FXApp* a);
|
||||||
bool firstTime;
|
long onKeypress(FXObject*,FXSelector,void*);
|
||||||
|
long onTimeout(FXObject*,FXSelector,void*);
|
||||||
|
void makeSnapshot(const FXDrawable* drawable);
|
||||||
|
void doEvents();
|
||||||
|
void refreshDiplay();
|
||||||
|
|
||||||
public:
|
private:
|
||||||
FXSlider *sliders[8];
|
FXImage *bmp;
|
||||||
FXKnob *knobs[NUM_POTS];
|
FXImageFrame *bmf;
|
||||||
|
bool firstTime;
|
||||||
|
|
||||||
|
public:
|
||||||
|
FXSlider *sliders[8];
|
||||||
|
FXKnob *knobs[NUM_POTS];
|
||||||
};
|
};
|
||||||
// Message Map
|
// Message Map
|
||||||
FXDEFMAP(Open9xSim) Open9xSimMap[]={
|
FXDEFMAP(Open9xSim) Open9xSimMap[]={
|
||||||
|
|
|
@ -53,8 +53,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef TEMPLATES_H
|
#ifndef TEMPLATES_H_
|
||||||
#define TEMPLATES_H
|
#define TEMPLATES_H_
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
||||||
|
|
|
@ -124,12 +124,12 @@ extern const pm_char STR_OPEN9X[];
|
||||||
#define OFS_VTELEMCHNS (OFS_FUNCSOUNDS + sizeof(TR_FUNCSOUNDS))
|
#define OFS_VTELEMCHNS (OFS_FUNCSOUNDS + sizeof(TR_FUNCSOUNDS))
|
||||||
#if defined(FRSKY) || defined(CPUARM)
|
#if defined(FRSKY) || defined(CPUARM)
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
#define OFS_VTELEMUNIT_IMP (OFS_VTELEMCHNS + sizeof(TR_VTELEMCHNS))
|
#define OFS_VTELEMUNIT_IMP (OFS_VTELEMCHNS + sizeof(TR_VTELEMCHNS))
|
||||||
#define OFS_VTELEMUNIT_NORM (OFS_VTELEMUNIT_IMP + sizeof(TR_VTELEMUNIT_IMP))
|
#define OFS_VTELEMUNIT_NORM (OFS_VTELEMUNIT_IMP + sizeof(TR_VTELEMUNIT_IMP))
|
||||||
#define OFS_VALARM (OFS_VTELEMUNIT_NORM + sizeof(TR_VTELEMUNIT_NORM))
|
#define OFS_VALARM (OFS_VTELEMUNIT_NORM + sizeof(TR_VTELEMUNIT_NORM))
|
||||||
#else
|
#else
|
||||||
#define OFS_VTELEMUNIT (OFS_VTELEMCHNS + sizeof(TR_VTELEMCHNS))
|
#define OFS_VTELEMUNIT (OFS_VTELEMCHNS + sizeof(TR_VTELEMCHNS))
|
||||||
#define OFS_VALARM (OFS_VTELEMUNIT + sizeof(TR_VTELEMUNIT))
|
#define OFS_VALARM (OFS_VTELEMUNIT + sizeof(TR_VTELEMUNIT))
|
||||||
#endif
|
#endif
|
||||||
#define OFS_VALARMFN (OFS_VALARM + sizeof(TR_VALARM))
|
#define OFS_VALARMFN (OFS_VALARM + sizeof(TR_VALARM))
|
||||||
#define OFS_VTELPROTO (OFS_VALARMFN + sizeof(TR_VALARMFN))
|
#define OFS_VTELPROTO (OFS_VALARMFN + sizeof(TR_VALARMFN))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue