Prusa MINI Firmware overview
marlin_server.cpp File Reference
#include "marlin_server.h"
#include <stdarg.h>
#include "dbg.h"
#include "app.h"
#include "bsod.h"
#include "cmsis_os.h"
#include "string.h"
#include "../Marlin/src/lcd/extensible_ui/ui_api.h"
#include "../Marlin/src/gcode/queue.h"
#include "../Marlin/src/gcode/parser.h"
#include "../Marlin/src/module/planner.h"
#include "../Marlin/src/module/stepper.h"
#include "../Marlin/src/module/temperature.h"
#include "../Marlin/src/module/probe.h"
#include "../Marlin/src/module/configuration_store.h"
#include "../Marlin/src/module/printcounter.h"
#include "../Marlin/src/feature/host_actions.h"
#include "../Marlin/src/feature/babystep.h"
#include "../Marlin/src/feature/pause.h"
#include "../Marlin/src/sd/cardreader.h"
#include "../Marlin/src/libs/nozzle.h"
#include "../Marlin/src/core/language.h"
#include "hwio_a3ides.h"
#include "eeprom.h"

Classes

struct  _marlin_server_t
 

Namespaces

 ExtUI
 

Macros

#define DBG   _dbg1
 
#define DBG_XUI   DBG
 
#define DBG_REQ(...)
 
#define DBG_HOST   DBG
 
#define HOST_PROMPT_LEN_MAX   32
 
#define HOST_BUTTON_LEN_MAX   16
 
#define HOST_BUTTON_CNT_MAX   4
 
#define MARLIN_IDLE_CNT_BUSY   2
 

Typedefs

typedef struct _marlin_server_t marlin_server_t
 

Functions

void _add_status_msg (const char *const popup_msg)
 
int _send_notify_to_client (osMessageQId queue, variant8_t msg)
 
int _send_notify_event_to_client (int client_id, osMessageQId queue, uint8_t evt_id, uint32_t usr32, uint16_t usr16)
 
uint64_t _send_notify_events_to_client (int client_id, osMessageQId queue, uint64_t evt_msk)
 
void _send_notify_event (uint8_t evt_id, uint32_t usr32, uint16_t usr16)
 
int _send_notify_change_to_client (osMessageQId queue, uint8_t var_id, variant8_t var)
 
uint64_t _send_notify_changes_to_client (int client_id, osMessageQId queue, uint64_t var_msk)
 
void _server_update_gqueue (void)
 
void _server_update_pqueue (void)
 
uint64_t _server_update_vars (uint64_t force_update_msk)
 
int _process_server_request (char *request)
 
int _server_set_var (char *name_val_str)
 
void marlin_server_init (void)
 
int marlin_server_cycle (void)
 
int marlin_server_loop (void)
 
int marlin_server_idle (void)
 
int marlin_server_processing (void)
 
void marlin_server_start_processing (void)
 
void marlin_server_stop_processing (void)
 
marlin_vars_tmarlin_server_vars (void)
 
void marlin_server_update (uint64_t update)
 
void marlin_server_do_babystep_Z (float offs)
 
int marlin_server_enqueue_gcode (const char *gcode)
 
int marlin_server_inject_gcode (const char *gcode)
 
void marlin_server_settings_save (void)
 
void marlin_server_settings_load (void)
 
void marlin_server_manage_heater (void)
 
void marlin_server_quick_stop (void)
 
void marlin_server_print_abort (void)
 
void marlin_server_print_pause (void)
 
void marlin_server_print_resume (void)
 
void marlin_server_park_head (void)
 
int marlin_all_axes_homed (void)
 
int marlin_all_axes_known (void)
 
void ExtUI::onStartup ()
 
void ExtUI::onIdle ()
 
int ExtUI::_is_thermal_error (PGM_P const msg)
 
void ExtUI::onPrinterKilled (PGM_P const msg, PGM_P const component)
 
void ExtUI::onMediaInserted ()
 
void ExtUI::onMediaError ()
 
void ExtUI::onMediaRemoved ()
 
void ExtUI::onPlayTone (const uint16_t frequency, const uint16_t duration)
 
void ExtUI::onPrintTimerStarted ()
 
void ExtUI::onPrintTimerPaused ()
 
void ExtUI::onPrintTimerStopped ()
 
void ExtUI::onFilamentRunout (const extruder_t extruder)
 
void ExtUI::onUserConfirmRequired (const char *const msg)
 
void ExtUI::onStatusChanged (const char *const msg)
 
void ExtUI::onFactoryReset ()
 
void ExtUI::onLoadSettings (char const *)
 
void ExtUI::onStoreSettings (char *)
 
void ExtUI::onConfigurationStoreWritten (bool success)
 
void ExtUI::onConfigurationStoreRead (bool success)
 
void ExtUI::onMeshUpdate (const uint8_t xpos, const uint8_t ypos, const float zval)
 
void host_action (const char *const pstr, const bool eol)
 
void host_action_kill ()
 
void host_action_safety_timer_expired ()
 
void host_action_pause (const bool eol)
 
void host_action_resume ()
 
void host_action_cancel ()
 
void host_action_paused (const bool eol)
 
void host_action_resumed ()
 
void host_response_handler (const uint8_t response)
 
void host_action_prompt_begin (const char *const pstr, const bool eol)
 
void host_action_prompt_button (const char *const pstr)
 
void host_action_prompt_end ()
 
void host_action_prompt_show ()
 
void host_prompt_do (const PromptReason type, const char *const pstr, const char *const pbtn)
 

Variables

PromptReason host_prompt_reason = PROMPT_NOT_DEFINED
 
IWDG_HandleTypeDef hiwdg
 
osThreadId marlin_server_task = 0
 
osMessageQId marlin_server_queue = 0
 
osSemaphoreId marlin_server_sema = 0
 
marlin_server_t marlin_server
 
marlin_server_idle_tmarlin_server_idle_cb = 0
 
msg_stack_t msg_stack = { '\0', 0 }
 
char host_prompt [HOST_PROMPT_LEN_MAX] = ""
 
char host_prompt_button [HOST_BUTTON_CNT_MAX][HOST_PROMPT_LEN_MAX]
 
uint8_t host_prompt_buttons = 0
 
host_prompt_button_t host_prompt_button_clicked = HOST_PROMPT_BTN_None
 
osThreadId marlin_client_task [MARLIN_MAX_CLIENTS]
 
osMessageQId marlin_client_queue [MARLIN_MAX_CLIENTS]
 

Macro Definition Documentation

◆ DBG

#define DBG   _dbg1

◆ DBG_XUI

#define DBG_XUI   DBG

◆ DBG_REQ

#define DBG_REQ (   ...)

◆ DBG_HOST

#define DBG_HOST   DBG

◆ HOST_PROMPT_LEN_MAX

#define HOST_PROMPT_LEN_MAX   32

◆ HOST_BUTTON_LEN_MAX

#define HOST_BUTTON_LEN_MAX   16

◆ HOST_BUTTON_CNT_MAX

#define HOST_BUTTON_CNT_MAX   4

◆ MARLIN_IDLE_CNT_BUSY

#define MARLIN_IDLE_CNT_BUSY   2

Typedef Documentation

◆ marlin_server_t

Function Documentation

◆ _add_status_msg()

void _add_status_msg ( const char *const  popup_msg)
101  {
102  char message[MSG_MAX_LENGTH];
103  size_t str_size = strlen(popup_msg);
104  if (str_size >= MSG_MAX_LENGTH - 1) {
105  strncpy(message, popup_msg, MSG_MAX_LENGTH - 1); // popup_msg is not always null-terminated...
106  message[MSG_MAX_LENGTH - 1] = '\0';
107  } else {
108  strncpy(message, popup_msg, str_size);
109  message[str_size] = '\0';
110  }
111 
112  for (uint8_t i = msg_stack.count; i; i--) {
113  if (i == MSG_STACK_SIZE)
114  i--; // last place of the limited stack will be always overwritten
116  }
117 
118  strncpy(msg_stack.msg_data[0], message, MSG_MAX_LENGTH);
119 
121  msg_stack.count++;
122 }
Here is the caller graph for this function:

◆ _send_notify_to_client()

int _send_notify_to_client ( osMessageQId  queue,
variant8_t  msg 
)
385  {
386  //synchronization not necessary because only server thread can write to this queue
387  if (queue == 0)
388  return 0;
390  return 0;
391  osMessagePut(queue, *(((uint32_t *)(&msg)) + 0), osWaitForever);
392  osMessagePut(queue, *(((uint32_t *)(&msg)) + 1), osWaitForever);
393  return 1;
394 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _send_notify_event_to_client()

int _send_notify_event_to_client ( int  client_id,
osMessageQId  queue,
uint8_t  evt_id,
uint32_t  usr32,
uint16_t  usr16 
)
397  {
398  variant8_t msg;
399  msg = variant8_user(usr32);
400  msg.usr16 = usr16;
401  msg.usr8 = evt_id;
402  return _send_notify_to_client(queue, msg);
403 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _send_notify_events_to_client()

uint64_t _send_notify_events_to_client ( int  client_id,
osMessageQId  queue,
uint64_t  evt_msk 
)
407  {
408  uint64_t sent = 0;
409  uint64_t msk = 1;
410  for (uint8_t evt_id = 0; evt_id < 64; evt_id++) {
411  if (msk & evt_msk)
412  switch (evt_id) {
413  // Idle and PrinterKilled events not used
414  //case MARLIN_EVT_Idle:
415  //case MARLIN_EVT_PrinterKilled:
416  // Events without arguments
417  case MARLIN_EVT_Startup:
430  case MARLIN_EVT_Busy:
431  case MARLIN_EVT_Ready:
432  if (_send_notify_event_to_client(client_id, queue, evt_id, 0, 0))
433  sent |= msk; // event sent, set bit
434  break;
435  //case MARLIN_EVT_Error:
436  // StatusChanged event - one string argument
438  if (_send_notify_event_to_client(client_id, queue, evt_id, 0, 0))
439  sent |= msk; // event sent, set bit
440  break;
441  // CommandBegin/End - one ui32 argument (CMD)
442  //case MARLIN_EVT_CommandBegin:
443  //case MARLIN_EVT_CommandEnd:
444  // if (_send_notify_event_to_client(client_id, queue, evt_id, 0, 0))
445  // sent |= msk; // event sent, set bit
446  // break;
447  //case MARLIN_EVT_PlayTone:
448  //case MARLIN_EVT_UserConfirmRequired:
450  if (marlin_server.mesh_point_notsent[client_id]) {
451  uint8_t x;
452  uint8_t y;
453  uint64_t mask = 1;
454  for (y = 0; y < marlin_server.mesh.yc; y++)
455  for (x = 0; x < marlin_server.mesh.xc; x++) {
456  if (mask & marlin_server.mesh_point_notsent[client_id]) {
457  uint8_t index = x + marlin_server.mesh.xc * y;
458  float z = marlin_server.mesh.z[index];
459  uint32_t usr32 = variant8_flt(z).ui32;
460  uint16_t usr16 = x | ((uint16_t)y << 8);
461  if (_send_notify_event_to_client(client_id, queue, evt_id, usr32, usr16))
462  marlin_server.mesh_point_notsent[client_id] &= ~mask;
463  }
464  mask <<= 1;
465  }
466  if (marlin_server.mesh_point_notsent[client_id] == 0)
467  sent |= msk; // event sent, set bit
468  }
469  break;
471  if (_send_notify_event_to_client(client_id, queue, evt_id, 0, 0))
472  sent |= msk; // event sent, set bit
473  break;
474  }
475  msk <<= 1;
476  }
477  return sent;
478 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _send_notify_event()

void _send_notify_event ( uint8_t  evt_id,
uint32_t  usr32,
uint16_t  usr16 
)
481  {
482  if ((marlin_server.notify_events & ((uint64_t)1 << evt_id)) == 0)
483  return;
484  for (int client_id = 0; client_id < MARLIN_MAX_CLIENTS; client_id++)
485  if (_send_notify_event_to_client(client_id, marlin_client_queue[client_id], evt_id, usr32, usr16) == 0) {
486  marlin_server.client_events[client_id] |= ((uint64_t)1 << evt_id); // event not sent, set bit
487  if (evt_id == MARLIN_EVT_MeshUpdate) {
488  uint8_t x = usr16 & 0xff; // x index
489  uint8_t y = usr16 >> 8; // y index
490  uint8_t index = x + marlin_server.mesh.xc * y; // index
491  uint64_t mask = ((uint64_t)1 << index); // mask
492  marlin_server.mesh_point_notsent[client_id] |= mask;
493  }
494  }
495 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _send_notify_change_to_client()

int _send_notify_change_to_client ( osMessageQId  queue,
uint8_t  var_id,
variant8_t  var 
)
498  {
499  var.usr8 = var_id | MARLIN_USR8_VAR_FLG;
500  return _send_notify_to_client(queue, var);
501 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _send_notify_changes_to_client()

uint64_t _send_notify_changes_to_client ( int  client_id,
osMessageQId  queue,
uint64_t  var_msk 
)
504  {
505  variant8_t var;
506  uint64_t sent = 0;
507  uint64_t msk = 1;
508  for (uint8_t var_id = 0; var_id < 64; var_id++) {
509  if (msk & var_msk) {
510  var = marlin_vars_get_var(&(marlin_server.vars), var_id);
511  if (var.type != VARIANT8_EMPTY)
512  if (_send_notify_change_to_client(queue, var_id, var))
513  sent |= msk;
514  }
515  msk <<= 1;
516  }
517  return sent;
518 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _server_update_gqueue()

void _server_update_gqueue ( void  )
520  {
521  if (marlin_server.gqueue != queue.length) {
523  // _dbg("gqueue: %2d", marlin_server.gqueue);
524  }
525 }
Here is the caller graph for this function:

◆ _server_update_pqueue()

◆ _server_update_vars()

uint64_t _server_update_vars ( uint64_t  force_update_msk)
537  {
538  int i;
539  variant8_t v;
540  uint64_t changes = 0;
541 
542  if (update == 0)
543  return 0;
544 
545  if (update & MARLIN_VAR_MSK(MARLIN_VAR_GQUEUE))
548  changes |= MARLIN_VAR_MSK(MARLIN_VAR_GQUEUE);
549  }
550 
551  if (update & MARLIN_VAR_MSK(MARLIN_VAR_PQUEUE))
554  changes |= MARLIN_VAR_MSK(MARLIN_VAR_PQUEUE);
555  }
556 
557  if (update & MARLIN_VAR_MSK(MARLIN_VAR_MOTION)) {
558  v.ui8 = 0;
560  v.ui8 |= 0x01;
562  v.ui8 |= 0x02;
564  v.ui8 |= 0x04;
566  v.ui8 |= 0x08;
567  if (marlin_server.vars.motion != v.ui8) {
569  changes |= MARLIN_VAR_MSK(MARLIN_VAR_MOTION);
570  }
571  }
572 
573  if (update & MARLIN_VAR_MSK_IPOS_XYZE) {
574  for (i = 0; i < 4; i++)
575  if (update & MARLIN_VAR_MSK(MARLIN_VAR_IPOS_X + i)) {
576  v.i32 = stepper.position((AxisEnum)i);
577  if (marlin_server.vars.ipos[i] != v.i32) {
578  marlin_server.vars.ipos[i] = v.i32;
579  changes |= MARLIN_VAR_MSK(MARLIN_VAR_IPOS_X + i);
580  }
581  }
582  }
583 
584  if (update & MARLIN_VAR_MSK_POS_XYZE) {
585  for (i = 0; i < 4; i++)
586  if (update & MARLIN_VAR_MSK(MARLIN_VAR_POS_X + i)) {
588  if (marlin_server.vars.pos[i] != v.flt) {
589  marlin_server.vars.pos[i] = v.flt;
590  changes |= MARLIN_VAR_MSK(MARLIN_VAR_POS_X + i);
591  }
592  }
593  }
594 
595  if (update & MARLIN_VAR_MSK(MARLIN_VAR_TEMP_NOZ)) {
596  v.flt = thermalManager.temp_hotend[0].celsius;
597  if (marlin_server.vars.temp_nozzle != v.flt) {
600  }
601  }
602 
603  if (update & MARLIN_VAR_MSK(MARLIN_VAR_TTEM_NOZ)) {
604  v.flt = thermalManager.temp_hotend[0].target;
605  if (marlin_server.vars.target_nozzle != v.flt) {
608  }
609  }
610 
611  if (update & MARLIN_VAR_MSK(MARLIN_VAR_TEMP_BED)) {
612  v.flt = thermalManager.temp_bed.celsius;
613  if (marlin_server.vars.temp_bed != v.flt) {
616  }
617  }
618 
619  if (update & MARLIN_VAR_MSK(MARLIN_VAR_TTEM_BED)) {
620  v.flt = thermalManager.temp_bed.target;
621  if (marlin_server.vars.target_bed != v.flt) {
624  }
625  }
626 
627  if (update & MARLIN_VAR_MSK(MARLIN_VAR_Z_OFFSET)) {
628  v.flt = probe_offset.z;
629  if (marlin_server.vars.z_offset != v.flt) {
632  }
633  }
634 
635  if (update & MARLIN_VAR_MSK(MARLIN_VAR_FANSPEED)) {
636  v.ui8 = thermalManager.fan_speed[0];
637  if (marlin_server.vars.fan_speed != v.ui8) {
640  }
641  }
642 
643  if (update & MARLIN_VAR_MSK(MARLIN_VAR_PRNSPEED)) {
644  v.ui16 = (unsigned)feedrate_percentage;
645  if (marlin_server.vars.print_speed != v.ui16) {
648  }
649  }
650 
651  if (update & MARLIN_VAR_MSK(MARLIN_VAR_FLOWFACT)) {
652  v.ui16 = (unsigned)planner.flow_percentage[0];
656  }
657  }
658 
659  if (update & MARLIN_VAR_MSK(MARLIN_VAR_WAITHEAT)) {
660  v.ui8 = wait_for_heatup ? 1 : 0;
661  if (marlin_server.vars.wait_heat != v.ui8) {
664  }
665  }
666 
667  if (update & MARLIN_VAR_MSK(MARLIN_VAR_WAITUSER)) {
668  v.ui8 = wait_for_user ? 1 : 0;
669  if (marlin_server.vars.wait_user != v.ui8) {
672  }
673  }
674 
675  if (update & MARLIN_VAR_MSK(MARLIN_VAR_SD_PRINT)) {
676  v.ui8 = card.flag.sdprinting ? 1 : 0;
677  if (marlin_server.vars.sd_printing != v.ui8) {
680  }
681  }
682 
683  if (update & MARLIN_VAR_MSK(MARLIN_VAR_SD_PDONE)) {
684  v.ui8 = card.percentDone();
688  }
689  }
690 
691  if (update & MARLIN_VAR_MSK(MARLIN_VAR_DURATION)) {
696  }
697  }
698  return changes;
699 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _process_server_request()

int _process_server_request ( char *  request)
702  {
703  int processed = 0;
704  uint64_t msk;
705  float offs;
706  int ival;
707  int client_id = *(request++) - '0';
708  if ((client_id < 0) || (client_id >= MARLIN_MAX_CLIENTS))
709  return 1;
710  DBG_REQ("SRV: REQ %c%s", '0' + client_id, request);
711  if (strncmp("!g ", request, 3) == 0) {
712  processed = marlin_server_enqueue_gcode(request + 3);
713  } else if (strncmp("!ig ", request, sizeof("!ig ") / sizeof(char) - 1) == 0) {
714  unsigned long int iptr = strtoul(request + sizeof("!ig ") / sizeof(char) - 1, NULL, 0);
715  processed = marlin_server_inject_gcode((const char *)iptr);
716  } else if (strcmp("!start", request) == 0) {
718  processed = 1;
719  } else if (strcmp("!stop", request) == 0) {
721  processed = 1;
722  } else if (strncmp("!var ", request, 5) == 0) {
723  _server_set_var(request + 5);
724  processed = 1;
725  } else if (sscanf(request, "!update %" PRIu64, &msk) == 1) {
727  processed = 1;
728  } else if (sscanf(request, "!babystep_Z %f", &offs) == 1) {
730  processed = 1;
731  } else if (strcmp("!save", request) == 0) {
733  processed = 1;
734  } else if (strcmp("!load", request) == 0) {
736  processed = 1;
737  } else if (strcmp("!updt", request) == 0) {
739  processed = 1;
740  } else if (strcmp("!qstop", request) == 0) {
742  processed = 1;
743  } else if (strcmp("!pabort", request) == 0) {
745  processed = 1;
746  } else if (strcmp("!ppause", request) == 0) {
748  processed = 1;
749  } else if (strcmp("!presume", request) == 0) {
751  processed = 1;
752  } else if (strcmp("!park", request) == 0) {
754  processed = 1;
755  } else if (sscanf(request, "!hclick %d", &ival) == 1) {
757  processed = 1;
758  }
759  if (processed)
761  return processed;
762 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _server_set_var()

int _server_set_var ( char *  name_val_str)
765  {
766  int var_id;
767  char *val_str = strchr(name_val_str, ' ');
768  *(val_str++) = 0;
769  if ((var_id = marlin_vars_get_id_by_name(name_val_str)) >= 0) {
770  if (marlin_vars_str_to_value(&(marlin_server.vars), var_id, val_str) == 1) {
771  switch (var_id) {
772  case MARLIN_VAR_TTEM_NOZ:
773  thermalManager.setTargetHotend(marlin_server.vars.target_nozzle, 0);
774  break;
775  case MARLIN_VAR_TTEM_BED:
777  break;
778  case MARLIN_VAR_Z_OFFSET:
780  break;
781  case MARLIN_VAR_FANSPEED:
782  thermalManager.set_fan_speed(0, marlin_server.vars.fan_speed);
783  break;
784  case MARLIN_VAR_PRNSPEED:
786  break;
787  case MARLIN_VAR_FLOWFACT:
788  planner.flow_percentage[0] = (int16_t)marlin_server.vars.flow_factor;
789  planner.refresh_e_factor(0);
790  break;
791  case MARLIN_VAR_WAITHEAT:
792  wait_for_heatup = marlin_server.vars.wait_heat ? true : false;
793  break;
794  case MARLIN_VAR_WAITUSER:
795  wait_for_user = marlin_server.vars.wait_user ? true : false;
796  break;
797  }
798  }
799  }
800  // _dbg("_server_set_var %d %s %s", var_id, name_val_str, val_str);
801  return 1;
802 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ marlin_server_init()

void marlin_server_init ( void  )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ marlin_server_cycle()

int marlin_server_cycle ( void  )
168  {
169  int count = 0;
170  int client_id;
171  uint64_t msk = 0;
172  uint64_t changes = 0;
174  osEvent ose;
175  uint32_t tick;
176  char ch;
180  count++;
182  }
183  }
185  while ((ose = osMessageGet(marlin_server_queue, 0)).status == osEventMessage) {
186  ch = (char)((uint8_t)(ose.value.v));
187  switch (ch) {
188  case '\r':
189  case '\n':
190  ch = 0;
191  break;
192  }
195  else {
196  //TODO: request too long
198  }
199  if ((ch == 0) && (marlin_server.request_len > 1)) {
202  count++;
203  } else {
205  break;
206  }
207  }
208  }
209  // update gqueue (gcode queue)
211  // update pqueue (planner queue)
213  // update variables
214  tick = HAL_GetTick();
216  marlin_server.last_update = tick;
218  }
219  // send notifications
220  for (client_id = 0; client_id < MARLIN_MAX_CLIENTS; client_id++)
221  if ((queue = marlin_client_queue[client_id]) != 0) {
222  marlin_server.client_changes[client_id] |= changes;
223  // send change notifications, clear bits for successful sent notification
224  if ((msk = marlin_server.client_changes[client_id]) != 0)
225  marlin_server.client_changes[client_id] &= ~_send_notify_changes_to_client(client_id, queue, msk);
226  // send events, clear bits for successful sent notification
227  if ((msk = marlin_server.client_events[client_id]) != 0)
228  marlin_server.client_events[client_id] &= ~_send_notify_events_to_client(client_id, queue, msk);
229  }
230 #ifndef _DEBUG
232  HAL_IWDG_Refresh(&hiwdg); // this prevents iwdg reset while processing disabled
233 #endif //_DEBUG
234  return count;
235 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ marlin_server_loop()

int marlin_server_loop ( void  )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ marlin_server_idle()

int marlin_server_idle ( void  )
254  {
257  else if ((marlin_server.flags & MARLIN_SFLG_BUSY) == 0) {
258  //_dbg("SVR: BUSY");
261  if (parser.command_letter == 'G')
262  switch (parser.codenum) {
263  case 28:
264  case 29:
266  break;
267  }
268  else if (parser.command_letter == 'M')
269  switch (parser.codenum) {
270  case 109:
271  case 190:
272  case 600:
273  case 701:
274  case 702:
276  break;
277  }
280  }
281  return marlin_server_cycle();
282 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ marlin_server_processing()

int marlin_server_processing ( void  )
284  {
285  return (marlin_server.flags & MARLIN_SFLG_PROCESS) ? 1 : 0;
286 }
Here is the caller graph for this function:

◆ marlin_server_start_processing()

void marlin_server_start_processing ( void  )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ marlin_server_stop_processing()

void marlin_server_stop_processing ( void  )
293  {
295  //TODO: disable heaters and safe state
297 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ marlin_server_vars()

marlin_vars_t* marlin_server_vars ( void  )
299  {
300  return &(marlin_server.vars);
301 }

◆ marlin_server_update()

void marlin_server_update ( uint64_t  update)
303  {
304  int client_id;
306  _server_update_vars(update);
307  for (client_id = 0; client_id < MARLIN_MAX_CLIENTS; client_id++)
308  if ((queue = marlin_client_queue[client_id]) != 0)
309  marlin_server.client_changes[client_id] &= ~_send_notify_changes_to_client(client_id, queue, update);
310  // _dbg0("UPDATE");
311 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ marlin_server_do_babystep_Z()

void marlin_server_do_babystep_Z ( float  offs)
313  {
315  babystep.task();
316 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ marlin_server_enqueue_gcode()

int marlin_server_enqueue_gcode ( const char *  gcode)
318  {
319  return queue.enqueue_one(gcode) ? 1 : 0;
320 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ marlin_server_inject_gcode()

int marlin_server_inject_gcode ( const char *  gcode)
322  {
324  return 1;
325 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ marlin_server_settings_save()

void marlin_server_settings_save ( void  )
327  {
328  (void)settings.save();
329 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ marlin_server_settings_load()

void marlin_server_settings_load ( void  )
331  {
332  (void)settings.load();
333 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ marlin_server_manage_heater()

void marlin_server_manage_heater ( void  )
335  {
337 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ marlin_server_quick_stop()

void marlin_server_quick_stop ( void  )
339  {
341 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ marlin_server_print_abort()

void marlin_server_print_abort ( void  )
343  {
344  wait_for_heatup = wait_for_user = false;
345  card.flag.abort_sd_printing = true;
347  // planner.quick_stop();
348  // marlin_server_park_head();
349  // planner.synchronize();
350  // queue.inject_P("M125");
351 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ marlin_server_print_pause()

void marlin_server_print_pause ( void  )
353  {
354  card.pauseSDPrint();
356  queue.inject_P("M125");
357 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ marlin_server_print_resume()

void marlin_server_print_resume ( void  )
359  {
360  wait_for_user = false;
362  queue.inject_P("M24");
363 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ marlin_server_park_head()

void marlin_server_park_head ( void  )
365  {
366  //homed check
367  if (all_axes_homed() && all_axes_known()) {
368  xyz_pos_t park_point = NOZZLE_PARK_POINT;
369  nozzle.park(2, park_point);
370  }
371 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ marlin_all_axes_homed()

int marlin_all_axes_homed ( void  )
373  {
374  return all_axes_homed() ? 1 : 0;
375 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ marlin_all_axes_known()

int marlin_all_axes_known ( void  )
377  {
378  return all_axes_known() ? 1 : 0;
379 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ host_action()

void host_action ( const char *const  pstr,
const bool  eol = true 
)

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/.

959  {
960 }

◆ host_action_kill()

void host_action_kill ( )
996  {
997 #ifdef LCDSIM
998  char text[85]; //max 4 lines of 20 chars + 4x '\n' + '\x00'
999  lcdsim_grab_text(text); //grab text from display buffer
1000  bsod(text); //BSOD (endless loop with disabled interrupts)
1001 #endif // LCDSIM
1002 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ host_action_safety_timer_expired()

void host_action_safety_timer_expired ( )
1004  {
1005  DBG_HOST("host_action_safety_timer_expired");
1007 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ host_action_pause()

void host_action_pause ( const bool  eol)
1009  {
1010  DBG_HOST("host_action_pause");
1011 }

◆ host_action_resume()

void host_action_resume ( )
1013  {
1014  DBG_HOST("host_action_resume");
1015 }

◆ host_action_cancel()

void host_action_cancel ( )
1017  {
1018  DBG_HOST("host_action_cancel");
1019 }

◆ host_action_paused()

void host_action_paused ( const bool  eol)
1021  {
1022  DBG_HOST("host_action_paused");
1023 }

◆ host_action_resumed()

void host_action_resumed ( )
1025  {
1026  DBG_HOST("host_action_resumed");
1027 }

◆ host_response_handler()

void host_response_handler ( const uint8_t  response)
1029  {
1030  DBG_HOST("host_response_handler %d", (int)response);
1031 }
Here is the caller graph for this function:

◆ host_action_prompt_begin()

void host_action_prompt_begin ( const char *const  pstr,
const bool  eol 
)
1033  {
1034  DBG_HOST("host_action_prompt_begin '%s' %d", pstr, (int)eol);
1035  strcpy(host_prompt, pstr);
1036  host_prompt_buttons = 0;
1037 }

◆ host_action_prompt_button()

void host_action_prompt_button ( const char *const  pstr)
1039  {
1040  DBG_HOST("host_action_prompt_button '%s'", pstr);
1042  strcpy(host_prompt_button[host_prompt_buttons], pstr);
1044  }
1045 }

◆ host_action_prompt_end()

void host_action_prompt_end ( )
1047  {
1048  DBG_HOST("host_action_prompt_end");
1049  *host_prompt = 0;
1050  host_prompt_buttons = 0;
1051 }
Here is the caller graph for this function:

◆ host_action_prompt_show()

void host_action_prompt_show ( )
1053  {
1054  DBG_HOST("host_action_prompt_show");
1055  marlin_host_prompt_t prompt = {
1058  {
1063  }
1064  };
1065  int paused = 0;
1066  uint32_t ui32 = marlin_host_prompt_encode(&prompt);
1068  switch (prompt.type) {
1069  case HOST_PROMPT_Paused:
1070  paused = 0;
1072  paused = 1; // pause only for M600 or M701
1073  while (paused) {
1076  idle(); // call Marlin idle()
1077  }
1078  switch (host_prompt_button_clicked) {
1080  paused = 0;
1081  break;
1083  do_pause_e_move(ADVANCED_PAUSE_PURGE_LENGTH, ADVANCED_PAUSE_PURGE_FEEDRATE);
1084  paused = 0; //TODO: temporarily skip the loop because of unload UI
1085  break;
1086  default:
1087  paused = 0;
1088  break;
1089  }
1090  }
1092  wait_for_user = false; //hack - skip waiting
1093  break;
1095  break;
1096  default:
1097  break;
1098  }
1099  *host_prompt = 0;
1100  host_prompt_buttons = 0;
1101 }
Here is the call graph for this function:

◆ host_prompt_do()

void host_prompt_do ( const PromptReason  type,
const char *const  pstr,
const char *const  pbtn 
)
1103  {
1104  DBG_HOST("host_prompt_do %d '%s' '%s'", (int)type, pstr, pbtn);
1105 
1106  switch (type) {
1107  case PROMPT_INFO:
1108  if (strcmp(pstr, "Reheating") == 0) {
1110  }
1111  break;
1112  case PROMPT_USER_CONTINUE:
1113  //gui must call marlin_print_resume();
1114  if (strcmp(pstr, "Reheat Done") == 0) {
1116  }
1117  break;
1118  default:
1119  break;
1120  }
1121 }
Here is the call graph for this function:

Variable Documentation

◆ host_prompt_reason

PromptReason host_prompt_reason = PROMPT_NOT_DEFINED

◆ hiwdg

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/.

◆ marlin_server_task

osThreadId marlin_server_task = 0

◆ marlin_server_queue

osMessageQId marlin_server_queue = 0

◆ marlin_server_sema

osSemaphoreId marlin_server_sema = 0

◆ marlin_server

marlin_server_t marlin_server

◆ marlin_server_idle_cb

marlin_server_idle_t* marlin_server_idle_cb = 0

◆ msg_stack

msg_stack_t msg_stack = { '\0', 0 }

◆ host_prompt

char host_prompt[HOST_PROMPT_LEN_MAX] = ""

◆ host_prompt_button

char host_prompt_button[HOST_BUTTON_CNT_MAX][HOST_PROMPT_LEN_MAX]

◆ host_prompt_buttons

uint8_t host_prompt_buttons = 0

◆ host_prompt_button_clicked

host_prompt_button_t host_prompt_button_clicked = HOST_PROMPT_BTN_None

◆ marlin_client_task

osThreadId marlin_client_task[MARLIN_MAX_CLIENTS]

◆ marlin_client_queue

osMessageQId marlin_client_queue[MARLIN_MAX_CLIENTS]
XYZval::z
T z
Definition: types.h:286
MARLIN_MAX_CLIENTS
#define MARLIN_MAX_CLIENTS
Definition: config.h:96
HOST_PROMPT_Paused
Definition: marlin_host.h:19
MARLIN_VAR_MSK_DEF
#define MARLIN_VAR_MSK_DEF
Definition: marlin_vars.h:52
_marlin_server_t::mesh
marlin_mesh_t mesh
Definition: marlin_server.cpp:71
_server_update_pqueue
void _server_update_pqueue(void)
Definition: marlin_server.cpp:527
_server_update_vars
uint64_t _server_update_vars(uint64_t force_update_msk)
Definition: marlin_server.cpp:537
MARLIN_EVT_Startup
#define MARLIN_EVT_Startup
Definition: marlin_events.h:8
MARLIN_EVT_SafetyTimerExpired
#define MARLIN_EVT_SafetyTimerExpired
Definition: marlin_events.h:35
osMessageAvailableSpace
uint32_t osMessageAvailableSpace(osMessageQId queue_id)
Get the available space in a message queue.
Definition: cmsis_os.c:1658
msg_stack
Definition: marlin_server.h:26
MARLIN_VAR_TEMP_BED
#define MARLIN_VAR_TEMP_BED
Definition: marlin_vars.h:20
_marlin_server_t::notify_changes
uint64_t notify_changes
Definition: marlin_server.cpp:57
_server_set_var
int _server_set_var(char *name_val_str)
Definition: marlin_server.cpp:765
host_prompt_button_clicked
host_prompt_button_t host_prompt_button_clicked
Definition: marlin_server.cpp:128
_send_notify_changes_to_client
uint64_t _send_notify_changes_to_client(int client_id, osMessageQId queue, uint64_t var_msk)
Definition: marlin_server.cpp:504
probe_offset
constexpr xyz_pos_t probe_offset
Definition: probe.h:58
Stepper::axis_is_moving
static FORCE_INLINE bool axis_is_moving(const AxisEnum axis)
Definition: stepper.h:381
MARLIN_EVT_MediaError
#define MARLIN_EVT_MediaError
Definition: marlin_events.h:12
osSemaphore
#define osSemaphore(name)
Definition: cmsis_os.h:709
queue
GCodeQueue queue
Definition: queue.cpp:28
settings
MarlinSettings settings
Definition: configuration_store.cpp:344
marlin_vars_get_var
variant8_t marlin_vars_get_var(marlin_vars_t *vars, uint8_t var_id)
Definition: marlin_vars.c:50
X_AXIS
Definition: types.h:37
MARLIN_EVT_LoadSettings
#define MARLIN_EVT_LoadSettings
Definition: marlin_events.h:22
marlin_server_print_abort
void marlin_server_print_abort(void)
Definition: marlin_server.cpp:343
_marlin_server_t::client_events
uint64_t client_events[MARLIN_MAX_CLIENTS]
Definition: marlin_server.cpp:61
g29_auto.gcode
list gcode
Definition: g29_auto.py:44
_variant8_t::ui16
uint16_t ui16
Definition: variant8.h:34
MARLIN_VAR_FLOWFACT
#define MARLIN_VAR_FLOWFACT
Definition: marlin_vars.h:26
MARLIN_VAR_POS_X
#define MARLIN_VAR_POS_X
Definition: marlin_vars.h:15
marlin_server_task
osThreadId marlin_server_task
Definition: marlin_server.cpp:88
host_prompt
char host_prompt[HOST_PROMPT_LEN_MAX]
Definition: marlin_server.cpp:125
MARLIN_VAR_MOTION
#define MARLIN_VAR_MOTION
Definition: marlin_vars.h:8
stepper
Stepper stepper
Definition: stepper.cpp:82
lcdsim_grab_text
uint16_t lcdsim_grab_text(char *text)
Definition: lcdsim.c:93
MARLIN_CMD_M
#define MARLIN_CMD_M
Definition: marlin_events.h:52
_marlin_vars_t::z_offset
float z_offset
Definition: marlin_vars.h:87
Planner::get_axis_position_mm
static float get_axis_position_mm(const AxisEnum axis)
Definition: planner.cpp:1526
MARLIN_VAR_IPOS_X
#define MARLIN_VAR_IPOS_X
Definition: marlin_vars.h:11
MARLIN_VAR_SD_PDONE
#define MARLIN_VAR_SD_PDONE
Definition: marlin_vars.h:30
print_job_timer
Stopwatch print_job_timer
Definition: printcounter.cpp:63
type
uint8_t type
Definition: UsbCore.h:184
marlin_server_enqueue_gcode
int marlin_server_enqueue_gcode(const char *gcode)
Definition: marlin_server.cpp:318
_variant8_t::ui8
uint8_t ui8
Definition: variant8.h:36
MARLIN_VAR_FANSPEED
#define MARLIN_VAR_FANSPEED
Definition: marlin_vars.h:24
HOST_PROMPT_FilamentRunout
Definition: marlin_host.h:20
_marlin_server_t::last_update
uint32_t last_update
Definition: marlin_server.cpp:64
_marlin_server_t::flags
uint16_t flags
Definition: marlin_server.cpp:55
MARLIN_SFLG_BUSY
#define MARLIN_SFLG_BUSY
Definition: marlin_server.h:13
_marlin_server_t::pqueue_head
uint8_t pqueue_head
Definition: marlin_server.cpp:66
marlin_server_stop_processing
void marlin_server_stop_processing(void)
Definition: marlin_server.cpp:293
MARLIN_EVT_MSK_DEF
#define MARLIN_EVT_MSK_DEF
Definition: marlin_events.h:43
babystep
Babystep babystep
i
uint8_t i
Definition: screen_test_graph.c:72
_marlin_vars_t::pqueue
uint8_t pqueue
Definition: marlin_vars.h:80
_variant8_t::type
uint8_t type
Definition: variant8.h:25
marlin_host_prompt_button_by_text
host_prompt_button_t marlin_host_prompt_button_by_text(const char *text)
Definition: marlin_host.c:44
Planner::block_buffer_tail
static volatile uint8_t block_buffer_tail
Definition: planner.h:227
MARLIN_VAR_TTEM_BED
#define MARLIN_VAR_TTEM_BED
Definition: marlin_vars.h:22
marlin_server_queue
osMessageQId marlin_server_queue
Definition: marlin_server.cpp:89
_marlin_host_prompt_t::type
host_prompt_type_t type
Definition: marlin_host.h:47
AxisEnum
AxisEnum
Definition: types.h:36
marlin_server_do_babystep_Z
void marlin_server_do_babystep_Z(float offs)
Definition: marlin_server.cpp:313
marlin_server_settings_save
void marlin_server_settings_save(void)
Definition: marlin_server.cpp:327
msg_stack::count
uint8_t count
Definition: marlin_server.h:29
host_prompt_buttons
uint8_t host_prompt_buttons
Definition: marlin_server.cpp:127
MARLIN_CMD_M600
#define MARLIN_CMD_M600
Definition: marlin_events.h:57
GCodeQueue::length
static uint8_t length
Definition: queue.h:51
Temperature::manage_heater
static void manage_heater() _O2
Definition: temperature.cpp:975
Stopwatch::stop
static bool stop()
Stop the stopwatch.
Definition: stopwatch.cpp:36
_marlin_host_prompt_t
Definition: marlin_host.h:46
Planner::block_buffer_head
static volatile uint8_t block_buffer_head
Definition: planner.h:227
_marlin_mesh_t::xc
uint8_t xc
Definition: marlin_events.h:104
HOST_PROMPT_BTN_PurgeMore
Definition: marlin_host.h:28
MARLIN_EVT_MediaInserted
#define MARLIN_EVT_MediaInserted
Definition: marlin_events.h:11
MARLIN_EVT_PrintTimerStopped
#define MARLIN_EVT_PrintTimerStopped
Definition: marlin_events.h:17
osThreadGetId
osThreadId osThreadGetId(void)
Return the thread ID of the current running thread.
Definition: cmsis_os.c:283
_variant8_t::usr16
uint16_t usr16
Definition: variant8.h:27
NULL
#define NULL
Definition: usbd_def.h:53
MARLIN_SFLG_PENDREQ
#define MARLIN_SFLG_PENDREQ
Definition: marlin_server.h:14
marlin_server_park_head
void marlin_server_park_head(void)
Definition: marlin_server.cpp:365
MarlinSettings::save
static bool save()
Definition: configuration_store.cpp:2198
wait_for_user
bool wait_for_user
Definition: Marlin.cpp:188
_marlin_server_t::client_changes
uint64_t client_changes[MARLIN_MAX_CLIENTS]
Definition: marlin_server.cpp:62
variant8_user
variant8_t variant8_user(uint32_t usr32)
Definition: variant8.c:54
osMessageQId
QueueHandle_t osMessageQId
Definition: cmsis_os.h:303
MARLIN_USR8_VAR_FLG
#define MARLIN_USR8_VAR_FLG
Definition: marlin_vars.h:59
osMessageGet
osEvent osMessageGet(osMessageQId queue_id, uint32_t millisec)
Get a Message or Wait for a Message from a Queue.
Definition: cmsis_os.c:1145
marlin_server
marlin_server_t marlin_server
Definition: marlin_server.cpp:92
HAL_GetTick
uint32_t HAL_GetTick(void)
Provides a tick value in millisecond.
Definition: stm32f4xx_hal.c:339
all_axes_known
FORCE_INLINE bool all_axes_known()
Definition: motion.h:45
MARLIN_VAR_WAITUSER
#define MARLIN_VAR_WAITUSER
Definition: marlin_vars.h:28
MARLIN_EVT_Reheat
#define MARLIN_EVT_Reheat
Definition: marlin_events.h:37
msg_stack::msg_data
char msg_data[MSG_STACK_SIZE][MSG_MAX_LENGTH]
Definition: marlin_server.h:28
osEvent
Definition: cmsis_os.h:395
_marlin_vars_t::temp_nozzle
float temp_nozzle
Definition: marlin_vars.h:83
_variant8_t
Definition: variant8.h:24
_marlin_server_t
Definition: marlin_server.cpp:54
host_prompt_button
char host_prompt_button[HOST_BUTTON_CNT_MAX][HOST_PROMPT_LEN_MAX]
Definition: marlin_server.cpp:126
marlin_server_settings_load
void marlin_server_settings_load(void)
Definition: marlin_server.cpp:331
_send_notify_event
void _send_notify_event(uint8_t evt_id, uint32_t usr32, uint16_t usr16)
Definition: marlin_server.cpp:481
osSemaphoreCreate
osSemaphoreId osSemaphoreCreate(const osSemaphoreDef_t *semaphore_def, int32_t count)
Create and Initialize a Semaphore object used for managing resources.
Definition: cmsis_os.c:755
marlin_server_sema
osSemaphoreId marlin_server_sema
Definition: marlin_server.cpp:90
HAL_IWDG_Refresh
HAL_StatusTypeDef HAL_IWDG_Refresh(IWDG_HandleTypeDef *hiwdg)
osSemaphoreDef
#define osSemaphoreDef(name)
Definition: cmsis_os.h:700
feedrate_percentage
int16_t feedrate_percentage
Definition: motion.cpp:139
HOST_PROMPT_BTN_None
Definition: marlin_host.h:26
_marlin_server_t::notify_events
uint64_t notify_events
Definition: marlin_server.cpp:56
DBG_REQ
#define DBG_REQ(...)
Definition: marlin_server.cpp:41
MARLIN_EVT_StoreSettings
#define MARLIN_EVT_StoreSettings
Definition: marlin_events.h:23
_variant8_t::flt
float flt
Definition: variant8.h:31
MARLIN_VAR_TEMP_NOZ
#define MARLIN_VAR_TEMP_NOZ
Definition: marlin_vars.h:19
BLOCK_BUFFER_SIZE
#define BLOCK_BUFFER_SIZE
Definition: Configuration_A3ides_2209_MINI_adv.h:1167
marlin_client_queue
osMessageQId marlin_client_queue[MARLIN_MAX_CLIENTS]
Definition: marlin_client.c:60
MARLIN_EVT_CommandEnd
#define MARLIN_EVT_CommandEnd
Definition: marlin_events.h:34
MARLIN_MAX_REQUEST
#define MARLIN_MAX_REQUEST
Definition: config.h:97
MARLIN_VAR_MSK_IPOS_XYZE
#define MARLIN_VAR_MSK_IPOS_XYZE
Definition: marlin_vars.h:37
_marlin_server_t::pqueue
uint8_t pqueue
Definition: marlin_server.cpp:68
MARLIN_VAR_PQUEUE
#define MARLIN_VAR_PQUEUE
Definition: marlin_vars.h:10
_marlin_server_t::request
char request[MARLIN_MAX_REQUEST]
Definition: marlin_server.cpp:59
MARLIN_EVT_PrintTimerPaused
#define MARLIN_EVT_PrintTimerPaused
Definition: marlin_events.h:16
MARLIN_EVT_StopProcessing
#define MARLIN_EVT_StopProcessing
Definition: marlin_events.h:29
MARLIN_EVT_CommandBegin
#define MARLIN_EVT_CommandBegin
Definition: marlin_events.h:33
planner_settings_t::axis_steps_per_mm
float axis_steps_per_mm[XYZE_N]
Definition: planner.h:181
MARLIN_VAR_GQUEUE
#define MARLIN_VAR_GQUEUE
Definition: marlin_vars.h:9
osMessagePut
osStatus osMessagePut(osMessageQId queue_id, uint32_t info, uint32_t millisec)
Put a Message to a Queue.
Definition: cmsis_os.c:1113
Stopwatch::duration
static millis_t duration()
Get the running time.
Definition: stopwatch.cpp:108
void
void
Definition: png.h:1083
osEventMessage
function completed; message event occurred.
Definition: cmsis_os.h:237
_marlin_vars_t::wait_heat
uint8_t wait_heat
Definition: marlin_vars.h:91
_marlin_vars_t::target_nozzle
float target_nozzle
Definition: marlin_vars.h:85
marlin_server_inject_gcode
int marlin_server_inject_gcode(const char *gcode)
Definition: marlin_server.cpp:322
HOST_PROMPT_LoadFilament
Definition: marlin_host.h:21
MARLIN_VAR_WAITHEAT
#define MARLIN_VAR_WAITHEAT
Definition: marlin_vars.h:27
_process_server_request
int _process_server_request(char *request)
Definition: marlin_server.cpp:702
_send_notify_event_to_client
int _send_notify_event_to_client(int client_id, osMessageQId queue, uint8_t evt_id, uint32_t usr32, uint16_t usr16)
Definition: marlin_server.cpp:397
Stopwatch::pause
static bool pause()
Pause the stopwatch.
Definition: stopwatch.cpp:52
osWaitForever
#define osWaitForever
wait forever timeout value
Definition: cmsis_os.h:230
if
if(size<=((png_alloc_size_t) -1) - ob)
Definition: pngwrite.c:2176
_send_notify_events_to_client
uint64_t _send_notify_events_to_client(int client_id, osMessageQId queue, uint64_t evt_msk)
Definition: marlin_server.cpp:407
_marlin_server_t::vars
marlin_vars_t vars
Definition: marlin_server.cpp:58
host_prompt_button_t
host_prompt_button_t
Definition: marlin_host.h:25
_marlin_vars_t::wait_user
uint8_t wait_user
Definition: marlin_vars.h:92
MARLIN_EVT_MeshUpdate
#define MARLIN_EVT_MeshUpdate
Definition: marlin_events.h:24
GCodeQueue::enqueue_one
static bool enqueue_one(const char *cmd)
Definition: queue.cpp:157
_marlin_vars_t::temp_bed
float temp_bed
Definition: marlin_vars.h:84
uint8_t
const uint8_t[]
Definition: 404_html.c:3
_marlin_mesh_t::z
float z[MARLIN_MAX_MESH_POINTS]
Definition: marlin_events.h:103
MARLIN_VAR_MSK
#define MARLIN_VAR_MSK(v_id)
Definition: marlin_vars.h:35
_marlin_server_t::idle_cnt
uint8_t idle_cnt
Definition: marlin_server.cpp:65
Babystep::task
static void task()
VARIANT8_EMPTY
#define VARIANT8_EMPTY
Definition: variant8.h:8
MARLIN_VAR_PRNSPEED
#define MARLIN_VAR_PRNSPEED
Definition: marlin_vars.h:25
MARLIN_EVT_HostPrompt
#define MARLIN_EVT_HostPrompt
Definition: marlin_events.h:26
_marlin_server_t::mesh_point_notsent
uint64_t mesh_point_notsent[MARLIN_MAX_CLIENTS]
Definition: marlin_server.cpp:72
MSG_MAX_LENGTH
#define MSG_MAX_LENGTH
Definition: marlin_server.h:19
MARLIN_EVT_FactoryReset
#define MARLIN_EVT_FactoryReset
Definition: marlin_events.h:21
MARLIN_VAR_SD_PRINT
#define MARLIN_VAR_SD_PRINT
Definition: marlin_vars.h:29
_marlin_server_t::request_len
int request_len
Definition: marlin_server.cpp:60
Y_AXIS
Definition: types.h:38
MARLIN_SFLG_STARTED
#define MARLIN_SFLG_STARTED
Definition: marlin_server.h:11
MARLIN_CMD_G
#define MARLIN_CMD_G
Definition: marlin_events.h:51
_marlin_vars_t::print_speed
uint16_t print_speed
Definition: marlin_vars.h:89
Planner::quick_stop
static void quick_stop()
Definition: planner.cpp:1475
MARLIN_VAR_DURATION
#define MARLIN_VAR_DURATION
Definition: marlin_vars.h:31
_marlin_mesh_t::yc
uint8_t yc
Definition: marlin_events.h:105
MARLIN_EVT_StatusChanged
#define MARLIN_EVT_StatusChanged
Definition: marlin_events.h:20
marlin_server_print_resume
void marlin_server_print_resume(void)
Definition: marlin_server.cpp:359
Z_AXIS
Definition: types.h:39
_marlin_vars_t::print_duration
uint32_t print_duration
Definition: marlin_vars.h:95
_marlin_vars_t::sd_percent_done
uint8_t sd_percent_done
Definition: marlin_vars.h:94
MARLIN_VAR_MSK_POS_XYZE
#define MARLIN_VAR_MSK_POS_XYZE
Definition: marlin_vars.h:40
_marlin_vars_t::flow_factor
uint16_t flow_factor
Definition: marlin_vars.h:90
status
static status_t status
Definition: filament_sensor.c:37
MARLIN_UPDATE_PERIOD
#define MARLIN_UPDATE_PERIOD
Definition: marlin_server.h:17
MARLIN_EVT_Ready
#define MARLIN_EVT_Ready
Definition: marlin_events.h:31
bsod
#define bsod(fmt,...)
Definition: bsod.h:20
HOST_BUTTON_CNT_MAX
#define HOST_BUTTON_CNT_MAX
Definition: marlin_server.cpp:49
_marlin_vars_t::gqueue
uint8_t gqueue
Definition: marlin_vars.h:79
MARLIN_EVT_StartProcessing
#define MARLIN_EVT_StartProcessing
Definition: marlin_events.h:28
_marlin_server_t::pqueue_tail
uint8_t pqueue_tail
Definition: marlin_server.cpp:67
_server_update_gqueue
void _server_update_gqueue(void)
Definition: marlin_server.cpp:520
osMessageCreate
osMessageQId osMessageCreate(const osMessageQDef_t *queue_def, osThreadId thread_id)
Create and Initialize a Message Queue.
Definition: cmsis_os.c:1086
osMessageQ
#define osMessageQ(name)
Access a Message Queue Definition.
Definition: cmsis_os.h:829
marlin_server_start_processing
void marlin_server_start_processing(void)
Definition: marlin_server.cpp:288
_variant8_t::usr8
uint8_t usr8
Definition: variant8.h:26
marlin_server_manage_heater
void marlin_server_manage_heater(void)
Definition: marlin_server.cpp:335
MarlinSettings::load
static FORCE_INLINE bool load()
Definition: configuration_store.h:79
marlin_host_prompt_by_text
host_prompt_type_t marlin_host_prompt_by_text(const char *text)
Definition: marlin_host.c:29
MARLIN_CMD_NONE
#define MARLIN_CMD_NONE
Definition: marlin_events.h:50
_marlin_vars_t::pos
float pos[4]
Definition: marlin_vars.h:82
DBG_HOST
#define DBG_HOST
Definition: marlin_server.cpp:43
MARLIN_EVT_MediaRemoved
#define MARLIN_EVT_MediaRemoved
Definition: marlin_events.h:13
Stepper::position
static int32_t position(const AxisEnum axis)
Definition: stepper.cpp:2214
MARLIN_VAR_TTEM_NOZ
#define MARLIN_VAR_TTEM_NOZ
Definition: marlin_vars.h:21
hiwdg
IWDG_HandleTypeDef hiwdg
Definition: watchdog.h:24
osEvent::value
union osEvent::@54 value
event value
marlin_server_cycle
int marlin_server_cycle(void)
Definition: marlin_server.cpp:168
XYZval< float >
MSG_STACK_SIZE
#define MSG_STACK_SIZE
Definition: marlin_server.h:18
GCodeQueue::inject_P
static void inject_P(PGM_P const pgcode)
Definition: queue.cpp:206
_variant8_t::ui32
uint32_t ui32
Definition: variant8.h:32
MARLIN_CMD_M701
#define MARLIN_CMD_M701
Definition: marlin_events.h:58
E_AXIS
Definition: types.h:40
HOST_PROMPT_BTN_Continue
Definition: marlin_host.h:27
_marlin_server_t::gqueue
uint8_t gqueue
Definition: marlin_server.cpp:69
marlin_vars_str_to_value
int marlin_vars_str_to_value(marlin_vars_t *vars, uint8_t var_id, const char *str)
Definition: marlin_vars.c:251
MARLIN_EVT_Busy
#define MARLIN_EVT_Busy
Definition: marlin_events.h:30
wait_for_heatup
bool wait_for_heatup
Definition: Marlin.cpp:184
MARLIN_EVT_Acknowledge
#define MARLIN_EVT_Acknowledge
Definition: marlin_events.h:38
MARLIN_IDLE_CNT_BUSY
#define MARLIN_IDLE_CNT_BUSY
Definition: marlin_server.cpp:237
variant8_flt
variant8_t variant8_flt(float flt)
Definition: variant8.c:48
Planner::settings
static planner_settings_t settings
Definition: planner.h:251
marlin_server_quick_stop
void marlin_server_quick_stop(void)
Definition: marlin_server.cpp:339
osEvent::v
uint32_t v
message as 32-bit value
Definition: cmsis_os.h:398
marlin_server_print_pause
void marlin_server_print_pause(void)
Definition: marlin_server.cpp:353
_marlin_vars_t::sd_printing
uint8_t sd_printing
Definition: marlin_vars.h:93
nozzle
Nozzle nozzle
Definition: nozzle.cpp:29
idle
void idle()
Definition: Marlin.cpp:629
_send_notify_change_to_client
int _send_notify_change_to_client(osMessageQId queue, uint8_t var_id, variant8_t var)
Definition: marlin_server.cpp:498
_marlin_vars_t::target_bed
float target_bed
Definition: marlin_vars.h:86
_marlin_server_t::command
uint32_t command
Definition: marlin_server.cpp:70
MARLIN_SFLG_PROCESS
#define MARLIN_SFLG_PROCESS
Definition: marlin_server.h:12
thermalManager
Temperature thermalManager
Definition: temperature.cpp:89
_marlin_vars_t::ipos
int32_t ipos[4]
Definition: marlin_vars.h:81
marlin_host_prompt_encode
uint32_t marlin_host_prompt_encode(marlin_host_prompt_t *prompt)
Definition: marlin_host.c:52
Babystep::add_steps
static void add_steps(const AxisEnum axis, const int16_t distance)
MARLIN_EVT_PrintTimerStarted
#define MARLIN_EVT_PrintTimerStarted
Definition: marlin_events.h:15
marlin_server_update
void marlin_server_update(uint64_t update)
Definition: marlin_server.cpp:303
_send_notify_to_client
int _send_notify_to_client(osMessageQId queue, variant8_t msg)
Definition: marlin_server.cpp:385
MARLIN_VAR_Z_OFFSET
#define MARLIN_VAR_Z_OFFSET
Definition: marlin_vars.h:23
_marlin_vars_t::motion
uint8_t motion
Definition: marlin_vars.h:78
_marlin_vars_t::fan_speed
uint8_t fan_speed
Definition: marlin_vars.h:88
MARLIN_EVT_FilamentRunout
#define MARLIN_EVT_FilamentRunout
Definition: marlin_events.h:18
planner
Planner planner
Definition: planner.cpp:111
all_axes_homed
FORCE_INLINE bool all_axes_homed()
Definition: motion.h:44
createSpeedLookupTable.parser
parser
Definition: createSpeedLookupTable.py:14
osMessageQDef
#define osMessageQDef(name, queue_sz, type)
Create a Message Queue Definition.
Definition: cmsis_os.h:818
marlin_vars_get_id_by_name
int marlin_vars_get_id_by_name(const char *var_name)
Definition: marlin_vars.c:42
_variant8_t::i32
int32_t i32
Definition: variant8.h:33