Exemple #1
0
/////////////////////////////////////////////////////////////////////////////
// Local Display Handler function
// IN: <high_prio>: if set, a high-priority LCD update is requested
/////////////////////////////////////////////////////////////////////////////
static s32 LCD_Handler(u8 high_prio)
{
  // layout:
  // 00000000001111111111222222222233333333330000000000111111111122222222223333333333
  // 01234567890123456789012345678901234567890123456789012345678901234567890123456789
  // <--------------------------------------><-------------------------------------->
  // USB1 USB2 USB3 USB4 IN1  IN2  IN3  IN4                      OSC1 OSC2 OSC3 OSC4
  // USB1 USB2 USB3 USB4 OUT1 OUT2 OUT3 OUT4 IIC1 IIC2 IIC3 IIC4 OSC1 OSC2 OSC3 OSC4


  //   Filter               Filter
  // MIDI Clock: on      Active Sense: on


  if( seq_ui_button_state.SELECT_PRESSED ) {
    if( high_prio )
      return 0;

    seq_midi_port_mon_filter_t mon_filter = SEQ_MIDI_PORT_MonFilterGet();

    SEQ_LCD_CursorSet(0, 0);
    SEQ_LCD_PrintSpaces(2);
    SEQ_LCD_PrintString("Filter");
    SEQ_LCD_PrintSpaces(15);
    SEQ_LCD_PrintString("Filter");
    SEQ_LCD_PrintSpaces(11 + 40);


    SEQ_LCD_CursorSet(0, 1);
    SEQ_LCD_PrintFormattedString("MIDI Clock: %s", mon_filter.MIDI_CLOCK ? "on " : "off");
    SEQ_LCD_PrintSpaces(5);
    SEQ_LCD_PrintFormattedString("Active Sense: %s", mon_filter.ACTIVE_SENSE ? "on " : "off");
    SEQ_LCD_PrintSpaces(3 + 40);
  }

  ///////////////////////////////////////////////////////////////////////////
  u8 port_num = SEQ_MIDI_PORT_OutNumGet();
  if( port_num > 17 )
    port_num = 17;

  u8 port_ix;

  if( high_prio ) {
    u16 in_activity = 0;
    u16 out_activity = 0;

    for(port_ix=1; port_ix<port_num; ++port_ix) {

      SEQ_LCD_CursorSet(5*(port_ix-1), 0);
      // dirty! but only way to ensure that OSC1..OSC4 are aligned
      if( port_ix >= 9 && port_ix <= 12 ) {
	SEQ_LCD_PrintSpaces(5);
      } else {
	u8 port_ix_midi_in = (port_ix >= 9) ? (port_ix - 4) : port_ix;

	mios32_midi_port_t port = SEQ_MIDI_PORT_InPortGet(port_ix_midi_in);
	mios32_midi_package_t package = SEQ_MIDI_PORT_InPackageGet(port);
	if( port == 0xff ) {
	  SEQ_LCD_PrintSpaces(5);
	} else if( package.type ) {
	  SEQ_LCD_PrintEvent(package, 5);
	  in_activity |= (1 << (port_ix-1));
	} else {
	  SEQ_LCD_PrintString(SEQ_MIDI_PORT_InNameGet(port_ix_midi_in));
	  SEQ_LCD_PrintChar(' ');
	}
      }

      SEQ_LCD_CursorSet(5*(port_ix-1), 1);
      mios32_midi_port_t port = SEQ_MIDI_PORT_OutPortGet(port_ix);
      mios32_midi_package_t package = SEQ_MIDI_PORT_OutPackageGet(port);
      if( port == 0xff ) {
	SEQ_LCD_PrintSpaces(5);
      } else if( package.type ) {
	SEQ_LCD_PrintEvent(package, 5);
	out_activity |= (1 << (port_ix-1));
      } else {
	SEQ_LCD_PrintString(SEQ_MIDI_PORT_OutNameGet(port_ix));
	SEQ_LCD_PrintChar(' ');
      }
    }

    midi_activity = in_activity | out_activity;

    return 0;
  }

  return 0; // no error
}
/////////////////////////////////////////////////////////////////////////////
// Local button callback function
// Should return:
//   1 if value has been changed
//   0 if value hasn't been changed
//  -1 if invalid or unsupported button
/////////////////////////////////////////////////////////////////////////////
static s32 Button_Handler(seq_ui_button_t button, s32 depressed)
{
  if( depressed ) return 0; // ignore when button depressed

#if 0
  // leads to: comparison is always true due to limited range of data type
  if( button >= SEQ_UI_BUTTON_GP1 && button <= SEQ_UI_BUTTON_GP16 ) {
#else
  if( button <= SEQ_UI_BUTTON_GP16 ) {
#endif
    // re-use encoder handler - only select UI item, don't increment, flags will be toggled
    return Encoder_Handler((int)button, 0);
  }

  // remaining buttons:
  switch( button ) {
    case SEQ_UI_BUTTON_Select:
    case SEQ_UI_BUTTON_Right:
      if( ++ui_selected_item >= NUM_OF_ITEMS )
	ui_selected_item = 0;
      SetSubpageBasedOnItem(ui_selected_item);
      return 1; // value always changed

    case SEQ_UI_BUTTON_Left:
      if( ui_selected_item == 0 )
	ui_selected_item = NUM_OF_ITEMS-1;
      else
	--ui_selected_item;
      SetSubpageBasedOnItem(ui_selected_item);
      return 1; // value always changed

    case SEQ_UI_BUTTON_Up:
      return Encoder_Handler(SEQ_UI_ENCODER_Datawheel, 1);

    case SEQ_UI_BUTTON_Down:
      return Encoder_Handler(SEQ_UI_ENCODER_Datawheel, -1);
  }

  return -1; // invalid or unsupported button
}


/////////////////////////////////////////////////////////////////////////////
// Local Display Handler function
// IN: <high_prio>: if set, a high-priority LCD update is requested
/////////////////////////////////////////////////////////////////////////////
static s32 LCD_Handler(u8 high_prio)
{
  if( high_prio )
    return 0; // there are no high-priority updates

  // layout:
  // 00000000001111111111222222222233333333330000000000111111111122222222223333333333
  // 01234567890123456789012345678901234567890123456789012345678901234567890123456789
  // <--------------------------------------><-------------------------------------->
  // Transposer  Section    MIDI   Ext.       Bus Port Chn. Lower/Upper Mode   Reset 
  //  and Arp.   Control   Router  Ctrl Misc.  1  IN1  #16   ---   ---  T&A    Stacks

  // Transposer  Section    MIDI   Ext.      Port Chn.  G1   G2   G3   G4  Fwd  Reset
  //  and Arp.   Control   Router  Ctrl Misc. All #16  C-1  C-2  C-3  C-4  USB1 Stcks

  // Transposer  Section    MIDI   Ext.      Node IN P/Chn  OUT P/Chn   | DefaultPort
  //  and Arp.   Control   Router  Ctrl Misc. #1  Def. All  Def. # 1    |    USB1    

  // Transposer  Section    MIDI   Ext.      Port Chn.      Function        CC#      
  // Transposer  Section    MIDI   Ext.       IN  OUT Chn.| Function        CC#      
  //  and Arp.   Control   Router  Ctrl Misc. All off --- | Morph Value       1      

  // Transposer  Section    MIDI   Ext.      BLM_SCALAR                       MIDI   
  //  and Arp.   Control   Router  Ctrl Misc.Port: OUT2                     Monitor 


  seq_midi_router_node_t *n = &seq_midi_router_node[selected_router_node];

  ///////////////////////////////////////////////////////////////////////////
//<<<<<<< .mine
 /*
  const char leftpage[2][41] = {
    "Transposer  Section    MIDI             ",
    " and Arp.   Control   Router    Misc.   "
  };
=======
*/
  SEQ_LCD_CursorSet(0, 0);
  SEQ_LCD_PrintString("Transposer  Section    MIDI   Ext.      ");
  SEQ_LCD_CursorSet(0, 1);
  SEQ_LCD_PrintString(" and Arp.   Control   Router  Ctrl Misc.");
//>>>>>>> .r1826

  if( ui_cursor_flash && selected_subpage <= 5 ) {
    const u8 select_pos1[5]  = {  0, 10, 20, 30, 35 };
    const u8 select_width[5] = { 10, 10, 10,  5,  5 };

    int line;
    for(line=0; line<2; ++line) {
      SEQ_LCD_CursorSet(select_pos1[selected_subpage], line);
      SEQ_LCD_PrintSpaces(select_width[selected_subpage]);
    }
  }
/*
	SEQ_LCD_CursorSet(0, 0);
	if (selected_subpage == SUBPAGE_TRANSPOSE && ui_cursor_flash) {
		SEQ_LCD_PrintSpaces(21);
	} else {
		SEQ_LCD_PrintString(" Transposer and Arp ");
    }
	SEQ_LCD_CursorSet(0, 1);
	if (selected_subpage == SUBPAGE_SECTIONS && ui_cursor_flash) {
		SEQ_LCD_PrintSpaces(21);
	} else {
		SEQ_LCD_PrintString("   Section control   ");
    }
	SEQ_LCD_CursorSet(0, 2);
	if (selected_subpage == SUBPAGE_ROUTER && ui_cursor_flash) {
		SEQ_LCD_PrintSpaces(21);
	} else {
		SEQ_LCD_PrintString("     MIDI router     ");
    }
	SEQ_LCD_CursorSet(0, 3);
	if (selected_subpage == SUBPAGE_MISC && ui_cursor_flash) {
		SEQ_LCD_PrintSpaces(21);
	} else {
		SEQ_LCD_PrintString("     Miscilenious     ");
    }
	*/
	SEQ_LCD_CursorSet(0, 4);
	
  switch( selected_subpage ) {
  ///////////////////////////////////////////////////////////////////////////
    case SUBPAGE_TRANSPOSE: {

	  //SEQ_LCD_CursorSet(40, 0);
      SEQ_LCD_PrintString(" Bus Port Chn. Mode  ");
	  SEQ_LCD_CursorSet(0, 6);
	  SEQ_LCD_PrintString(" Lower/Upper   Reset ");
      SEQ_LCD_CursorSet(0, 5);

      ///////////////////////////////////////////////////////////////////////
      if( ui_selected_item == ITEM_IN_BUS && ui_cursor_flash ) {
	SEQ_LCD_PrintSpaces(5);
      } else {
	SEQ_LCD_PrintFormattedString("  %d  ", selected_bus+1);
      }

      ///////////////////////////////////////////////////////////////////////
      if( ui_selected_item == ITEM_IN_PORT && ui_cursor_flash ) {
	SEQ_LCD_PrintSpaces(4);
      } else {
	if( seq_midi_in_port[selected_bus] )
	  SEQ_LCD_PrintString(SEQ_MIDI_PORT_InNameGet(SEQ_MIDI_PORT_InIxGet(seq_midi_in_port[selected_bus])));
	else
	  SEQ_LCD_PrintString(" All");
      }
      SEQ_LCD_PrintSpaces(1);


      ///////////////////////////////////////////////////////////////////////
      if( ui_selected_item == ITEM_IN_CHN && ui_cursor_flash ) {
	SEQ_LCD_PrintSpaces(3);
      } else {
	if( seq_midi_in_channel[selected_bus] )
	  SEQ_LCD_PrintFormattedString("#%2d", seq_midi_in_channel[selected_bus]);
	else
	  SEQ_LCD_PrintString("---");
      }
      SEQ_LCD_PrintSpaces(3);

/*
      ///////////////////////////////////////////////////////////////////////
      if( ui_selected_item == ITEM_IN_MODE && ui_cursor_flash ) {
	SEQ_LCD_PrintSpaces(4);
      } else {
	SEQ_LCD_PrintString(seq_midi_in_options[selected_bus].MODE_PLAY ? "Play" : "T&A ");
      }
      SEQ_LCD_PrintSpaces(3);	  
	  
	  SEQ_LCD_CursorSet(0, 7);
*/	  
      ///////////////////////////////////////////////////////////////////////
      if( ui_selected_item == ITEM_IN_LOWER && ui_cursor_flash ) {
	SEQ_LCD_PrintSpaces(3);
      } else {
	SEQ_LCD_PrintNote(seq_midi_in_lower[selected_bus]);
      }
      SEQ_LCD_PrintSpaces(3);


      ///////////////////////////////////////////////////////////////////////
      if( ui_selected_item == ITEM_IN_UPPER && ui_cursor_flash ) {
	SEQ_LCD_PrintSpaces(3);
      } else {
	SEQ_LCD_PrintNote(seq_midi_in_upper[selected_bus]);
      }
      SEQ_LCD_PrintSpaces(2);


      ///////////////////////////////////////////////////////////////////////
      if( ui_selected_item == ITEM_IN_MODE && ui_cursor_flash ) {
	SEQ_LCD_PrintSpaces(4);
      } else {
	SEQ_LCD_PrintString(seq_midi_in_options[selected_bus].MODE_PLAY ? "Play" : "T&A ");
      }
      SEQ_LCD_PrintSpaces(3);

	  
      SEQ_LCD_PrintString("Stacks");
    } break;


  ///////////////////////////////////////////////////////////////////////////
    case SUBPAGE_SECTIONS: {
      //SEQ_LCD_CursorSet(40, 0);
      SEQ_LCD_PrintString(" Port Chn.  G1   G2  "); 
      SEQ_LCD_CursorSet(0, 6);
	  SEQ_LCD_PrintString(" G3   G4  Fwd  Reset ");

	  SEQ_LCD_CursorSet(0, 5);
	  
      ///////////////////////////////////////////////////////////////////////
      if( ui_selected_item == ITEM_S_PORT && ui_cursor_flash ) {
	SEQ_LCD_PrintSpaces(4);
      } else {
	if( seq_midi_in_sect_port )
	  SEQ_LCD_PrintString(SEQ_MIDI_PORT_InNameGet(SEQ_MIDI_PORT_InIxGet(seq_midi_in_sect_port)));
	else
	  SEQ_LCD_PrintString(" All");
      }
      SEQ_LCD_PrintSpaces(1);

      ///////////////////////////////////////////////////////////////////////
      if( ui_selected_item == ITEM_S_CHN && ui_cursor_flash ) {
	SEQ_LCD_PrintSpaces(3);
      } else {
	if( seq_midi_in_sect_channel )
	  SEQ_LCD_PrintFormattedString("#%2d", seq_midi_in_sect_channel);
	else
	  SEQ_LCD_PrintString("---");
      }
      SEQ_LCD_PrintSpaces(2);

      ///////////////////////////////////////////////////////////////////////
      if( ui_selected_item == ITEM_S_OCT_G1 && ui_cursor_flash ) {
	SEQ_LCD_PrintSpaces(3);
      } else {
	SEQ_LCD_PrintNote(seq_midi_in_sect_note[0]);
      }
      SEQ_LCD_PrintSpaces(2);

      ///////////////////////////////////////////////////////////////////////
      if( ui_selected_item == ITEM_S_OCT_G2 && ui_cursor_flash ) {
	SEQ_LCD_PrintSpaces(3);
      } else {
	SEQ_LCD_PrintNote(seq_midi_in_sect_note[1]);
      }
      SEQ_LCD_PrintSpaces(2);

	  
	  SEQ_LCD_CursorSet(0, 5);
	  
      ///////////////////////////////////////////////////////////////////////
      if( ui_selected_item == ITEM_S_OCT_G3 && ui_cursor_flash ) {
	SEQ_LCD_PrintSpaces(3);
      } else {
	SEQ_LCD_PrintNote(seq_midi_in_sect_note[2]);
      }
      SEQ_LCD_PrintSpaces(2);

      ///////////////////////////////////////////////////////////////////////
      if( ui_selected_item == ITEM_S_OCT_G4 && ui_cursor_flash ) {
	SEQ_LCD_PrintSpaces(3);
      } else {
	SEQ_LCD_PrintNote(seq_midi_in_sect_note[3]);
      }

      SEQ_LCD_PrintSpaces(2);

      ///////////////////////////////////////////////////////////////////////
      if( ui_selected_item == ITEM_S_FWD_PORT && ui_cursor_flash ) {
	SEQ_LCD_PrintSpaces(4);
      } else {
	if( seq_midi_in_sect_fwd_port == 0 )
	  SEQ_LCD_PrintString("----");
	else
	  SEQ_LCD_PrintString(SEQ_MIDI_PORT_OutNameGet(SEQ_MIDI_PORT_OutIxGet(seq_midi_in_sect_fwd_port)));
      }

      SEQ_LCD_PrintSpaces(1);
      SEQ_LCD_PrintString("Stcks");
    } break;


  ///////////////////////////////////////////////////////////////////////////
    case SUBPAGE_ROUTER: {
//<<<<<<< .mine
      //SEQ_LCD_CursorSet(40, 0);
      SEQ_LCD_PrintString(" Node  IN Port/Chn   "); 
	  SEQ_LCD_CursorSet(0, 6);
	  SEQ_LCD_PrintString("OUT Port/Chn Def.Port");
      SEQ_LCD_CursorSet(0, 5);
/*
	  =======
      SEQ_LCD_CursorSet(40, 0);
      SEQ_LCD_PrintString("Node IN P/Chn  OUT P/Chn   | DefaultPort");
      SEQ_LCD_CursorSet(40, 1);
>>>>>>> .r1826
*/
      ///////////////////////////////////////////////////////////////////////
      SEQ_LCD_PrintSpaces(1);
      if( ui_selected_item == ITEM_R_NODE && ui_cursor_flash ) {
	SEQ_LCD_PrintSpaces(3);
      } else {
	SEQ_LCD_PrintFormattedString("#%2d", selected_router_node+1);
      }
      SEQ_LCD_PrintSpaces(1);

      ///////////////////////////////////////////////////////////////////////
      if( ui_selected_item == ITEM_R_SRC_PORT && ui_cursor_flash ) {
	SEQ_LCD_PrintSpaces(4);
      } else {
	SEQ_LCD_PrintString(SEQ_MIDI_PORT_InNameGet(SEQ_MIDI_PORT_InIxGet(n->src_port)));
      }
      SEQ_LCD_PrintSpaces(1);

      ///////////////////////////////////////////////////////////////////////
      if( ui_selected_item == ITEM_R_SRC_CHN && ui_cursor_flash ) {
	SEQ_LCD_PrintSpaces(3);
      } else {
	if( !n->src_chn ) {
	  SEQ_LCD_PrintString("---");
	} else if( n->src_chn > 16 ) {
	  SEQ_LCD_PrintString("All");
	} else {
	  SEQ_LCD_PrintFormattedString("#%2d", n->src_chn);
	}
      }
      SEQ_LCD_PrintSpaces(2);

	  SEQ_LCD_CursorSet(0, 7);
	  
      ///////////////////////////////////////////////////////////////////////
      if( ui_selected_item == ITEM_R_DST_PORT && ui_cursor_flash ) {
	if( n->dst_chn >= 18 ) {
	  SEQ_LCD_PrintSpaces(2);
	} else {
	  SEQ_LCD_PrintSpaces(4);
	}
      } else {
	if( n->dst_chn >= 18 ) {
	  SEQ_LCD_PrintSpaces(2);
	} else {
	  SEQ_LCD_PrintString(SEQ_MIDI_PORT_OutNameGet(SEQ_MIDI_PORT_OutIxGet(n->dst_port)));
	}
      }

      ///////////////////////////////////////////////////////////////////////
      if( ui_selected_item == ITEM_R_DST_CHN && ui_cursor_flash ) {
	if( n->dst_chn >= 18 ) {
	  SEQ_LCD_PrintSpaces(7);
	} else {
	  SEQ_LCD_PrintSpaces(5);
	}
      } else {
	if( !n->dst_chn ) {
	  SEQ_LCD_PrintString(" --- ");
	} else if( n->dst_chn == 17 ) {
	  SEQ_LCD_PrintString(" All ");
	} else if( n->dst_chn == 18 ) {
	  SEQ_LCD_PrintString("  Track");
	} else if( n->dst_chn >= 19 ) {
	  SEQ_LCD_PrintString("Sel.Trk");
	} else {
	  SEQ_LCD_PrintFormattedString(" #%2d ", n->dst_chn);
	}
      }
      SEQ_LCD_PrintSpaces(3);

      ///////////////////////////////////////////////////////////////////////
      SEQ_LCD_PrintChar('|');
      SEQ_LCD_PrintSpaces(4);

      if( ui_selected_item == ITEM_DEF_PORT && ui_cursor_flash ) {
	SEQ_LCD_PrintSpaces(4);
      } else {
	SEQ_LCD_PrintString(SEQ_MIDI_PORT_OutNameGet(SEQ_MIDI_PORT_OutIxGet(MIOS32_MIDI_DefaultPortGet())));
      }
      SEQ_LCD_PrintSpaces(4);
    } break;


  ///////////////////////////////////////////////////////////////////////////
    case SUBPAGE_EXT_CTRL: {
      SEQ_LCD_CursorSet(40, 0);
      SEQ_LCD_PrintString(" IN  OUT  Chn.|Function        ");
      if( selected_ext_ctrl < SEQ_MIDI_IN_EXT_CTRL_NUM_IX_CC ) {
	SEQ_LCD_PrintString("CC#      ");
      } else {
	SEQ_LCD_PrintSpaces(10);
      }
      SEQ_LCD_CursorSet(40, 1);

      ///////////////////////////////////////////////////////////////////////
      if( ui_selected_item == ITEM_EXT_PORT && ui_cursor_flash ) {
	SEQ_LCD_PrintSpaces(4);
      } else {
	if( seq_midi_in_ext_ctrl_port == 0xff )
	  SEQ_LCD_PrintString(" All");
	else if( !seq_midi_in_ext_ctrl_port )
	  SEQ_LCD_PrintString(" off");
	else
	  SEQ_LCD_PrintString(SEQ_MIDI_PORT_InNameGet(SEQ_MIDI_PORT_InIxGet(seq_midi_in_ext_ctrl_port)));
      }
      SEQ_LCD_PrintSpaces(1);

      ///////////////////////////////////////////////////////////////////////
      if( ui_selected_item == ITEM_EXT_PORT_OUT && ui_cursor_flash ) {
	SEQ_LCD_PrintSpaces(4);
      } else {
	if( seq_midi_in_ext_ctrl_out_port )
	  SEQ_LCD_PrintString(SEQ_MIDI_PORT_OutNameGet(SEQ_MIDI_PORT_OutIxGet(seq_midi_in_ext_ctrl_out_port)));
	else
	  SEQ_LCD_PrintString("off ");
      }
      SEQ_LCD_PrintSpaces(1);

      ///////////////////////////////////////////////////////////////////////
      if( ui_selected_item == ITEM_EXT_CHN && ui_cursor_flash ) {
	SEQ_LCD_PrintSpaces(3);
      } else {
	if( seq_midi_in_ext_ctrl_channel )
	  SEQ_LCD_PrintFormattedString("#%2d", seq_midi_in_ext_ctrl_channel);
	else
	  SEQ_LCD_PrintString("---");
      }
      SEQ_LCD_PrintString(" |");

      ///////////////////////////////////////////////////////////////////////
      if( ui_selected_item == ITEM_EXT_CTRL && ui_cursor_flash ) {
	SEQ_LCD_PrintSpaces(15);
      } else {
	SEQ_LCD_PrintStringPadded((char *)SEQ_MIDI_IN_ExtCtrlStr(selected_ext_ctrl), 15);
      }


      ///////////////////////////////////////////////////////////////////////
      if( ui_selected_item == ITEM_EXT_VALUE && ui_cursor_flash ) {
	SEQ_LCD_PrintSpaces(10);
      } else {
	SEQ_LCD_PrintSpaces(1);
	if( selected_ext_ctrl == SEQ_MIDI_IN_EXT_CTRL_NRPN_ENABLED ) {
	  SEQ_LCD_PrintStringPadded(seq_midi_in_ext_ctrl_asg[selected_ext_ctrl] ? "enabled" : "disabled", 9);
	} else if( selected_ext_ctrl == SEQ_MIDI_IN_EXT_CTRL_PC_MODE ) {
	  SEQ_LCD_PrintStringPadded((char *)SEQ_MIDI_IN_ExtCtrlPcModeStr(seq_midi_in_ext_ctrl_asg[selected_ext_ctrl]), 9);
	} else {
	  u8 cc = seq_midi_in_ext_ctrl_asg[selected_ext_ctrl];
	  if( cc >= 0x80 )
	    SEQ_LCD_PrintString("off");
	  else
	    SEQ_LCD_PrintFormattedString("%3d", cc);
	  SEQ_LCD_PrintSpaces(7);
	}
      }

    } break;


  ///////////////////////////////////////////////////////////////////////////
    case SUBPAGE_MISC: {
      //SEQ_LCD_CursorSet(40, 0);
//<<<<<<< .mine
      SEQ_LCD_PrintString("BLM_SCALAR ");
      SEQ_LCD_PrintString(blm_timeout_ctr ? "connected  " : "not found ");
      SEQ_LCD_CursorSet(0, 6);
	  SEQ_LCD_PrintString("         MIDI   ");
      SEQ_LCD_CursorSet(0, 5);
/*
	  =======
      SEQ_LCD_PrintString("BLM_SCALAR                       MIDI   ");
      SEQ_LCD_CursorSet(40, 1);
>>>>>>> .r1826
*/
      ///////////////////////////////////////////////////////////////////////
      SEQ_LCD_PrintString("Port: ");
      if( ui_selected_item == ITEM_BLM_SCALAR_PORT && ui_cursor_flash ) {
	SEQ_LCD_PrintSpaces(4);
      } else {
	if( !seq_blm_port )
	  SEQ_LCD_PrintString(" off");
	else
	  SEQ_LCD_PrintString(SEQ_MIDI_PORT_InNameGet(SEQ_MIDI_PORT_InIxGet(seq_blm_port)));
      }

//<<<<<<< .mine
	  SEQ_LCD_CursorSet(0, 7);
	  
//=======
      SEQ_LCD_PrintString(blm_timeout_ctr ? " (found)  " : "          ");

      // free for new parameters
      SEQ_LCD_PrintSpaces(12);

//>>>>>>> .r1826
      ///////////////////////////////////////////////////////////////////////
      SEQ_LCD_PrintString("Monitor ");

    } break;
  }

  return 0; // no error
}


/////////////////////////////////////////////////////////////////////////////
// Local exit function
/////////////////////////////////////////////////////////////////////////////
static s32 EXIT_Handler(void)
{
  s32 status = 0;

  if( store_file_required ) {
    // write config files
    MUTEX_SDCARD_TAKE;
    if( (status=SEQ_FILE_C_Write(seq_file_session_name)) < 0 )
      SEQ_UI_SDCardErrMsg(2000, status);
    MUTEX_SDCARD_GIVE;

    MUTEX_SDCARD_TAKE;
    if( (status=SEQ_FILE_GC_Write()) < 0 )
      SEQ_UI_SDCardErrMsg(2000, status);
    MUTEX_SDCARD_GIVE;
  }

  return status;
}
/////////////////////////////////////////////////////////////////////////////
// Local Display Handler function
// IN: <high_prio>: if set, a high-priority LCD update is requested
/////////////////////////////////////////////////////////////////////////////
static s32 LCD_Handler(u8 high_prio)
{
  u8 visible_track = SEQ_UI_VisibleTrackGet();

  if( high_prio )
    return 0; // there are no high-priority updates

  // layout:
  // 00000000001111111111222222222233333333330000000000111111111122222222223333333333
  // 01234567890123456789012345678901234567890123456789012345678901234567890123456789
  // <--------------------------------------><-------------------------------------->
  // Trk. Mute Oct. Vel. FTS   Fx             Bus Port Chn. Lower/Upper Mode   Reset 
  // G1T1       +0  100   on   on              1  IN1  #16   ---   ---  T&A    Stacks

  // The selected Bus1 is not configured      Bus Port Chn. Lower/Upper Mode   Reset 
  // for Play mode (but for Transposer&Arp.)   1  IN1  #16   ---   ---  T&A    Stacks

  ///////////////////////////////////////////////////////////////////////////
  SEQ_LCD_CursorSet(0, 0);
  if( !seq_midi_in_options[selected_bus].MODE_PLAY ) {
    SEQ_LCD_PrintFormattedString("The selected Bus%d is not configured     ", selected_bus+1);
  } else {
    SEQ_LCD_PrintString("Trk. Mute Oct. Vel. FTS   Fx            ");
  }

  SEQ_LCD_CursorSet(40, 0);
  SEQ_LCD_PrintString(" Bus Port Chn. Lower/Upper Mode   Reset ");


  ///////////////////////////////////////////////////////////////////////////
  SEQ_LCD_CursorSet(0, 1);
  if( !seq_midi_in_options[selected_bus].MODE_PLAY ) {
    SEQ_LCD_PrintString("for Play mode (but for Transposer&Arp.) ");
  } else {
    if( ui_selected_item == ITEM_GXTY && ui_cursor_flash ) {
      SEQ_LCD_PrintSpaces(4);
    } else {
      SEQ_LCD_PrintGxTy(ui_selected_group, ui_selected_tracks);
    }
    SEQ_LCD_PrintSpaces(1);

    ///////////////////////////////////////////////////////////////////////////
    if( ui_selected_item == ITEM_MUTE && ui_cursor_flash ) {
      SEQ_LCD_PrintSpaces(5);
    } else {
      SEQ_LCD_PrintSpaces(2);
      SEQ_LCD_PrintChar((seq_core_trk_muted & (1 << visible_track)) ? '*' : 'o');
      SEQ_LCD_PrintSpaces(2);
    }

    ///////////////////////////////////////////////////////////////////////////
    if( ui_selected_item == ITEM_OCT_TRANSPOSE && ui_cursor_flash ) {
      SEQ_LCD_PrintSpaces(4);
    } else {
      u8 event_mode = SEQ_CC_Get(visible_track, SEQ_CC_MIDI_EVENT_MODE);
      if( event_mode == SEQ_EVENT_MODE_Drum ) {
	SEQ_LCD_PrintString("Drum");
      } else {
	SEQ_LCD_PrintFormattedString(" %c%d ", (seq_live_options.OCT_TRANSPOSE < 0) ? '-' : '+', abs(seq_live_options.OCT_TRANSPOSE));
      }
    }
    SEQ_LCD_PrintSpaces(1);

    ///////////////////////////////////////////////////////////////////////////
    if( ui_selected_item == ITEM_LIVE_VELOCITY && ui_cursor_flash ) {
      SEQ_LCD_PrintSpaces(3);
    } else {
      SEQ_LCD_PrintFormattedString("%3d", seq_live_options.VELOCITY);
    }
    SEQ_LCD_PrintSpaces(2);

    ///////////////////////////////////////////////////////////////////////////
    if( ui_selected_item == ITEM_LIVE_FORCE_SCALE && ui_cursor_flash ) {
      SEQ_LCD_PrintSpaces(3);
    } else {
      SEQ_LCD_PrintString(seq_live_options.FORCE_SCALE ? " on" : "off");
    }
    SEQ_LCD_PrintSpaces(2);

    ///////////////////////////////////////////////////////////////////////////
    if( ui_selected_item == ITEM_LIVE_FX && ui_cursor_flash ) {
      SEQ_LCD_PrintSpaces(3);
    } else {
      SEQ_LCD_PrintString(seq_live_options.FX ? " on" : "off");
    }
    SEQ_LCD_PrintSpaces(2 + 10);
  }



  ///////////////////////////////////////////////////////////////////////
  if( ui_selected_item == ITEM_IN_BUS && ui_cursor_flash ) {
    SEQ_LCD_PrintSpaces(5);
  } else {
    SEQ_LCD_PrintFormattedString("  %d  ", selected_bus+1);
  }

  ///////////////////////////////////////////////////////////////////////
  if( ui_selected_item == ITEM_IN_PORT && ui_cursor_flash ) {
    SEQ_LCD_PrintSpaces(4);
  } else {
    if( seq_midi_in_port[selected_bus] )
      SEQ_LCD_PrintString(SEQ_MIDI_PORT_InNameGet(SEQ_MIDI_PORT_InIxGet(seq_midi_in_port[selected_bus])));
    else
      SEQ_LCD_PrintString(" All");
  }
  SEQ_LCD_PrintSpaces(1);


  ///////////////////////////////////////////////////////////////////////
  if( ui_selected_item == ITEM_IN_CHN && ui_cursor_flash ) {
    SEQ_LCD_PrintSpaces(3);
  } else {
    if( seq_midi_in_channel[selected_bus] )
      SEQ_LCD_PrintFormattedString("#%2d", seq_midi_in_channel[selected_bus]);
    else
      SEQ_LCD_PrintString("---");
  }
  SEQ_LCD_PrintSpaces(3);


  ///////////////////////////////////////////////////////////////////////
  if( ui_selected_item == ITEM_IN_LOWER && ui_cursor_flash ) {
    SEQ_LCD_PrintSpaces(3);
  } else {
    SEQ_LCD_PrintNote(seq_midi_in_lower[selected_bus]);
  }
  SEQ_LCD_PrintSpaces(3);


  ///////////////////////////////////////////////////////////////////////
  if( ui_selected_item == ITEM_IN_UPPER && ui_cursor_flash ) {
    SEQ_LCD_PrintSpaces(3);
  } else {
    SEQ_LCD_PrintNote(seq_midi_in_upper[selected_bus]);
  }
  SEQ_LCD_PrintSpaces(2);


  ///////////////////////////////////////////////////////////////////////
  if( ui_selected_item == ITEM_IN_MODE && ui_cursor_flash ) {
    SEQ_LCD_PrintSpaces(4);
  } else {
    SEQ_LCD_PrintString(seq_midi_in_options[selected_bus].MODE_PLAY ? "Play" : "T&A ");
  }
  SEQ_LCD_PrintSpaces(3);

  SEQ_LCD_PrintString("Stacks");

  return 0; // no error
}