@ -146,12 +146,10 @@ void UI_func_engine(uint8_t param);
void UI_func_information ( uint8_t param ) ;
void UI_func_information ( uint8_t param ) ;
void UI_func_voice_selection ( uint8_t param ) ;
void UI_func_voice_selection ( uint8_t param ) ;
void UI_func_volume ( uint8_t param ) ;
void UI_func_volume ( uint8_t param ) ;
void UI_func_back ( uint8_t param ) ;
void UI_function_not_enabled ( void ) ;
void UI_func_goToRootMenu ( uint8_t param ) ;
void lcd_display_int ( int16_t var , uint8_t size , bool zeros , bool brackets , bool sign ) ;
void lcd_display_int ( int16_t var , uint8_t size , bool zeros , bool brackets , bool sign ) ;
void lcd_display_float ( float var , uint8_t size_number , uint8_t size_fraction , bool zeros , bool brackets , bool sign ) ;
void lcd_display_float ( float var , uint8_t size_number , uint8_t size_fraction , bool zeros , bool brackets , bool sign ) ;
// normal menu
// normal menu
LCDMenuLib2_menu LCDML_0 ( 255 , 0 , 0 , NULL , NULL ) ; // normal root menu element (do not change)
LCDMenuLib2_menu LCDML_0 ( 255 , 0 , 0 , NULL , NULL ) ; // normal root menu element (do not change)
LCDMenuLib2 LCDML ( LCDML_0 , _LCDML_DISP_rows , _LCDML_DISP_cols , lcdml_menu_display , lcdml_menu_clear , lcdml_menu_control ) ;
LCDMenuLib2 LCDML ( LCDML_0 , _LCDML_DISP_rows , _LCDML_DISP_cols , lcdml_menu_display , lcdml_menu_clear , lcdml_menu_control ) ;
@ -206,20 +204,20 @@ uint8_t g_LCDML_CONTROL_prev[NUM_ENCODER] = {0, 0};
const uint8_t * flipped_scroll_bar [ 5 ] ;
const uint8_t * flipped_scroll_bar [ 5 ] ;
uint8_t * rotTile ( const uint8_t * tile ) {
uint8_t * rotTile ( const uint8_t * tile ) {
uint8_t * newt = new uint8_t [ 8 ] ;
uint8_t * newt = new uint8_t [ 8 ] ;
for ( int x = 0 ; x < 8 ; x + + ) {
for ( int x = 0 ; x < 8 ; x + + ) {
uint8_t newb = 0 ;
uint8_t newb = 0 ;
for ( int y = 0 ; y < 8 ; y + + ) {
for ( int y = 0 ; y < 8 ; y + + ) {
newb | = ( tile [ y ] < < x ) & 0x80 ;
newb | = ( tile [ y ] < < x ) & 0x80 ;
newb > > = 1 ;
newb > > = 1 ;
}
newt [ x ] = newb ;
}
}
return newt ;
newt [ x ] = newb ;
}
return newt ;
}
}
# endif
# endif
void setup_ui ( void ) {
void setup_ui ( void ) {
// LCD Begin
// LCD Begin
# ifdef I2C_DISPLAY
# ifdef I2C_DISPLAY
lcd . init ( ) ;
lcd . init ( ) ;
@ -245,13 +243,13 @@ void setup_ui(void){
lcd . createChar ( 2 , ( uint8_t * ) scroll_bar [ 2 ] ) ;
lcd . createChar ( 2 , ( uint8_t * ) scroll_bar [ 2 ] ) ;
lcd . createChar ( 3 , ( uint8_t * ) scroll_bar [ 3 ] ) ;
lcd . createChar ( 3 , ( uint8_t * ) scroll_bar [ 3 ] ) ;
lcd . createChar ( 4 , ( uint8_t * ) scroll_bar [ 4 ] ) ;
lcd . createChar ( 4 , ( uint8_t * ) scroll_bar [ 4 ] ) ;
# else
# else
for ( int x = 0 ; x < 5 ; x + + ) {
for ( int x = 0 ; x < 5 ; x + + ) {
flipped_scroll_bar [ x ] = rotTile ( scroll_bar [ x ] ) ;
flipped_scroll_bar [ x ] = rotTile ( scroll_bar [ x ] ) ;
}
}
# endif
# endif
// LCDMenuLib Setup
// LCDMenuLib Setup
LCDML_setup ( _LCDML_DISP_cnt ) ;
LCDML_setup ( _LCDML_DISP_cnt ) ;
// Enable Menu Rollover
// Enable Menu Rollover
//LCDML.MENU_enRollover();
//LCDML.MENU_enRollover();
@ -458,7 +456,7 @@ void encoder_right_up(void)
change_disp_sd ( true ) ;
change_disp_sd ( true ) ;
# endif
# endif
eeprom_write ( ) ;
eeprom_write ( ) ;
}
}
UI_func_voice_selection ( 0 ) ;
UI_func_voice_selection ( 0 ) ;
break ;
break ;
@ -698,9 +696,9 @@ void lcdml_menu_display(void)
# ifdef I2C_DISPLAY
# ifdef I2C_DISPLAY
lcd . setCursor ( ( _LCDML_DISP_cols - 1 ) , n ) ;
lcd . setCursor ( ( _LCDML_DISP_cols - 1 ) , n ) ;
lcd . write ( ( uint8_t ) 0 ) ;
lcd . write ( ( uint8_t ) 0 ) ;
# else
# else
lcd . drawTile ( ( _LCDML_DISP_cols - 1 ) , n , 1 , flipped_scroll_bar [ 0 ] ) ;
lcd . drawTile ( ( _LCDML_DISP_cols - 1 ) , n , 1 , flipped_scroll_bar [ 0 ] ) ;
lcd . setCursor ( ( _LCDML_DISP_cols ) , n + 1 ) ;
lcd . setCursor ( ( _LCDML_DISP_cols ) , n + 1 ) ;
# endif
# endif
}
}
else {
else {
@ -719,27 +717,27 @@ void lcdml_menu_display(void)
# ifdef I2C_DISPLAY
# ifdef I2C_DISPLAY
lcd . setCursor ( ( _LCDML_DISP_cols - 1 ) , 0 ) ;
lcd . setCursor ( ( _LCDML_DISP_cols - 1 ) , 0 ) ;
lcd . write ( ( uint8_t ) 1 ) ;
lcd . write ( ( uint8_t ) 1 ) ;
# else
# else
lcd . drawTile ( ( _LCDML_DISP_cols - 1 ) , 0 , 1 , flipped_scroll_bar [ 1 ] ) ;
lcd . drawTile ( ( _LCDML_DISP_cols - 1 ) , 0 , 1 , flipped_scroll_bar [ 1 ] ) ;
lcd . setCursor ( ( _LCDML_DISP_cols ) , 1 ) ;
lcd . setCursor ( ( _LCDML_DISP_cols ) , 1 ) ;
# endif
# endif
} else if ( scrollbar_cur_pos = = ( scrollbar_max - 1 ) ) {
} else if ( scrollbar_cur_pos = = ( scrollbar_max - 1 ) ) {
// max pos
// max pos
# ifdef I2C_DISPLAY
# ifdef I2C_DISPLAY
lcd . setCursor ( ( _LCDML_DISP_cols - 1 ) , ( n_max - 1 ) ) ;
lcd . setCursor ( ( _LCDML_DISP_cols - 1 ) , ( n_max - 1 ) ) ;
lcd . write ( ( uint8_t ) 4 ) ;
lcd . write ( ( uint8_t ) 4 ) ;
# else
# else
lcd . drawTile ( ( _LCDML_DISP_cols - 1 ) , ( n_max - 1 ) , 1 , flipped_scroll_bar [ 4 ] ) ;
lcd . drawTile ( ( _LCDML_DISP_cols - 1 ) , ( n_max - 1 ) , 1 , flipped_scroll_bar [ 4 ] ) ;
lcd . setCursor ( ( _LCDML_DISP_cols ) , ( n_max ) ) ;
lcd . setCursor ( ( _LCDML_DISP_cols ) , ( n_max ) ) ;
# endif
# endif
} else {
} else {
// between
// between
# ifdef I2C_DISPLAY
# ifdef I2C_DISPLAY
lcd . setCursor ( ( _LCDML_DISP_cols - 1 ) , scroll_pos / n_max ) ;
lcd . setCursor ( ( _LCDML_DISP_cols - 1 ) , scroll_pos / n_max ) ;
lcd . write ( ( uint8_t ) ( scroll_pos % n_max ) + 1 ) ;
lcd . write ( ( uint8_t ) ( scroll_pos % n_max ) + 1 ) ;
# else
# else
lcd . drawTile ( ( _LCDML_DISP_cols - 1 ) , scroll_pos / n_max , 1 , flipped_scroll_bar [ ( scroll_pos % n_max ) + 1 ] ) ;
lcd . drawTile ( ( _LCDML_DISP_cols - 1 ) , scroll_pos / n_max , 1 , flipped_scroll_bar [ ( scroll_pos % n_max ) + 1 ] ) ;
lcd . setCursor ( ( _LCDML_DISP_cols ) , ( scroll_pos / n_max ) + 1 ) ;
lcd . setCursor ( ( _LCDML_DISP_cols ) , ( scroll_pos / n_max ) + 1 ) ;
# endif
# endif
}
}
}
}
@ -777,6 +775,7 @@ void UI_func_sound(uint8_t param)
void UI_func_reverb_roomsize ( uint8_t param )
void UI_func_reverb_roomsize ( uint8_t param )
{
{
# ifdef USE_REVERB
if ( LCDML . FUNC_setup ( ) ) // ****** SETUP *********
if ( LCDML . FUNC_setup ( ) ) // ****** SETUP *********
{
{
// setup function
// setup function
@ -816,10 +815,14 @@ void UI_func_reverb_roomsize(uint8_t param)
// you can here reset some global vars or do nothing
// you can here reset some global vars or do nothing
eeprom_write ( ) ;
eeprom_write ( ) ;
}
}
# else
UI_function_not_enabled ( ) ;
# endif
}
}
void UI_func_reverb_damping ( uint8_t param )
void UI_func_reverb_damping ( uint8_t param )
{
{
# ifdef USE_REVERB
if ( LCDML . FUNC_setup ( ) ) // ****** SETUP *********
if ( LCDML . FUNC_setup ( ) ) // ****** SETUP *********
{
{
// setup function
// setup function
@ -859,10 +862,14 @@ void UI_func_reverb_damping(uint8_t param)
// you can here reset some global vars or do nothing
// you can here reset some global vars or do nothing
eeprom_write ( ) ;
eeprom_write ( ) ;
}
}
# else
UI_function_not_enabled ( ) ;
# endif
}
}
void UI_func_reverb_level ( uint8_t param )
void UI_func_reverb_level ( uint8_t param )
{
{
# ifdef USE_REVERB
if ( LCDML . FUNC_setup ( ) ) // ****** SETUP *********
if ( LCDML . FUNC_setup ( ) ) // ****** SETUP *********
{
{
// setup function
// setup function
@ -904,6 +911,9 @@ void UI_func_reverb_level(uint8_t param)
// you can here reset some global vars or do nothing
// you can here reset some global vars or do nothing
eeprom_write ( ) ;
eeprom_write ( ) ;
}
}
# else
UI_function_not_enabled ( ) ;
# endif
}
}
void UI_func_chorus_frequency ( uint8_t param )
void UI_func_chorus_frequency ( uint8_t param )
@ -1677,7 +1687,7 @@ void UI_func_voice_selection(uint8_t param)
break ;
break ;
}
}
for ( int x = 2 ; x < LCD_rows ; x + + ) {
for ( int x = 2 ; x < LCD_rows ; x + + ) {
lcd . show ( x , 0 , LCD_cols + 1 , " " ) ;
lcd . show ( x , 0 , LCD_cols + 1 , " " ) ;
}
}
}
}
@ -1706,12 +1716,37 @@ void UI_func_volume(uint8_t param)
lcd . show ( 1 , 15 , 1 , " ] " ) ;
lcd . show ( 1 , 15 , 1 , " ] " ) ;
}
}
void UI_function_not_enabled ( void )
{
if ( LCDML . FUNC_setup ( ) ) // ****** SETUP *********
{
// setup function
lcd . setCursor ( 0 , 0 ) ;
lcd . print ( F ( " Function not " ) ) ;
lcd . setCursor ( 0 , 1 ) ;
lcd . print ( F ( " enabled! " ) ) ;
}
if ( LCDML . FUNC_loop ( ) ) // ****** LOOP *********
{
if ( LCDML . BT_checkEnter ( ) )
{
LCDML . FUNC_goBackToMenu ( ) ;
}
}
if ( LCDML . FUNC_close ( ) ) // ****** STABLE END *********
{
// you can here reset some global vars or do nothing
}
}
void lcd_display_int ( int16_t var , uint8_t size , bool zeros , bool brackets , bool sign )
void lcd_display_int ( int16_t var , uint8_t size , bool zeros , bool brackets , bool sign )
{
{
int16_t tmp = 0 ;
int16_t tmp = 0 ;
uint16_t p ;
uint16_t p ;
bool non_zero_found = false ;
bool non_zero_found = false ;
if ( size < 1 )
if ( size < 1 )
return ;
return ;
@ -1736,6 +1771,7 @@ void lcd_display_int(int16_t var, uint8_t size, bool zeros, bool brackets, bool
{
{
p = int ( pow ( 10 , i ) ) ;
p = int ( pow ( 10 , i ) ) ;
tmp = int ( var / p ) ;
tmp = int ( var / p ) ;
if ( tmp = = 0 )
if ( tmp = = 0 )
{
{
if ( zeros = = true )
if ( zeros = = true )
@ -1773,7 +1809,15 @@ void lcd_display_float(float var, uint8_t size_number, uint8_t size_fraction, bo
if ( brackets = = true )
if ( brackets = = true )
lcd . print ( F ( " [ " ) ) ;
lcd . print ( F ( " [ " ) ) ;
lcd_display_int ( int ( number ) , size_number , zeros , false , sign ) ;
if ( int ( number ) = = 0 )
{
if ( zeros = = true )
lcd . print ( F ( " 00 " ) ) ;
else
lcd . print ( F ( " 0 " ) ) ;
}
else
lcd_display_int ( int ( number ) , size_number , zeros , false , sign ) ;
lcd . print ( F ( " . " ) ) ;
lcd . print ( F ( " . " ) ) ;
lcd_display_int ( round ( fraction * pow ( 10 , size_fraction ) ) , size_fraction , true , false , false ) ;
lcd_display_int ( round ( fraction * pow ( 10 , size_fraction ) ) , size_fraction , true , false , false ) ;