mirror of
https://github.com/opentx/opentx.git
synced 2025-07-15 04:15:26 +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;
|
||||
default:
|
||||
{
|
||||
const static pm_uint8_t singleSounds[] PROGMEM = {
|
||||
static const pm_uint8_t singleSounds[] PROGMEM = {
|
||||
70, 10, 2, PLAY_REPEAT(2)|PLAY_NOW, // INACTIVITY
|
||||
BEEP_DEFAULT_FREQ, 40, 1, PLAY_NOW, // ERROR
|
||||
BEEP_KEY_UP_FREQ, 10, 1, PLAY_NOW, // KEYPAD_UP
|
||||
|
|
|
@ -545,52 +545,24 @@ void ee32_process()
|
|||
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
|
||||
if (Eeprom32_process_state == E32_READSENDING) {
|
||||
#ifdef SIMU
|
||||
Eeprom32_process_state = E32_WRITESTART ;
|
||||
Eeprom32_process_state = E32_WRITESTART ;
|
||||
#else
|
||||
eeAddress = Eeprom32_address ;
|
||||
eeprom_write_enable() ;
|
||||
p = Spi_tx_buf ;
|
||||
*p = 0x20 ; // Block Erase command
|
||||
*(p+1) = eeAddress >> 16 ;
|
||||
*(p+2) = eeAddress >> 8 ;
|
||||
*(p+3) = eeAddress ; // 3 bytes address
|
||||
spi_PDC_action( p, 0, 0, 4, 0 ) ;
|
||||
Eeprom32_process_state = E32_ERASESENDING ;
|
||||
Eeprom32_state_after_erase = E32_WRITESTART ;
|
||||
eeAddress = Eeprom32_address ;
|
||||
eeprom_write_enable() ;
|
||||
p = Spi_tx_buf ;
|
||||
*p = 0x20 ; // Block Erase command
|
||||
*(p+1) = eeAddress >> 16 ;
|
||||
*(p+2) = eeAddress >> 8 ;
|
||||
*(p+3) = eeAddress ; // 3 bytes address
|
||||
spi_PDC_action( p, 0, 0, 4, 0 ) ;
|
||||
Eeprom32_process_state = E32_ERASESENDING ;
|
||||
Eeprom32_state_after_erase = E32_WRITESTART ;
|
||||
#endif
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
if ( Eeprom32_process_state == E32_WRITESTART )
|
||||
{
|
||||
if (Eeprom32_process_state == E32_WRITESTART) {
|
||||
uint32_t total_size ;
|
||||
p = Eeprom32_source_address;
|
||||
q = (uint8_t *) &Eeprom_buffer.data;
|
||||
|
|
|
@ -746,8 +746,7 @@ void RlcFile::nextRlcWriteStep()
|
|||
|
||||
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;
|
||||
if (cur0 != run0 || cnt==0x3f || (cnt0 && cnt==0x0f) || i==m_rlc_len) {
|
||||
if (run0) {
|
||||
|
@ -782,59 +781,57 @@ void RlcFile::nextRlcWriteStep()
|
|||
|
||||
close:
|
||||
|
||||
switch(m_write_step) {
|
||||
case WRITE_START_STEP:
|
||||
{
|
||||
blkid_t fri=0;
|
||||
switch(m_write_step) {
|
||||
case WRITE_START_STEP: {
|
||||
blkid_t fri = 0;
|
||||
|
||||
if (m_currBlk && (fri=EeFsGetLink(m_currBlk))) {
|
||||
// TODO reuse EeFsFree!!!
|
||||
blkid_t prev_freeList = eeFs.freeList;
|
||||
eeFs.freeList = fri;
|
||||
if (m_currBlk && (fri = EeFsGetLink(m_currBlk))) {
|
||||
// TODO reuse EeFsFree!!!
|
||||
blkid_t prev_freeList = eeFs.freeList;
|
||||
eeFs.freeList = fri;
|
||||
#if defined(PCBTARANIS)
|
||||
freeBlocks++;
|
||||
freeBlocks++;
|
||||
#endif
|
||||
while( EeFsGetLink(fri)) {
|
||||
fri = EeFsGetLink(fri);
|
||||
while (EeFsGetLink(fri)) {
|
||||
fri = EeFsGetLink(fri);
|
||||
#if defined(PCBTARANIS)
|
||||
freeBlocks++;
|
||||
freeBlocks++;
|
||||
#endif
|
||||
}
|
||||
m_write_step = WRITE_FREE_UNUSED_BLOCKS_STEP1;
|
||||
EeFsSetLink(fri, prev_freeList);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
m_write_step = WRITE_FREE_UNUSED_BLOCKS_STEP1;
|
||||
EeFsSetLink(fri, prev_freeList);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
case WRITE_FINAL_DIRENT_STEP:
|
||||
{
|
||||
m_currBlk = eeFs.files[FILE_TMP].startBlk;
|
||||
DirEnt & f = eeFs.files[m_fileId];
|
||||
eeFs.files[FILE_TMP].startBlk = f.startBlk;
|
||||
eeFs.files[FILE_TMP].size = f.size;
|
||||
f.startBlk = m_currBlk;
|
||||
f.size = m_pos;
|
||||
f.typ = eeFs.files[FILE_TMP].typ;
|
||||
m_write_step = WRITE_TMP_DIRENT_STEP;
|
||||
EeFsFlushDirEnt(m_fileId);
|
||||
return;
|
||||
}
|
||||
case WRITE_FINAL_DIRENT_STEP: {
|
||||
m_currBlk = eeFs.files[FILE_TMP].startBlk;
|
||||
DirEnt & f = eeFs.files[m_fileId];
|
||||
eeFs.files[FILE_TMP].startBlk = f.startBlk;
|
||||
eeFs.files[FILE_TMP].size = f.size;
|
||||
f.startBlk = m_currBlk;
|
||||
f.size = m_pos;
|
||||
f.typ = eeFs.files[FILE_TMP].typ;
|
||||
m_write_step = WRITE_TMP_DIRENT_STEP;
|
||||
EeFsFlushDirEnt(m_fileId);
|
||||
return;
|
||||
}
|
||||
|
||||
case WRITE_TMP_DIRENT_STEP:
|
||||
m_write_step = 0;
|
||||
EeFsFlushDirEnt(FILE_TMP);
|
||||
return;
|
||||
case WRITE_TMP_DIRENT_STEP:
|
||||
m_write_step = 0;
|
||||
EeFsFlushDirEnt(FILE_TMP);
|
||||
return;
|
||||
|
||||
case WRITE_FREE_UNUSED_BLOCKS_STEP1:
|
||||
m_write_step = WRITE_FREE_UNUSED_BLOCKS_STEP2;
|
||||
EeFsSetLink(m_currBlk, 0);
|
||||
return;
|
||||
case WRITE_FREE_UNUSED_BLOCKS_STEP1:
|
||||
m_write_step = WRITE_FREE_UNUSED_BLOCKS_STEP2;
|
||||
EeFsSetLink(m_currBlk, 0);
|
||||
return;
|
||||
|
||||
case WRITE_FREE_UNUSED_BLOCKS_STEP2:
|
||||
m_write_step = WRITE_FINAL_DIRENT_STEP;
|
||||
EeFsFlushFreelist();
|
||||
return;
|
||||
}
|
||||
case WRITE_FREE_UNUSED_BLOCKS_STEP2:
|
||||
m_write_step = WRITE_FINAL_DIRENT_STEP;
|
||||
EeFsFlushFreelist();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void RlcFile::flush()
|
||||
|
|
|
@ -161,10 +161,10 @@ inline uint8_t write_errno() { return s_write_err; }
|
|||
|
||||
class RlcFile: public EFile
|
||||
{
|
||||
uint8_t m_bRlc; // control byte for run length decoder
|
||||
uint8_t m_zeroes;
|
||||
uint8_t m_bRlc; // control byte for run length decoder
|
||||
uint8_t m_zeroes;
|
||||
|
||||
uint8_t m_flags;
|
||||
uint8_t m_flags;
|
||||
#define WRITE_FIRST_LINK 0x01
|
||||
#define WRITE_NEXT_LINK_1 0x02
|
||||
#define WRITE_NEXT_LINK_2 0x03
|
||||
|
@ -173,41 +173,41 @@ class RlcFile: public EFile
|
|||
#define WRITE_FREE_UNUSED_BLOCKS_STEP2 0x30
|
||||
#define WRITE_FINAL_DIRENT_STEP 0x40
|
||||
#define WRITE_TMP_DIRENT_STEP 0x50
|
||||
uint8_t m_write_step;
|
||||
uint16_t m_rlc_len;
|
||||
uint8_t * m_rlc_buf;
|
||||
uint8_t m_cur_rlc_len;
|
||||
uint8_t m_write1_byte;
|
||||
uint8_t m_write_len;
|
||||
uint8_t * m_write_buf;
|
||||
uint8_t m_write_step;
|
||||
uint16_t m_rlc_len;
|
||||
uint8_t * m_rlc_buf;
|
||||
uint8_t m_cur_rlc_len;
|
||||
uint8_t m_write1_byte;
|
||||
uint8_t m_write_len;
|
||||
uint8_t * m_write_buf;
|
||||
#if defined (EEPROM_PROGRESS_BAR)
|
||||
uint8_t m_ratio;
|
||||
uint8_t m_ratio;
|
||||
#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
|
||||
bool copy(uint8_t i_fileDst, uint8_t i_fileSrc);
|
||||
/// copy contents of i_fileSrc to i_fileDst
|
||||
bool copy(uint8_t i_fileDst, uint8_t i_fileSrc);
|
||||
|
||||
inline bool isWriting() { return m_write_step != 0; }
|
||||
void write(uint8_t *buf, uint8_t i_len);
|
||||
void write1(uint8_t b);
|
||||
void nextWriteStep();
|
||||
void nextRlcWriteStep();
|
||||
void writeRlc(uint8_t i_fileId, uint8_t typ, uint8_t *buf, uint16_t i_len, uint8_t sync_write);
|
||||
inline bool isWriting() { return m_write_step != 0; }
|
||||
void write(uint8_t *buf, uint8_t i_len);
|
||||
void write1(uint8_t b);
|
||||
void nextWriteStep();
|
||||
void nextRlcWriteStep();
|
||||
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
|
||||
void flush();
|
||||
// flush the current write operation if any
|
||||
void flush();
|
||||
|
||||
// read from opened file and decode rlc-coded data
|
||||
uint16_t readRlc(uint8_t *buf, uint16_t i_len);
|
||||
// read from opened file and decode rlc-coded data
|
||||
uint16_t readRlc(uint8_t *buf, uint16_t i_len);
|
||||
|
||||
#if defined (EEPROM_PROGRESS_BAR)
|
||||
void DisplayProgressBar(uint8_t x);
|
||||
void DisplayProgressBar(uint8_t x);
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
|
@ -829,9 +829,9 @@ enum AdjustGvarFunctionParam {
|
|||
|
||||
#if defined(CPUARM)
|
||||
#if defined(PCBTARANIS)
|
||||
#define LEN_CFN_NAME 8
|
||||
#define LEN_CFN_NAME 8
|
||||
#else
|
||||
#define LEN_CFN_NAME 6
|
||||
#define LEN_CFN_NAME 6
|
||||
#endif
|
||||
PACK(typedef struct t_CustomFnData { // Function Switches data
|
||||
int8_t swtch;
|
||||
|
|
|
@ -585,24 +585,28 @@ extern uint8_t channel_order(uint8_t x);
|
|||
class Key
|
||||
{
|
||||
#define FILTERBITS 4
|
||||
|
||||
#ifdef SIMU
|
||||
#define FFVAL 1
|
||||
#define FFVAL 1
|
||||
#else
|
||||
#define FFVAL ((1<<FILTERBITS)-1)
|
||||
#define FFVAL ((1<<FILTERBITS)-1)
|
||||
#endif
|
||||
|
||||
#define KSTATE_OFF 0
|
||||
#define KSTATE_RPTDELAY 95 // gruvin: delay state before key repeating starts
|
||||
#define KSTATE_START 97
|
||||
#define KSTATE_PAUSE 98
|
||||
#define KSTATE_KILLED 99
|
||||
uint8_t m_vals; // key debounce? 4 = 40ms
|
||||
uint8_t m_cnt;
|
||||
uint8_t m_state;
|
||||
public:
|
||||
void input(bool val, EnumKeys enuk);
|
||||
bool state() { return m_vals > 0; }
|
||||
void pauseEvents() { m_state = KSTATE_PAUSE; m_cnt = 0; }
|
||||
void killEvents() { m_state = KSTATE_KILLED; }
|
||||
|
||||
private:
|
||||
uint8_t m_vals; // key debounce? 4 = 40ms
|
||||
uint8_t m_cnt;
|
||||
uint8_t m_state;
|
||||
public:
|
||||
void input(bool val, EnumKeys enuk);
|
||||
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];
|
||||
|
|
|
@ -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
|
||||
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. */
|
||||
#define SHR(a, b) \
|
||||
(-1 >> 1 == -1 \
|
||||
? (a) >> (b) \
|
||||
: (a) / (1 << (b)) - ((a) % (1 << (b)) < 0))
|
||||
#define SHR(a, b) (-1 >> 1 == -1 ? (a) >> (b) : (a) / (1 << (b)) - ((a) % (1 << (b)) < 0))
|
||||
|
||||
/* The extra casts in the following macros work around compiler bugs,
|
||||
e.g., in Cray C 5.0.3.0. */
|
||||
|
@ -487,7 +484,7 @@ __mktime_internal (struct gtm *tp,
|
|||
gtime_t
|
||||
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;
|
||||
return __mktime_internal (tp, __localtime_r, &localtime_offset);
|
||||
}
|
||||
|
|
|
@ -51,23 +51,24 @@ int g_snapshot_idx = 0;
|
|||
class Open9xSim: public FXMainWindow
|
||||
{
|
||||
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:
|
||||
FXImage *bmp;
|
||||
FXImageFrame *bmf;
|
||||
bool firstTime;
|
||||
public:
|
||||
Open9xSim(){};
|
||||
Open9xSim(FXApp* a);
|
||||
long onKeypress(FXObject*,FXSelector,void*);
|
||||
long onTimeout(FXObject*,FXSelector,void*);
|
||||
void makeSnapshot(const FXDrawable* drawable);
|
||||
void doEvents();
|
||||
void refreshDiplay();
|
||||
|
||||
public:
|
||||
FXSlider *sliders[8];
|
||||
FXKnob *knobs[NUM_POTS];
|
||||
private:
|
||||
FXImage *bmp;
|
||||
FXImageFrame *bmf;
|
||||
bool firstTime;
|
||||
|
||||
public:
|
||||
FXSlider *sliders[8];
|
||||
FXKnob *knobs[NUM_POTS];
|
||||
};
|
||||
// Message Map
|
||||
FXDEFMAP(Open9xSim) Open9xSimMap[]={
|
||||
|
|
|
@ -53,8 +53,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#ifndef TEMPLATES_H
|
||||
#define TEMPLATES_H
|
||||
#ifndef TEMPLATES_H_
|
||||
#define TEMPLATES_H_
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
|
|
|
@ -124,12 +124,12 @@ extern const pm_char STR_OPEN9X[];
|
|||
#define OFS_VTELEMCHNS (OFS_FUNCSOUNDS + sizeof(TR_FUNCSOUNDS))
|
||||
#if defined(FRSKY) || defined(CPUARM)
|
||||
#if defined(CPUARM)
|
||||
#define OFS_VTELEMUNIT_IMP (OFS_VTELEMCHNS + sizeof(TR_VTELEMCHNS))
|
||||
#define OFS_VTELEMUNIT_NORM (OFS_VTELEMUNIT_IMP + sizeof(TR_VTELEMUNIT_IMP))
|
||||
#define OFS_VALARM (OFS_VTELEMUNIT_NORM + sizeof(TR_VTELEMUNIT_NORM))
|
||||
#define OFS_VTELEMUNIT_IMP (OFS_VTELEMCHNS + sizeof(TR_VTELEMCHNS))
|
||||
#define OFS_VTELEMUNIT_NORM (OFS_VTELEMUNIT_IMP + sizeof(TR_VTELEMUNIT_IMP))
|
||||
#define OFS_VALARM (OFS_VTELEMUNIT_NORM + sizeof(TR_VTELEMUNIT_NORM))
|
||||
#else
|
||||
#define OFS_VTELEMUNIT (OFS_VTELEMCHNS + sizeof(TR_VTELEMCHNS))
|
||||
#define OFS_VALARM (OFS_VTELEMUNIT + sizeof(TR_VTELEMUNIT))
|
||||
#define OFS_VTELEMUNIT (OFS_VTELEMCHNS + sizeof(TR_VTELEMCHNS))
|
||||
#define OFS_VALARM (OFS_VTELEMUNIT + sizeof(TR_VTELEMUNIT))
|
||||
#endif
|
||||
#define OFS_VALARMFN (OFS_VALARM + sizeof(TR_VALARM))
|
||||
#define OFS_VTELPROTO (OFS_VALARMFN + sizeof(TR_VALARMFN))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue