Skip to content

Commit

Permalink
Improved UART handling (#5)
Browse files Browse the repository at this point in the history
* Fix printing from an external device connected to one of the UART ports (such as Octoprint).
The goal is for this to work properly in either touch mode or emulation mode.
This should also allow switching between touch and emulation mode even while printing.

* Strip line numbers and checksums from gcode for parsing.
BEWARE that this probably will result in errors since the TFT will likely be thinking all of these commands are coming from its own system. In order for this to work properly, I'll probably need to add logic to make some parsing contingent upon where the gcode originated from.

* Revert "Strip line numbers and checksums from gcode for parsing."

This reverts commit bf164af.

* Change strategy for parsing gcode. It now forks into one section for TFT originating gcode and one section for external originating gcode.
This allows synchronizing feed rate and fan speed.

* Pass spontaneous messages (messages that aren't part of an explicit ack) to all devices connected over UART. (Keeps messages like alerts, errors, and temp heartbeats from getting lost.)
Don't have the TFT send more M105 temp messages if it doesn't have a reason to. (Temps sent by request to other devices are getting parsed so there's no need to ask for more if you've just seen one.)

* Minor tweaks to make sure we continue to pump message loops.

* translate comments to english in popup.c & disable ST7920_FULLSCREEN by default

* move `CLEAN_MODE_SWITCHING_SUPPORT` to Marlin mode Setting area and add sanity check

move `CLEAN_MODE_SWITCHING_SUPPORT` to Marlin mode Setting area.
add sanity check  for `CLEAN_MODE_SWITCHING_SUPPORT`  to throw error if it is enabled for TFT controllers with no Emulator/Marlin mode support.

* Update Configuration.h

Co-authored-by: Gurmeet Athwal <[email protected]>
  • Loading branch information
hfog and guruathwal authored Feb 20, 2020
1 parent 7a370bd commit 920e06b
Show file tree
Hide file tree
Showing 12 changed files with 340 additions and 191 deletions.
2 changes: 1 addition & 1 deletion TFT/src/Libraries/cmsis/stm32f2xx/system_stm32f2xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ static void SetSysClock(void)
RCC->CFGR |= RCC_CFGR_SW_PLL;

/* Wait till the main PLL is used as system clock source */
while ((RCC->CFGR & (uint32_t)RCC_CFGR_SWS ) != RCC_CFGR_SWS_PLL);
while ((RCC->CFGR & (uint32_t)RCC_CFGR_SWS ) != RCC_CFGR_SWS_PLL)
{
}
}
Expand Down
7 changes: 6 additions & 1 deletion TFT/src/User/API/LCD_Encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,12 @@ void LCD_LoopEncoder(void)

void loopCheckMode(void)
{
if(isPrinting()) return;
// #ifndef CLEAN_MODE_SWITCHING_SUPPORT
// IDEALLY I would like to be able to swap even when the TFT is in printing mode
// but before I can allow that I need a way to make sure that we swap back into the right mode (and correct screen)
// and I really want a reliable way to DETECT that the TFT should be in printing mode even when the print was started externally.
if(isPrinting()) return;
// #endif
if(LCD_ReadBtn(LCD_CHANGE_MODE_INTERVALS) || LCD_ReadPen(LCD_CHANGE_MODE_INTERVALS))
{
infoMenu.menu[++infoMenu.cur] = menuMode;
Expand Down
3 changes: 3 additions & 0 deletions TFT/src/User/API/UI/ST7920_Simulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ void menuST7920(void)
#if LCD_ENCODER_SUPPORT
loopCheckMode();
#endif
#ifdef CLEAN_MODE_SWITCHING_SUPPORT
loopBackEnd();
#endif
}
SPI_SlaveDeInit();
}
Expand Down
Loading

0 comments on commit 920e06b

Please sign in to comment.