Skip to content

Commit

Permalink
Merge latest changes from travis repo
Browse files Browse the repository at this point in the history
  • Loading branch information
DL2MF committed Dec 1, 2017
2 parents 6d62beb + eaff12d commit 5cc2f99
Show file tree
Hide file tree
Showing 27 changed files with 1,639 additions and 961 deletions.
Binary file removed TickleUSB_for_MD380.lnk
Binary file not shown.
26 changes: 13 additions & 13 deletions applet/src/addl_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,24 @@ typedef struct addl_config {
uint8_t rbeep;
uint32_t dmrid;
uint8_t boot_demo;
uint8_t _boot_splash; // unused
char _rname[32]; // unused.
uint8_t _boot_splash; // unused
char _rname[32]; // unused.
uint8_t cp_override ;
char bootline1[10];
char bootline2[10];
uint8_t backlight_intensities; // lower nibble = backlight intensity during IDLE, upper nibble = backlight intensity during ACTIVITY
uint8_t narrator_mode; // Mode / verbosity for CW output. See narrator.c .
uint8_t cw_pitch_10Hz; // 'CW pitch' in TEN HERTZ units, to fit in a BYTE.
uint8_t cw_volume; // output 'volume' (PWM duty cycle) for CW messages.
uint8_t narrator_mode; // Mode / verbosity for CW output. See narrator.c .
uint8_t cw_pitch_10Hz; // 'CW pitch' in TEN HERTZ units, to fit in a BYTE.
uint8_t cw_volume; // output 'volume' (PWM duty cycle) for CW messages.
// 0..100 [%] for fixed volume, or BEEP_VOLUME_AUTO to control via pot:
# define BEEP_VOLUME_AUTO 255
uint8_t cw_speed_WPM; // CW output speed, measured in words per minute .
uint16_t fg_color; // foreground (text) colour for own menus, and maybe console screens too
uint16_t bg_color; // normal background colour, also customizeable in app_menu.c ...
uint16_t sel_fg_color; // fg colour to mark the selection- or navigation bar
uint16_t sel_bg_color; // bg colour to mark the selection- or navigation bar
uint16_t edit_fg_color; // fg colour of a cell in "edit mode" (or, single char for the CURSOR)
uint16_t edit_bg_color; // fg colour of a cell in "edit mode" (or, single char for the CURSOR)
uint8_t cw_speed_WPM; // CW output speed, measured in words per minute .
uint16_t fg_color; // foreground (text) colour for own menus, and maybe console screens too
uint16_t bg_color; // normal background colour, also customizeable in app_menu.c ...
uint16_t sel_fg_color; // fg colour to mark the selection- or navigation bar
uint16_t sel_bg_color; // bg colour to mark the selection- or navigation bar
uint16_t edit_fg_color; // fg colour of a cell in "edit mode" (or, single char for the CURSOR)
uint16_t edit_bg_color; // fg colour of a cell in "edit mode" (or, single char for the CURSOR)
// The above 16-bit colours use the display's native 'BGR565'-format,
// as used for the 'alternative' menu and the alternative LCD driver:
// BLUE component in bits 15..11, GREEN in bits 10..5, RED in bits 4..0 .
Expand Down Expand Up @@ -82,7 +82,7 @@ void cfg_set_radio_name();

void cfg_save();
void set_keyb();
void hrc5000_buffer_flush();
void hrc5000_buffer_flush();
void hrc5000_fm_set();

#endif
66 changes: 46 additions & 20 deletions applet/src/app_menu.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// File: md380tools/applet/src/app_menu.c
// Author: Wolf (DL4YHF) [initial version]
// Please don't poison this sourcecode with TAB characters .
// Please don't poison this sourcecode with TAB characters .
// Please don't poison this sourcecode with TAB characters . Nnngrrrr !
//
// Date: 2017-05-12
// Date: 2017-09-03
// Implements a simple menu opened with the red BACK button,
// which doesn't rely on ANY of Tytera's firmware
// functions at all (neither "gfx" nor "menu").
Expand Down Expand Up @@ -65,7 +67,7 @@

// Variables used by the 'app menu' :

static uint8_t am_key; // one-level keyboard buffer
static uint8_t am_key; // one-level keyboard buffer for the app-menu
static uint8_t morse_activation_pending = TRUE;
static uint32_t backlight_stopwatch; // SysTick-based stopwatch for the backlight

Expand Down Expand Up @@ -212,7 +214,20 @@ const menu_item_t am_Setup[] = // setup menu, nesting level 1 ...
&gui_opmode3,0,0, NULL, NULL },
{ "[h8]SysTicks", DTYPE_UNS32, APPMENU_OPT_NONE, 0, // notice the increased QRM when this item..
(void*)&IRQ_dwSysTickCounter,0,0, NULL, NULL }, // is scrolled into view (->rapid updates)

#if (1)
{ "Core Clk", DTYPE_UNS32, APPMENU_OPT_NONE, 0, // aka "HCLK", important for FMSC timing params
(void*)&SystemCoreClock, 0,0, NULL, NULL }, // confirmed: SystemCoreClock = 168 MHz .
{ "[h8]FSMC(1)", DTYPE_UNS32, APPMENU_OPT_NONE, 0, // register with LCD bus timing bits..
(void*)&FSMC_Bank1->BTCR[1], 0,0, NULL, NULL }, // original value: 0x10100233; details in lcd_driver.c
#endif
#if (1) // check keyboard and remote control via USB ?
{ "[h2]kb_keycode", DTYPE_UNS8, APPMENU_OPT_NONE, 0, // TYTERA's own keyboard code (non-ASCII)
(void*)&kb_keycode, 0,0, NULL, NULL }, //
{ "[h2]keypress", DTYPE_UNS8, APPMENU_OPT_NONE, 0, // TYTERA's keyboard processing state
(void*)&kb_keypressed, 0,0, NULL, NULL }, //
{ "[h2]key_remote", DTYPE_UNS8, APPMENU_OPT_NONE, 0, // remote keyboard state (ASCII, received from USB)
(void*)&keypress_ascii_remote, 0,0, NULL, NULL }, //
#endif
#if (0) && ( defined(FW_D13_020) || defined(FW_S13_020) ) // removed 2017-05-12 because Netmon1 can show these:
{ "[b8]radio_s0", DTYPE_UNS8, APPMENU_OPT_NONE, 0,
&radio_status_1.m0,0,0, NULL, NULL },
Expand Down Expand Up @@ -277,14 +292,18 @@ const am_stringtable_t am_stringtab_narrator_modes[] =

//---------------------------------------------------------------------------
void Menu_OnKey( uint8_t key) // called on keypress from some interrupt handler
// [in] ASCII key, not the strange key values in Tytera's firmware .
{
//avoid resetting screen if menu isn't open
if (( global_addl_config.keyb_mode == 1 ) && (!Menu_IsVisible() && key == 'B')) {
return;
}
return;
}
if( boot_flags & BOOT_FLAG_FIRST_KEY_POLLED ) // ignore 'early keystrokes'
{ am_key = key;
}
// DON'T call anything in Tytera's part of the firmware from here,
// neither directly nor indirectly (through other functions) !
// Reason: See irq_handlers.c : PollKeys() .
}

//---------------------------------------------------------------------------
Expand Down Expand Up @@ -349,6 +368,12 @@ void Menu_Open(
{ global_addl_config.edit_fg_color = LCD_COLOR_WHITE;
global_addl_config.edit_bg_color = LCD_COLOR_RED;
}

StartStopwatch( &pMenu->morse_stopwatch );
// Reporting the first item in Morse code later (when morse_stopwatch expires):
pMenu->morse_request = AMENU_MORSE_REQUEST_ITEM_TEXT | AMENU_MORSE_REQUEST_ITEM_VALUE;


} // end Menu_Open()

//---------------------------------------------------------------------------
Expand All @@ -359,7 +384,7 @@ void Menu_Close(app_menu_t *pMenu)
pMenu->save_on_exit = FALSE; // "done"
}

if( kb_row_col_pressed ) // some key (especially the green MENU key) still pressed ?
if( kb_row_col_pressed || keypress_ascii_remote ) // some key still pressed ?
{ pMenu->visible = APPMENU_VISIBLE_UNTIL_KEY_RELEASED;
} // end if < trying to exit but a key is still pressed >
else // green MENU key not pressed, so the normal main screen should appear..
Expand Down Expand Up @@ -805,19 +830,22 @@ int Menu_DrawIfVisible(int caller)
}
}
else

if (((global_addl_config.keyb_mode == 1) && ( (pMenu->visible==APPMENU_VISIBLE) || (c == 'B' || c == '#') )) || ((global_addl_config.keyb_mode != 1) && ( (pMenu->visible==APPMENU_VISIBLE) || (c == 'B')) ))
// ex: if( (pMenu->visible==APPMENU_VISIBLE) || (c==APPMENU_ACTIVATION_KEY) )
// ... omg, this became sooo ugly when the 'keyboard mode' was made configurable:
if( ((global_addl_config.keyb_mode == 1)
&& ( (pMenu->visible==APPMENU_VISIBLE) || (c == 'B') || (c == '#') ) )
|| ((global_addl_config.keyb_mode != 1)
&& ( (pMenu->visible==APPMENU_VISIBLE) || (c == 'B') ) )
)
{ switch(c) // using ASCII characters for simplicity
{ case 'M' : // green "Menu" key : kind of ENTER
Menu_OnEnterKey(pMenu);
break; // end case < green "Menu", aka "Confirm"-key >
case 'B' : // red "Back"-key :
// red_led_timer = 20; // <- poor man's debugging
if( ( pMenu->visible == APPMENU_OFF ) && ( global_addl_config.keyb_mode != 1) ) // not visible yet..
if( ( pMenu->visible == APPMENU_OFF )
&& ( global_addl_config.keyb_mode != 1) ) // ALTERNATIVE menu not visible yet..
{ Menu_Open( pMenu, NULL, NULL, APPMENU_EDIT_OFF ); // so open the default menu (items)
StartStopwatch( &pMenu->morse_stopwatch );
// Reporting the first item in Morse code later (when morse_stopwatch expires):
pMenu->morse_request = AMENU_MORSE_REQUEST_ITEM_TEXT | AMENU_MORSE_REQUEST_ITEM_VALUE;
}
else // already in the app menu: treat the RED KEY like "BACK",
{ // "Exit", "Escape", or "Delete" ?
Expand Down Expand Up @@ -883,14 +911,12 @@ int Menu_DrawIfVisible(int caller)
pMenu->redraw = TRUE;
break;
default: // Other keys .. editing or treat as a hotkey ?
if (c == '#' && pMenu->visible == APPMENU_OFF && !is_netmon_visible()) { // red "Back"-key :
{
Menu_Open(pMenu, NULL, NULL, APPMENU_EDIT_OFF); // so open the default menu (items)
StartStopwatch(&pMenu->morse_stopwatch);
// Reporting the first item in Morse code later (when morse_stopwatch expires):
pMenu->morse_request = AMENU_MORSE_REQUEST_ITEM_TEXT | AMENU_MORSE_REQUEST_ITEM_VALUE;
}
}
// Use the "hash"-key to open the ALTERNATIVE MENU ?
if( ( pMenu->visible == APPMENU_OFF ) // ALTERNATIVE menu not visible yet.. ?
&& ( global_addl_config.keyb_mode == 1) // hash-key used to open that menu ?
&& !is_netmon_visible() ) // AND screen not occupied by netmon ?
{ Menu_Open(pMenu, NULL, NULL, APPMENU_EDIT_OFF); // so open the ALTERNATIVE menu (default items)
}
if( pMenu->edit_mode != APPMENU_EDIT_OFF )
{ Menu_ProcessEditKey(pMenu, c);
}
Expand Down
14 changes: 14 additions & 0 deletions applet/src/app_menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,20 @@
//---------------------------------------------------------------------------
// Defines for the alternative 'App Menu' :

// Key to acivtate the 'App Menu' - pick your favourite:
// 'B' = red 'Back' key in the upper right corner of the keyboard,
// Author's favourite: Press the same key two times
// to open the menu, take a glance at the most important parameters
// (that are immediately displayed without clumsy submenus),
// and quicky close the menu with the same key again.
// '#' = hash key / white arrrow up in the lower right corner.
// Note: a LONG press of the 'green key' should be reserved for opening
// Tytera's stock menu, even if the stock firmware doesn't want to
// because the channel is busy (same annoyance as in other DMR radios).
#ifndef APPMENU_ACTIVATION_KEY // if not defined somewhere else (config.h or command line)
# define APPMENU_ACTIVATION_KEY 'B'
#endif

// Result codes for app menu callback functions :
#define AM_RESULT_NONE 0 // "proceed as if there was NO callback function"
#define AM_RESULT_OK 1 // general 'ok' (callback function 'did something').
Expand Down
2 changes: 1 addition & 1 deletion applet/src/color_picker.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ typedef struct tColorScheme
const color_scheme_t color_schemes[] =
{ // name fg_color bg_color sel_fg sel_bg edit_fg edit_bg
{ "Black on white", 0x0000, 0xFFFF, 0xFFFF, 0xF800, 0xFFFF, 0x001F },
{ "Cappucino", 0x000D, 0x3C3F, 0x027F, 0x0192, 0x6DBF, 0x019F },
{ "Cappucino", 0x000D, 0x44FF, 0x027F, 0x0192, 0x6DBF, 0x019F },
{ "Cobalt", 0xEE11, 0x38C3, 0x5DFF, 0x7AC4, 0x06FF, 0x9940 },
{ "Greenhouse", 0x1FF1, 0x0100, 0x03E6, 0x6FE0, 0x0AA0, 0x2604 }

Expand Down
15 changes: 7 additions & 8 deletions applet/src/display.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,12 @@ int fDoOnce = 0;

void draw_micbargraph()
{
if( gui_opmode2 == OPM2_MENU ) {
// case for pressing the PTT during 'Manual Dial' in 'Contacts'
if( gui_opmode2 == OPM2_MENU
# if (CONFIG_APP_MENU)
|| Menu_IsVisible()
#endif
) {
// case for pressing the PTT during 'Manual Dial' in 'Contacts', or if 'app menu' is visible
return ;
}

Expand Down Expand Up @@ -465,10 +469,7 @@ void draw_statusline_hook( uint32_t r0 )
}
// NOTE: draw_statusline_hook() isn't called when the squelch
// is 'open' in FM, i.e. when the channel is BUSY .
// Of course we don't want to be tyrannized by the radio like that.
// It's THE OPERATOR'S decision what to do and when to invoke the menu,
// not the radio's.
// Fixed by also calling Menu_DrawIfVisible() from other places .
// -> call Menu_DrawIfVisible() from other places, too.
# endif // CONFIG_APP_MENU ?

if( is_netmon_visible() ) {
Expand Down Expand Up @@ -831,8 +832,6 @@ void draw_adhoc_statusline()
void draw_datetime_row_hook()
{
# if (CONFIG_APP_MENU)
// If the screen is occupied by the optional 'red button menu',
// update or even redraw it completely:
if( Menu_DrawIfVisible(AM_CALLER_DATETIME_HOOK) )
{ return; // the menu covers the entire screen, so don't draw anything else
}
Expand Down
10 changes: 2 additions & 8 deletions applet/src/gfx.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@
#endif


uint8_t GFX_backlight_on=0; // DL4YHF 2017-01-07 : 0="off" (low intensity), 1="on" (high intensity)
// (note: GFX_backlight_on is useless as long as no-one calls lcd_background_led() .
// As long as that's the case, the 'dimmed backlight switcher'
// in applet/src/irq_handlers.c polls backlight_timer instead of GFX_backlight_on . )
uint8_t GFX_backlight_on=0; // not used anywhere ?

//! Draws text at an address by calling back to the MD380 function.

Expand Down Expand Up @@ -102,10 +99,7 @@ void lcd_background_led(int on)
{ // 2017-01-07 : Never called / no effect ? The backlight seems to be controlled "by Tytera only" (backlight_timer).

#if( CONFIG_DIMMED_LIGHT )
GFX_backlight_on = on; // DL4YHF 2017-01-07. Tried to poll this in irq_handlers.c, but didn't work.
// Poll Tytera's 'backlight_timer' instead. Nonzero="bright", zero="dark" .
// With CONFIG_DIMMED_LIGHT=1, the "Lamp" output (PC6) is usually configured
// as UART6_TX, and switching it 'as GPIO' has no effect then.
GFX_backlight_on = on;
#else // ! CONFIG_DIMMED_LIGHT : only completely on or off ...

if (on)
Expand Down
Loading

0 comments on commit 5cc2f99

Please sign in to comment.