[Taranis] Asterisk BMP (thanks Martin!)

[Taranis] WDT timeout adjustable when dealing with long delays without pulses (thanks Mike for the trick!)
[Taranis] After USB is disconnected, the SD and the EEPROM are read inside the main, not inside the interrupt
[Taranis] Removed dead code about CPU temperature
[stock] Flash saving (thanks Mike for your emails!)
This commit is contained in:
bsongis@gmail.com
2013-05-17 16:30:30 +00:00
parent 80b0f0ee52
commit a41dc24a2e
17 changed files with 187 additions and 148 deletions
+2 -1
View File
@@ -1072,7 +1072,7 @@ bitmaps/font.lbm: bitmaps/font.xbm bitmaps/font_extra.xbm bitmaps/font_tiny.xbm
$(IMG2LBM) translations/font_dblsize_fr.xbm translations/font_dblsize_fr.lbm 10x14
$(IMG2LBM) translations/font_dblsize_es.xbm translations/font_dblsize_es.lbm 10x14
bitmaps/sticks.lbm: bitmaps/sticks_4x1.xbm bitmaps/splash_9x.xbm bitmaps/splash_taranis.png bitmaps/logo_taranis.bmp bitmaps/icons.png bitmaps/asterisk.xbm bitmaps/about.png
bitmaps/sticks.lbm: bitmaps/sticks_4x1.xbm bitmaps/splash_9x.xbm bitmaps/splash_taranis.png bitmaps/logo_taranis.bmp bitmaps/icons.png bitmaps/asterisk.xbm bitmaps/about.png bitmaps/asterisk_4bits.png
@echo
@echo "Convert bitmaps from xbm to lbm:"
$(IMG2LBM) bitmaps/sticks_4x1.xbm bitmaps/sticks.lbm img 4
@@ -1082,6 +1082,7 @@ bitmaps/sticks.lbm: bitmaps/sticks_4x1.xbm bitmaps/splash_9x.xbm bitmaps/splash_
$(IMG2LBM) bitmaps/icons.png bitmaps/icons.lbm bmp
$(IMG2LBM) bitmaps/asterisk.xbm bitmaps/asterisk.lbm img
$(IMG2LBM) bitmaps/about.png bitmaps/about.lbm bmp
$(IMG2LBM) bitmaps/asterisk_4bits.png bitmaps/asterisk_4bits.lbm bmp
# Eye candy.
# AVR Studio 3.x does not check make's exit code but relies on
+4
View File
@@ -911,6 +911,10 @@ void eeLoadModel(uint8_t id)
{
if (id<MAX_MODELS) {
#if defined(CPUARM)
watchdogSetTimeout(500/*5s*/);
#endif
#if defined(SDCARD)
closeLogs();
#endif
+11 -19
View File
@@ -2323,9 +2323,9 @@ void menuModelCurveOne(uint8_t event)
}
break;
case EVT_KEY_LONG(KEY_MENU):
pushMenu(menuChannelsView);
killEvents(event);
return;
pushMenu(menuChannelsView);
killEvents(event);
return;
}
DrawCurve(FW);
@@ -3023,6 +3023,14 @@ void onExpoMixMenu(const char *result)
void menuModelExpoMix(uint8_t expo, uint8_t event)
{
#if defined(PCBTARANIS)
if (event == EVT_KEY_LONG(KEY_MENU)) {
pushMenu(menuChannelsView);
killEvents(event);
return;
}
#endif
uint8_t sub = m_posVert;
if (s_editMode > 0)
@@ -3321,27 +3329,11 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
void menuModelExposAll(uint8_t event)
{
#if defined(PCBTARANIS)
if (event == EVT_KEY_LONG(KEY_MENU)) {
pushMenu(menuChannelsView);
killEvents(event);
return;
}
#endif
return menuModelExpoMix(1, event);
}
void menuModelMixAll(uint8_t event)
{
#if defined(PCBTARANIS)
if (event == EVT_KEY_LONG(KEY_MENU)) {
pushMenu(menuChannelsView);
killEvents(event);
return;
}
#endif
return menuModelExpoMix(0, event);
}
+4 -2
View File
@@ -106,7 +106,9 @@ void menuAboutView(uint8_t event)
case ABOUT_MIKE:
lcd_putsAtt(62, 24, PSTR("Mike Blandford"), att);
lcd_putsAtt(68, 36, PSTR("Drivers guru"), att|SMLSIZE);
lcd_putsAtt(68, 36, PSTR("Code and drivers guru"), att|SMLSIZE);
lcd_putsAtt(68, 44, PSTR("Arguably, one of the best"), att|SMLSIZE);
lcd_putsAtt(68, 52, PSTR("Inspirational"), att|SMLSIZE);
break;
case ABOUT_ROMOLO:
@@ -139,7 +141,7 @@ void menuAboutView(uint8_t event)
lcd_putsAtt(62, 24, PSTR("Parent projects"), att);
lcd_putsAtt(68, 36, PSTR("Ersky9x (Mike Blandford)"), att|SMLSIZE);
lcd_putsAtt(68, 44, PSTR("Er9x (Erez Raviv)"), att|SMLSIZE);
lcd_putsAtt(68, 52, PSTR("Th9x (Thomas Husterer)"), att|SMLSIZE);
lcd_putsAtt(67, 52, PSTR("Th9x (Thomas Husterer)"), att|SMLSIZE);
screenDuration = 300;
break;
}
+1 -3
View File
@@ -377,17 +377,15 @@ void displayBattVoltage()
#endif
}
#if defined(CPUARM)
#if defined(PCBSKY9X)
void displayVoltageOrAlarm()
{
if (g_vbat100mV > g_eeGeneral.vBatWarn && g_eeGeneral.temperatureWarn && getTemperature() >= g_eeGeneral.temperatureWarn) {
putsTelemetryValue(6*FW-1, 3*FH, getTemperature(), UNIT_DEGREES, BLINK|INVERS|DBLSIZE);
}
#if defined(PCBSKY9X)
else if (g_vbat100mV > g_eeGeneral.vBatWarn && g_eeGeneral.mAhWarn && (g_eeGeneral.mAhUsed + Current_used * (488 + g_eeGeneral.currentCalib)/8192/36) / 500 >= g_eeGeneral.mAhWarn) {
putsTelemetryValue(7*FW-1, 3*FH, (g_eeGeneral.mAhUsed + Current_used*(488 + g_eeGeneral.currentCalib)/8192/36)/10, UNIT_MAH, BLINK|INVERS|DBLSIZE);
}
#endif
else {
displayBattVoltage();
}
+1 -1
View File
@@ -145,7 +145,7 @@ void menuStatisticsDebug(uint8_t event)
putsTime(17*FW+5*FWNUM+1, 2*FH, g_eeGeneral.globalTimer + sessionTimer, 0, 0);
#endif
#if defined(CPUARM)
#if defined(PCBSKY9X)
lcd_putsLeft(3*FH, STR_CPU_TEMP);
putsTelemetryValue(MENU_DEBUG_COL_OFS, 3*FH, getTemperature(), UNIT_DEGREES, 0);
putsTelemetryValue(20*FW+2, 3*FH, maxTemperature+g_eeGeneral.temperatureCalib, UNIT_DEGREES, 0);
+56 -27
View File
@@ -81,10 +81,14 @@ const pm_uchar splashdata[] PROGMEM = { 'S','P','S',0,
const pm_uchar * splash_lbm = splashdata+4;
#endif
#if !defined(CPUM64) || defined(EXTSTD)
const pm_uchar asterisk_lbm[] PROGMEM = {
#include "bitmaps/asterisk.lbm"
};
#if LCD_W >= 212
const pm_uchar asterisk_lbm[] PROGMEM = {
#include "bitmaps/asterisk_4bits.lbm"
};
#elif !defined(CPUM64) || defined(EXTSTD)
const pm_uchar asterisk_lbm[] PROGMEM = {
#include "bitmaps/asterisk.lbm"
};
#endif
#include "gui/menus.h"
@@ -223,7 +227,12 @@ char * strcat_zchar(char * dest, char * name, uint8_t size, const char *defaultN
volatile tmr10ms_t g_tmr10ms;
#if defined(CPUARM)
volatile uint8_t rtc_count=0;
volatile uint8_t rtc_count = 0;
uint32_t watchdogTimeout = 0;
void watchdogSetTimeout(uint32_t timeout)
{
watchdogTimeout = timeout;
}
#endif
void per10ms()
@@ -231,6 +240,10 @@ void per10ms()
g_tmr10ms++;
#if defined(CPUARM)
if (watchdogTimeout) {
watchdogTimeout -= 1;
wdt_reset(); // Retrigger hardware watchdog
}
Tenms |= 1 ; // 10 mS has passed
#endif
@@ -1731,8 +1744,8 @@ void checkSwitches()
swstate_t mask = (0x03 << (1+i*2));
uint8_t attr = ((states & mask) == (switches_states & mask)) ? 0 : INVERS;
char c = "\300-\301"[(states & mask) >> (1+i*2)];
lcd_putcAtt(50+i*(2*FW+FW/2), 5*FH, 'A'+i, attr);
lcd_putcAtt(50+i*(2*FW+FW/2)+FW, 5*FH, c, attr);
lcd_putcAtt(60+i*(2*FW+FW/2), 5*FH, 'A'+i, attr);
lcd_putcAtt(60+i*(2*FW+FW/2)+FW, 5*FH, c, attr);
}
#else
uint8_t x = 2;
@@ -1780,26 +1793,43 @@ void message(const pm_char *title, const pm_char *t, const char *last MESSAGE_SO
lcd_clear();
#if LCD_W >= 212
lcd_img(LCD_W-29, 0, asterisk_lbm, 0, 0);
#endif
#if !defined(CPUM64) || defined(EXTSTD)
lcd_bmp(0, 0, asterisk_lbm);
#define TITLE_LCD_OFFSET 60
#define MESSAGE_LCD_OFFSET 60
#elif !defined(CPUM64) || defined(EXTSTD)
lcd_img(2, 0, asterisk_lbm, 0, 0);
#define TITLE_LCD_OFFSET 6*FW
#define MESSAGE_LCD_OFFSET 0
#else
lcd_putsAtt(0, 0, PSTR("(!)"), DBLSIZE);
#define TITLE_LCD_OFFSET 6*FW
#define MESSAGE_LCD_OFFSET 0
#endif
#if defined(TRANSLATIONS_FR) || defined(TRANSLATIONS_IT) || defined(TRANSLATIONS_CZ)
lcd_putsAtt(6*FW, 0, STR_WARNING, DBLSIZE);
lcd_putsAtt(6*FW, 2*FH, title, DBLSIZE);
lcd_putsAtt(TITLE_LCD_OFFSET, 0, STR_WARNING, DBLSIZE);
lcd_putsAtt(TITLE_LCD_OFFSET, 2*FH, title, DBLSIZE);
#else
lcd_putsAtt(6*FW, 0, title, DBLSIZE);
lcd_putsAtt(6*FW, 2*FH, STR_WARNING, DBLSIZE);
lcd_putsAtt(TITLE_LCD_OFFSET, 0, title, DBLSIZE);
lcd_putsAtt(TITLE_LCD_OFFSET, 2*FH, STR_WARNING, DBLSIZE);
#endif
lcd_filled_rect(0, 0, LCD_W, 32);
#if LCD_W >= 212
lcd_filled_rect(60, 0, LCD_W-MESSAGE_LCD_OFFSET, 32);
if (t) lcd_puts(MESSAGE_LCD_OFFSET, 5*FH, t);
if (last) {
lcd_puts(MESSAGE_LCD_OFFSET, 7*FH, last);
AUDIO_ERROR_MESSAGE(sound);
}
#else
lcd_filled_rect(0, 0, LCD_W-MESSAGE_LCD_OFFSET, 32);
if (t) lcd_putsLeft(5*FH, t);
if (last) {
lcd_putsLeft(7*FH, last);
AUDIO_ERROR_MESSAGE(sound);
}
#endif
lcdRefresh();
lcdSetContrast();
clearKeyEvents();
@@ -3626,6 +3656,15 @@ void perMain()
}
#endif
#if defined(PCBTARANIS)
if (usbState == USB_DISCONNECTING) {
eeReadAll();
eeLoadModel(g_eeGeneral.currModel);
sdInit();
usbState = USB_DISCONNECTED;
}
#endif
lcd_clear();
const char *warn = s_warning;
uint8_t menu = s_menu_count;
@@ -4195,17 +4234,7 @@ void mixerTask(void * pdata)
CoLeaveMutexSection(mixerMutex);
if (tick10ms) checkTrims();
#if defined(PCBTARANIS)
uint8_t heartbeatCheck = HEART_TIMER_10MS;
if (g_model.moduleData[0].rfProtocol != RF_PROTO_OFF)
heartbeatCheck |= HEART_TIMER_PULSES << 0;
if (g_model.externalModule != MODULE_TYPE_NONE)
heartbeatCheck |= HEART_TIMER_PULSES << 1;
#else
uint8_t heartbeatCheck = HEART_TIMER_10MS + HEART_TIMER_PULSES;
#endif
if ((heartbeat & heartbeatCheck) == heartbeatCheck) {
if (heartbeat == HEART_WDT_CHECK) {
wdt_reset();
heartbeat = 0;
}
@@ -4399,7 +4428,7 @@ int main(void)
perMain();
if (heartbeat == HEART_TIMER_PULSES+HEART_TIMER_10MS) {
if (heartbeat == HEART_WDT_CHECK) {
wdt_reset();
heartbeat = 0;
}
+6
View File
@@ -405,6 +405,7 @@ enum EnumKeys {
}
typedef int8_t rotenc_t;
typedef int16_t getvalue_t;
void watchdogSetTimeout(uint32_t timeout);
#endif
#include "eeprom_common.h"
@@ -667,6 +668,11 @@ enum CswFunctions {
#define HEART_TIMER_10MS 1
#define HEART_TIMER_PULSES 2 // when multiple modules this is the first one
#if defined(PCBTARANIS)
#define HEART_WDT_CHECK (HEART_TIMER_10MS + (HEART_TIMER_PULSES << 0) + (HEART_TIMER_PULSES << 1))
#else
#define HEART_WDT_CHECK (HEART_TIMER_10MS + HEART_TIMER_PULSES)
#endif
extern uint8_t heartbeat;
#define MAX_ALERT_TIME 60
+8
View File
@@ -52,6 +52,10 @@ void setupPulsesDsm2(uint8_t chns);
void setupPulsesPXX(unsigned int port);
void setupPulsesPPM(unsigned int port);
#if defined(HUBSAN)
void Hubsan_Init();
#endif
inline void startPulses()
{
#if defined(PCBTARANIS)
@@ -60,6 +64,10 @@ inline void startPulses()
#else
setupPulses(0);
#endif
#if defined(HUBSAN)
Hubsan_Init();
#endif
}
inline bool pulsesStarted() { return s_current_protocol[0] != 255; }
+7 -2
View File
@@ -306,6 +306,11 @@ void putPcmHead()
putPcmPart( 0xC0 ) ;
}
uint16_t scaleForPXX(uint8_t i)
{
return channelOutputs[i] * 3 / 4 + 2250 ;
}
void setupPulsesPXX()
{
uint8_t i ;
@@ -325,8 +330,8 @@ void setupPulsesPXX()
pxxFlag[0] = 0; // reset flag after send
for ( i = 0 ; i < 8 ; i += 2 ) // First 8 channels only
{
chan = channelOutputs[i] * 3 / 4 + 2250 ;
chan_1 = channelOutputs[i+1] * 3 / 4 + 2250 ;
chan = scaleForPXX(i);
chan_1 = scaleForPXX(i+1);
putPcmByte( chan ) ; // Low byte of channel
putPcmByte( ( ( chan >> 8 ) & 0x0F ) | ( chan_1 << 4) ) ; // 4 bits each from 2 channels
putPcmByte( chan_1 >> 4 ) ; // High byte of channel
+1 -1
View File
@@ -207,7 +207,7 @@ long Open9xSim::onTimeout(FXObject*,FXSelector,void*)
Coproc_maxtemp = 28;
#endif
#if defined(CPUARM)
#if defined(PCBSKY9X)
temperature = 31;
maxTemperature = 42;
#endif
+23 -15
View File
@@ -37,9 +37,9 @@
#include "opentx.h"
#define delay_1us() _delay_us(1)
void delay_1_5us(int ms)
void delay_1_5us(uint16_t ms)
{
for(int i=0; i<ms; i++) delay_1us();
for (uint16_t i=0; i<ms; i++) delay_1us();
}
void lcdSendCtl(uint8_t val)
@@ -69,6 +69,22 @@ volatile uint8_t LcdLock ;
#define LCD_UNLOCK()
#endif
const static pm_uchar lcdInitSequence[] PROGMEM =
{
0xe2, //Initialize the internal functions
0xae, //DON = 0: display OFF
0xa1, //ADC = 1: reverse direction(SEG132->SEG1)
0xA6, //REV = 0: non-reverse display
0xA4, //EON = 0: normal display. non-entire
0xA2, // Select LCD bias=0
0xC0, //SHL = 0: normal direction (COM1->COM64)
0x2F, //Control power circuit operation VC=VR=VF=1
0x25, //Select int resistance ratio R2 R1 R0 =5
0x81, //Set reference voltage Mode
0x22, // 24 SV5 SV4 SV3 SV2 SV1 SV0 = 0x18
0xAF //DON = 1: display ON
};
inline void lcdInit()
{
// /home/thus/txt/datasheets/lcd/KS0713.pdf
@@ -76,22 +92,14 @@ inline void lcdInit()
LCD_LOCK();
PORTC_LCD_CTRL &= ~(1<<OUT_C_LCD_RES); //LCD_RES
// TODO delay_2us ?
delay_1us();
delay_1us();// f520 call 0xf4ce delay_1us() ; 0x0xf4ce
delay_1us(); // f520 call 0xf4ce delay_1us() ; 0x0xf4ce
PORTC_LCD_CTRL |= (1<<OUT_C_LCD_RES); // f524 sbi 0x15, 2 IOADR-PORTC_LCD_CTRL; 21 1
delay_1_5us(1500);
lcdSendCtl(0xe2); //Initialize the internal functions
lcdSendCtl(0xae); //DON = 0: display OFF
lcdSendCtl(0xa1); //ADC = 1: reverse direction(SEG132->SEG1)
lcdSendCtl(0xA6); //REV = 0: non-reverse display
lcdSendCtl(0xA4); //EON = 0: normal display. non-entire
lcdSendCtl(0xA2); // Select LCD bias=0
lcdSendCtl(0xC0); //SHL = 0: normal direction (COM1->COM64)
lcdSendCtl(0x2F); //Control power circuit operation VC=VR=VF=1
lcdSendCtl(0x25); //Select int resistance ratio R2 R1 R0 =5
lcdSendCtl(0x81); //Set reference voltage Mode
lcdSendCtl(0x22); // 24 SV5 SV4 SV3 SV2 SV1 SV0 = 0x18
lcdSendCtl(0xAF); //DON = 1: display ON
for (uint8_t i=0; i<12; i++) {
lcdSendCtl(pgm_read_byte(&lcdInitSequence[i]) ) ;
}
g_eeGeneral.contrast = 0x22;
LCD_UNLOCK();
}
+4 -12
View File
@@ -39,11 +39,8 @@ extern "C" {
#include "STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/inc/usb_dcd_int.h"
}
// TODO needed?
uint8_t temperature = 0; // Raw temp reading
uint8_t maxTemperature = 0 ; // Raw temp reading
volatile uint32_t Tenms ; // TODO to remove everywhere / use a #define
uint8_t usb_connected = 0;
UsbState usbState = USB_DISCONNECTED;
#define PIN_MODE_MASK 0x0003
#define PIN_INPUT 0x0000
@@ -109,7 +106,7 @@ void configure_pins( uint32_t pins, uint16_t config )
uint8_t usbPlugged(void)
{
return usb_connected;
return usbState == USB_CONNECTED;
}
#if defined(DEBUG)
@@ -119,11 +116,6 @@ void debugPutc(const char c)
}
#endif
uint8_t getTemperature()
{
return temperature + g_eeGeneral.temperatureCalib;
}
void start_ppm_capture()
{
}
@@ -144,12 +136,12 @@ void usbInit()
}
#endif
void watchdogInit()
void watchdogInit(unsigned int duration)
{
IWDG->KR = 0x5555 ; // Unlock registers
IWDG->PR = 3 ; // Divide by 32 => 1kHz clock
IWDG->KR = 0x5555 ; // Unlock registers
IWDG->RLR = 1500 ; // 1.5 seconds nominal
IWDG->RLR = duration ; // 1.5 seconds nominal
IWDG->KR = 0xAAAA ; // reload
IWDG->KR = 0xCCCC ; // start
}
+21 -19
View File
@@ -68,11 +68,6 @@ extern "C" {
#define JACK_PPM_IN()
void configure_pins( uint32_t pins, uint16_t config );
uint16_t getCurrent();
extern uint8_t temperature ; // Raw temp reading
extern uint8_t maxTemperature ; // Raw temp reading
uint8_t getTemperature();
#define strcpy_P strcpy
#define strcat_P strcat
@@ -101,16 +96,18 @@ void delaysInit(void);
void delay_01us(uint16_t nb);
// SD driver
#if !defined(SIMU)
#define SD_IS_HC() (1)
#define SD_GET_SIZE_MB() (0)
#define SD_GET_BLOCKNR() (0)
#define SD_GET_SPEED() (0)
void sdInit();
void sdPoll10ms();
#define sdMountPoll()
uint32_t sdMounted();
#define SD_CARD_PRESENT() (~SD_PRESENT_GPIO->IDR & SD_PRESENT_GPIO_Pin)
#if defined(SIMU)
#define sdInit()
#else
#define SD_IS_HC() (1)
#define SD_GET_SIZE_MB() (0)
#define SD_GET_BLOCKNR() (0)
#define SD_GET_SPEED() (0)
void sdInit();
void sdPoll10ms();
#define sdMountPoll()
uint32_t sdMounted();
#define SD_CARD_PRESENT() (~SD_PRESENT_GPIO->IDR & SD_PRESENT_GPIO_Pin)
#endif
// Pulses driver
@@ -139,8 +136,8 @@ uint32_t readKeys();
// WDT driver
#if !defined(SIMU)
#define wdt_disable()
void watchdogInit();
#define wdt_enable(x) watchdogInit()
void watchdogInit(unsigned int duration);
#define wdt_enable(x) watchdogInit(1500)
#define wdt_reset() IWDG->KR = 0xAAAA
#endif
@@ -172,7 +169,12 @@ void pwrOff();
// USB driver
void usbInit(void);
extern uint8_t usb_connected;
enum UsbState {
USB_DISCONNECTED,
USB_CONNECTED,
USB_DISCONNECTING,
};
extern UsbState usbState;
// EEPROM driver
#if !defined(SIMU)
@@ -183,7 +185,7 @@ extern uint8_t usb_connected;
#define eepromInit()
void eeWriteBlockCmp(const void *pointer_ram, uint16_t pointer_eeprom, size_t size);
#endif
#define EEPROM_MASSSTORAGE() (usb_connected)
#define EEPROM_MASSSTORAGE() usbPlugged()
extern uint8_t currentTrainerMode;
+29 -32
View File
@@ -271,7 +271,7 @@ const char g_FATboot[BLOCKSIZE] =
0x01, // Sectors per FS cluster.
0x01, 0x00, // Reserved sector count
0x01, // Number of FATs
0x01, // Number of FATs
0x10, 0x00, // Number of root directory entries
0x83, 0x00, // Total sectors = 131
0xf8, // Media descriptor
@@ -280,7 +280,7 @@ const char g_FATboot[BLOCKSIZE] =
0x40, 0x00, // Number of heads
0x00, 0x00, 0x00, 0x00, // Number of hidden sectors
0x00, 0x00, 0x00, 0x00, // Large number of sectors.
0x00, 0x00, 0x00, 0x00, // Large number of sectors.
0x00, // Physical drive number
0x00, // Reserved
0x29, // Extended boot signature
@@ -289,21 +289,21 @@ const char g_FATboot[BLOCKSIZE] =
0x46, 0x41, 0x54, 0x31, 0x32, 0x20, 0x20, 0x20, // FAT file system type
0x00, 0x00, // OS boot code
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -323,19 +323,20 @@ const char g_FATboot[BLOCKSIZE] =
const char g_FAT[BLOCKSIZE] =
{
0xF8, 0xFF, 0xFF, 0x03, 0x40, 0x00, 0x05, 0x60, 0x00, 0x07, 0x80, 0x00, 0x09, 0xA0, 0x00, 0x0B,
0xC0, 0x00, 0x0D, 0xE0, 0x00, 0x0F, 0x00, 0x01, 0x11, 0x20, 0x01, 0x13, 0x40, 0x01, 0x15, 0x60,
0x01, 0x17, 0x80, 0x01, 0x19, 0xA0, 0x01, 0x1B, 0xC0, 0x01, 0x1D, 0xE0, 0x01, 0x1F, 0x00, 0x02,
0x21, 0x20, 0x02, 0x23, 0x40, 0x02, 0x25, 0x60, 0x02, 0x27, 0x80, 0x02, 0x29, 0xA0, 0x02, 0x2B,
0xC0, 0x02, 0x2D, 0xE0, 0x02, 0x2F, 0x00, 0x03, 0x31, 0x20, 0x03, 0x33, 0x40, 0x03, 0x35, 0x60,
0x03, 0x37, 0x80, 0x03, 0x39, 0xA0, 0x03, 0x3B, 0xC0, 0x03, 0x3D, 0xE0, 0x03, 0x3F, 0x00, 0x04,
0x41, 0x20, 0x04, 0x43, 0x40, 0x04, 0x45, 0x60, 0x04, 0x47, 0x80, 0x04, 0x49, 0xA0, 0x04, 0x4B,
0xC0, 0x04, 0x4D, 0xE0, 0x04, 0x4F, 0x00, 0x05, 0x51, 0x20, 0x05, 0x53, 0x40, 0x05, 0x55, 0x60,
0x05, 0x57, 0x80, 0x05, 0x59, 0xA0, 0x05, 0x5B, 0xC0, 0x05, 0x5D, 0xE0, 0x05, 0x5F, 0x00, 0x06,
0x61, 0x20, 0x06, 0x63, 0x40, 0x06, 0x65, 0x60, 0x06, 0x67, 0x80, 0x06, 0x69, 0xA0, 0x06, 0x6B,
0xC0, 0x06, 0x6D, 0xE0, 0x06, 0x6F, 0x00, 0x07, 0x71, 0x20, 0x07, 0x73, 0x40, 0x07, 0x75, 0x60,
0x07, 0x77, 0x80, 0x07, 0x79, 0xA0, 0x07, 0x7B, 0xC0, 0x07, 0x7D, 0xE0, 0x07, 0x7F, 0x00, 0x08,
0x81, 0xF0, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xF8, 0xFF, 0xFF, 0x03, 0x40, 0x00, 0x05, 0x60, 0x00, 0x07, 0x80, 0x00, 0x09, 0xA0, 0x00, 0x0B,
0xC0, 0x00, 0x0D, 0xE0, 0x00, 0x0F, 0x00, 0x01, 0x11, 0x20, 0x01, 0x13, 0x40, 0x01, 0x15, 0x60,
0x01, 0x17, 0x80, 0x01, 0x19, 0xA0, 0x01, 0x1B, 0xC0, 0x01, 0x1D, 0xE0, 0x01, 0x1F, 0x00, 0x02,
0x21, 0x20, 0x02, 0x23, 0x40, 0x02, 0x25, 0x60, 0x02, 0x27, 0x80, 0x02, 0x29, 0xA0, 0x02, 0x2B,
0xC0, 0x02, 0x2D, 0xE0, 0x02, 0x2F, 0x00, 0x03, 0x31, 0x20, 0x03, 0x33, 0x40, 0x03, 0x35, 0x60,
0x03, 0x37, 0x80, 0x03, 0x39, 0xA0, 0x03, 0x3B, 0xC0, 0x03, 0x3D, 0xE0, 0x03, 0x3F, 0x00, 0x04,
0x41, 0x20, 0x04, 0x43, 0x40, 0x04, 0x45, 0x60, 0x04, 0x47, 0x80, 0x04, 0x49, 0xA0, 0x04, 0x4B,
0xC0, 0x04, 0x4D, 0xE0, 0x04, 0x4F, 0x00, 0x05, 0x51, 0x20, 0x05, 0x53, 0x40, 0x05, 0x55, 0x60,
0x05, 0x57, 0x80, 0x05, 0x59, 0xA0, 0x05, 0x5B, 0xC0, 0x05, 0x5D, 0xE0, 0x05, 0x5F, 0x00, 0x06,
0x61, 0x20, 0x06, 0x63, 0x40, 0x06, 0x65, 0x60, 0x06, 0x67, 0x80, 0x06, 0x69, 0xA0, 0x06, 0x6B,
0xC0, 0x06, 0x6D, 0xE0, 0x06, 0x6F, 0x00, 0x07, 0x71, 0x20, 0x07, 0x73, 0x40, 0x07, 0x75, 0x60,
0x07, 0x77, 0x80, 0x07, 0x79, 0xA0, 0x07, 0x7B, 0xC0, 0x07, 0x7D, 0xE0, 0x07, 0x7F, 0x00, 0x08,
0x81, 0xF0, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -348,7 +349,6 @@ const char g_FAT[BLOCKSIZE] =
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -635,21 +635,17 @@ int32_t fat12Read( uint8_t *buffer, uint16_t sector, uint16_t count )
{
while ( count )
{
if (sector == 0)
{
memcpy( buffer, g_FATboot, BLOCKSIZE ) ;
if (sector == 0) {
memcpy( buffer, g_FATboot, BLOCKSIZE ) ;
}
else if (sector == 1/*Reserved sector count*/)
{
// FAT table.
memcpy( buffer, g_FAT, BLOCKSIZE);
else if (sector == 1/*Reserved sector count*/) {
// FAT table.
memcpy( buffer, g_FAT, BLOCKSIZE);
}
else if (sector == 2)
{
else if (sector == 2) {
memcpy( buffer, g_DIRroot, BLOCKSIZE ) ;
}
else
{
else {
eeprom_read_block (buffer, (sector-3)*512, 512);
}
buffer += 512 ;
@@ -676,8 +672,9 @@ int32_t fat12Write(const uint8_t *buffer, uint16_t sector, uint32_t count )
buffer += 512;
sector++;
count--;
if (sector-offset+1==EESIZE/512)
if (sector-offset+1==EESIZE/512) {
offset = 0;
}
}
return 0 ;
}
+2 -7
View File
@@ -114,7 +114,7 @@ void USBD_USR_DeviceConnected (void)
}
eeCheck(true);
usb_connected = 1;
usbState = USB_CONNECTED;
}
@@ -126,12 +126,7 @@ void USBD_USR_DeviceConnected (void)
*/
void USBD_USR_DeviceDisconnected (void)
{
usb_connected = 0;
eeReadAll();
eeLoadModel(g_eeGeneral.currModel);
sdInit();
usbState = USB_DISCONNECTING;
}
+7 -7
View File
@@ -484,13 +484,13 @@
#define TR_MIX "MIX"
#define TR_EEPROMLOWMEM "EEPROM low mem"
#define TR_ALERT "\016ALERT"
#define TR_PRESSANYKEYTOSKIP CENTER "Press any key to skip"
#define TR_THROTTLENOTIDLE CENTER "Throttle not idle"
#define TR_ALARMSDISABLED CENTER "Alarms Disabled"
#define TR_PRESSANYKEY TR("\010Press any Key", CENTER "Press any Key")
#define TR_BADEEPROMDATA CENTER "Bad EEprom Data"
#define TR_EEPROMFORMATTING CENTER "Formatting EEPROM"
#define TR_EEPROMOVERFLOW CENTER "EEPROM overflow"
#define TR_PRESSANYKEYTOSKIP "Press any key to skip"
#define TR_THROTTLENOTIDLE "Throttle not idle"
#define TR_ALARMSDISABLED "Alarms Disabled"
#define TR_PRESSANYKEY TR("\010Press any Key", "Press any Key")
#define TR_BADEEPROMDATA "Bad EEprom Data"
#define TR_EEPROMFORMATTING "Formatting EEPROM"
#define TR_EEPROMOVERFLOW "EEPROM overflow"
#define TR_MENURADIOSETUP "RADIO SETUP"
#define TR_MENUDATEANDTIME "DATE AND TIME"
#define TR_MENUTRAINER "TRAINER"