Misc. improvements (#12747)
* Make ExtUI respect MAXTEMP limits - Temperatures are now clamped by MAXTEMP limits rather than arbitrary values. * Speed up USB init, add status - Speed up USB initialization - Show status message if init failed * Enable status messages for EXTENSIBLE_UI * Adjust max limit to MAX_TEMP - 15 * Misc. tweaks to formatting, const, etc.
This commit is contained in:
		
				
					committed by
					
						
						Scott Lahteine
					
				
			
			
				
	
			
			
			
						parent
						
							4f2473053c
						
					
				
				
					commit
					60cb36bef3
				
			@@ -80,20 +80,13 @@ static uint8_t rs_last_state = 255;
 | 
			
		||||
 | 
			
		||||
static void u8g_com_LPC1768_st7920_write_byte_hw_spi(uint8_t rs, uint8_t val) {
 | 
			
		||||
 | 
			
		||||
  if ( rs != rs_last_state) {  // time to send a command/data byte
 | 
			
		||||
  if (rs != rs_last_state) {      // Time to send a command/data byte
 | 
			
		||||
    rs_last_state = rs;
 | 
			
		||||
 | 
			
		||||
    if ( rs == 0 )
 | 
			
		||||
      /* command */
 | 
			
		||||
      spiSend(0x0F8);
 | 
			
		||||
    else
 | 
			
		||||
       /* data */
 | 
			
		||||
      spiSend(0x0FA);
 | 
			
		||||
 | 
			
		||||
    DELAY_US(40); // give the controller some time to process the data: 20 is bad, 30 is OK, 40 is safe
 | 
			
		||||
    spiSend(rs ? 0x0FA : 0x0F8);  // Send data or command
 | 
			
		||||
    DELAY_US(40);                 // Give the controller some time: 20 is bad, 30 is OK, 40 is safe
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  spiSend(val & 0x0F0);
 | 
			
		||||
  spiSend(val & 0xF0);
 | 
			
		||||
  spiSend(val << 4);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -104,8 +97,8 @@ uint8_t u8g_com_HAL_LPC1768_ST7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t ar
 | 
			
		||||
      u8g_SetPIOutput(u8g, U8G_PI_CS);
 | 
			
		||||
      u8g_Delay(5);
 | 
			
		||||
      spiBegin();
 | 
			
		||||
      spiInit(SPI_EIGHTH_SPEED);  // ST7920 max speed is about 1.1 MHz
 | 
			
		||||
      u8g->pin_list[U8G_PI_A0_STATE] = 0;       /* inital RS state: command mode */
 | 
			
		||||
      spiInit(SPI_EIGHTH_SPEED);            // ST7920 max speed is about 1.1 MHz
 | 
			
		||||
      u8g->pin_list[U8G_PI_A0_STATE] = 0;   // initial RS state: command mode
 | 
			
		||||
      break;
 | 
			
		||||
 | 
			
		||||
    case U8G_COM_MSG_STOP:
 | 
			
		||||
@@ -115,12 +108,12 @@ uint8_t u8g_com_HAL_LPC1768_ST7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t ar
 | 
			
		||||
      u8g_SetPILevel(u8g, U8G_PI_RESET, arg_val);
 | 
			
		||||
      break;
 | 
			
		||||
 | 
			
		||||
    case U8G_COM_MSG_ADDRESS:                     /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
 | 
			
		||||
    case U8G_COM_MSG_ADDRESS:                   // Define cmd (arg_val = 0) or data mode (arg_val = 1)
 | 
			
		||||
      u8g->pin_list[U8G_PI_A0_STATE] = arg_val;
 | 
			
		||||
      break;
 | 
			
		||||
 | 
			
		||||
    case U8G_COM_MSG_CHIP_SELECT:
 | 
			
		||||
      u8g_SetPILevel(u8g, U8G_PI_CS, arg_val);  //note: the st7920 has an active high chip select
 | 
			
		||||
      u8g_SetPILevel(u8g, U8G_PI_CS, arg_val);  // Note: the ST7920 has an active high chip-select
 | 
			
		||||
      break;
 | 
			
		||||
 | 
			
		||||
    case U8G_COM_MSG_WRITE_BYTE:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user