Prusa MINI Firmware overview
serial.cpp File Reference
#include "serial.h"
#include "language.h"

Functions

void serialprintPGM (PGM_P str)
 
void serial_echo_start ()
 
void serial_error_start ()
 
void serial_echopair_PGM (PGM_P const s_P, const char *v)
 
void serial_echopair_PGM (PGM_P const s_P, char v)
 
void serial_echopair_PGM (PGM_P const s_P, int v)
 
void serial_echopair_PGM (PGM_P const s_P, long v)
 
void serial_echopair_PGM (PGM_P const s_P, float v)
 
void serial_echopair_PGM (PGM_P const s_P, double v)
 
void serial_echopair_PGM (PGM_P const s_P, unsigned int v)
 
void serial_echopair_PGM (PGM_P const s_P, unsigned long v)
 
void serial_spaces (uint8_t count)
 
void serial_ternary (const bool onoff, PGM_P const pre, PGM_P const on, PGM_P const off, PGM_P const post)
 
void serialprint_onoff (const bool onoff)
 
void serialprintln_onoff (const bool onoff)
 
void serialprint_truefalse (const bool tf)
 
void print_bin (const uint16_t val)
 
void print_xyz (const float &x, const float &y, const float &z, PGM_P const prefix, PGM_P const suffix)
 

Variables

uint8_t marlin_debug_flags = MARLIN_DEBUG_NONE
 
static const char errormagic[] PROGMEM = "Error:"
 

Function Documentation

◆ serialprintPGM()

void serialprintPGM ( PGM_P  str)
35  {
36  while (const char c = pgm_read_byte(str++)) SERIAL_CHAR(c);
37 }
Here is the caller graph for this function:

◆ serial_echo_start()

void serial_echo_start ( )
38 { serialprintPGM(echomagic); }
Here is the call graph for this function:

◆ serial_error_start()

void serial_error_start ( )
39 { serialprintPGM(errormagic); }
Here is the call graph for this function:

◆ serial_echopair_PGM() [1/8]

void serial_echopair_PGM ( PGM_P const  s_P,
const char *  v 
)
41 { serialprintPGM(s_P); SERIAL_ECHO(v); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ serial_echopair_PGM() [2/8]

void serial_echopair_PGM ( PGM_P const  s_P,
char  v 
)
42 { serialprintPGM(s_P); SERIAL_CHAR(v); }
Here is the call graph for this function:

◆ serial_echopair_PGM() [3/8]

void serial_echopair_PGM ( PGM_P const  s_P,
int  v 
)
43 { serialprintPGM(s_P); SERIAL_ECHO(v); }
Here is the call graph for this function:

◆ serial_echopair_PGM() [4/8]

void serial_echopair_PGM ( PGM_P const  s_P,
long  v 
)
44 { serialprintPGM(s_P); SERIAL_ECHO(v); }
Here is the call graph for this function:

◆ serial_echopair_PGM() [5/8]

void serial_echopair_PGM ( PGM_P const  s_P,
float  v 
)
45 { serialprintPGM(s_P); SERIAL_ECHO(v); }
Here is the call graph for this function:

◆ serial_echopair_PGM() [6/8]

void serial_echopair_PGM ( PGM_P const  s_P,
double  v 
)
46 { serialprintPGM(s_P); SERIAL_ECHO(v); }
Here is the call graph for this function:

◆ serial_echopair_PGM() [7/8]

void serial_echopair_PGM ( PGM_P const  s_P,
unsigned int  v 
)
47 { serialprintPGM(s_P); SERIAL_ECHO(v); }
Here is the call graph for this function:

◆ serial_echopair_PGM() [8/8]

void serial_echopair_PGM ( PGM_P const  s_P,
unsigned long  v 
)
48 { serialprintPGM(s_P); SERIAL_ECHO(v); }
Here is the call graph for this function:

◆ serial_spaces()

void serial_spaces ( uint8_t  count)
50 { count *= (PROPORTIONAL_FONT_RATIO); while (count--) SERIAL_CHAR(' '); }

◆ serial_ternary()

void serial_ternary ( const bool  onoff,
PGM_P const  pre,
PGM_P const  on,
PGM_P const  off,
PGM_P const  post 
)
52  {
53  if (pre) serialprintPGM(pre);
54  serialprintPGM(onoff ? on : off);
55  if (post) serialprintPGM(post);
56 }
Here is the call graph for this function:

◆ serialprint_onoff()

void serialprint_onoff ( const bool  onoff)
57 { serialprintPGM(onoff ? PSTR(MSG_ON) : PSTR(MSG_OFF)); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ serialprintln_onoff()

void serialprintln_onoff ( const bool  onoff)
58 { serialprint_onoff(onoff); SERIAL_EOL(); }
Here is the call graph for this function:

◆ serialprint_truefalse()

void serialprint_truefalse ( const bool  tf)
59 { serialprintPGM(tf ? PSTR("true") : PSTR("false")); }
Here is the call graph for this function:

◆ print_bin()

void print_bin ( const uint16_t  val)
61  {
62  uint16_t mask = 0x8000;
63  for (uint8_t i = 16; i--;) {
64  if (i && !(i % 4)) SERIAL_CHAR(' ');
65  SERIAL_CHAR((val & mask) ? '1' : '0');
66  mask >>= 1;
67  }
68 }

◆ print_xyz()

void print_xyz ( const float &  x,
const float &  y,
const float &  z,
PGM_P const  prefix,
PGM_P const  suffix 
)
70  {
71  serialprintPGM(prefix);
72  SERIAL_ECHOPAIR(" " MSG_X, x, " " MSG_Y, y, " " MSG_Z, z);
73  if (suffix) serialprintPGM(suffix); else SERIAL_EOL();
74 }
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ marlin_debug_flags

uint8_t marlin_debug_flags = MARLIN_DEBUG_NONE

Marlin 3D Printer Firmware Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]

Based on Sprinter and grbl. Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

◆ PROGMEM

const char echomagic [] PROGMEM = "Error:"
static
SERIAL_CHAR
#define SERIAL_CHAR(x)
Definition: serial.h:69
SERIAL_ECHO
#define SERIAL_ECHO(x)
Definition: serial.h:70
MSG_X
#define MSG_X
Definition: language.h:319
SERIAL_ECHOPAIR
#define SERIAL_ECHOPAIR(V...)
Definition: serial.h:114
i
uint8_t i
Definition: screen_test_graph.c:72
pgm_read_byte
#define pgm_read_byte(addr)
Definition: pgmspace.h:95
PSTR
#define PSTR(str)
Definition: pgmspace.h:31
MSG_Y
#define MSG_Y
Definition: language.h:320
MSG_Z
#define MSG_Z
Definition: language.h:321
MSG_ON
#define MSG_ON
Definition: language.h:213
uint8_t
const uint8_t[]
Definition: 404_html.c:3
PROPORTIONAL_FONT_RATIO
#define PROPORTIONAL_FONT_RATIO
Definition: Configuration_A3ides_2209_MINI_adv.h:2044
SERIAL_EOL
#define SERIAL_EOL()
Definition: serial.h:181
serialprint_onoff
void serialprint_onoff(const bool onoff)
Definition: serial.cpp:57
MSG_OFF
#define MSG_OFF
Definition: language.h:214
serialprintPGM
void serialprintPGM(PGM_P str)
Definition: serial.cpp:35