Skip to main content

Printers

Main concepts #

These two objects are two distinct objects interacting with two seperate APIs (Octoprint & PrusaLink) but are used together as that is what Team 302 has


SinglePrinter #

For printers running off of Octoprint API

Variables #

Type String #

  • Static as “MK3”

Nickname String #

  • Given nickname to the printer

Code String #

  • Given 2 letter code given to printer (used in database)

State String #

  • Current state of the printer Note: This has a partial implementation, recomended to reference octoprint state due to lack of updates

Printer Octoprint Printer Object #

  • Used for core functions sending commands directly to the printer
    The below items are not currently implemented with full functionality

User String #

  • Current user printing

Current File String #

  • Current file printing

Queue [Queue Object] #

  • List of objects in queue to print

Methods #

Pause #

  • Sends a command to pause the print

Resume #

  • Sends a command to resume the print

UpdateState #

  • Updates the state property of the object

Preheat #

  • Preheats nozzle to 120ºC and bed to 60ºC (PLA)

Cooldown #

  • Sets targets to 0 (cooldown)

UploadLocal(File path : String, File name : String, Uploader : String) #

  • Only used during local testing and uploads files on the server to the printer

DisplayMSG(Message : String) #

  • Displays a message on the LCD displays on the printer using M117 GCODE

Upload(Print : IndividualPrint, PrintImmedietly : Bool) #

  • Printing immedietly isn’t mandatory and is assumed as true
  • Takes file contents from print object and uploads them to the printer
  • If it is to print immedietly, it selects it and sets current file and current user

Abort #

  • Attempts to cancel the currently printing object

FetchNozzleTemp #

  • Returns the nozzle temperatue Int

FetchBedTemp #

  • Returns the bed temperature Int

FetchTimeRemaining #

  • Returns the time remaining in a print in seconds Int
  • If there is no time left, it returns -60 (-1 minute) Int This can occasionally show up at the end of a print where Octoprint puts the state as printing, but does not return any time remaining

Scheduler #

  • Not used, old plans for an individual printer to optimize it’s print queue

PercentUsed #

  • Returns the percent used Int (0-100)

NukeFiles #

  • Not currently accessible through web
  • Operation used to remove all files saved on Octoprint to free up storage space on each invidual printers computer

Mk4Printer #

Variables #

This was developed much later and now most values can be None until refreshed or updated, if it can be None, is designated with a ? at the end

Type String #

  • Static value returning “MK4”

Nozzle Temp Int? #

  • Returns stored nozzle temp in ºC

Bed Temp Int? #

  • Returns stored bed temp in ºC

State String? #

CurrentPrintID String? #

  • PrusaLink determined ID of the current job

Progress Int? (0-100) #

  • Current stored progress of transfer
The above items aren’t automatically updated when fetched, please use refreshData to get the most accurate information

IP String #

  • The IP address of the given printer to connect to PrusaLink with

PortStr String? #

  • Serial port on which to attempt a connection
    Serial support was fully implemented and tested (On Mk3) however, at the time of writing, 7/29/2024, serial connections are not supported on the Prusa Mk4

Key String #

  • API Key to be used with PrusaLink

Prefix String #

  • Two charachter prefix defined in config

Nickname String #

  • Given nickname for the printer

Transfer Int? (0-100) #

  • Current transfer progress

Methods #

CMD(Command : String) #

  • Sends a command over serial

Preheat(Type : String (Both, Bed, Nozzle)) #

  • Sends serial command to preheat the bed and/or nozzle

Cooldown(Type : String (Both, Bed, Nozzle)) #

  • Sends serial command to cool the bed and/or nozzle

ReturnHome #

  • Sends serial command to return the bed to the home position
The above commands are implemented and tested (On Mk3), however at the time of writing, 7/29/2024, serial connections are not supported on the Prusa Mk4

Abort #

  • Sends a serial command to abort if available
  • Sends a PrusaLink command to stop

RefreshData #

  • Refreshes all data setting them to none if data isn’t available

CheckUpdate #

  • Checks if the system or PrusaLink can be updated

PushUpdate(Type : String (System, PrusaLink)) #

  • Pushes update to the system or prusalink

FetchNozzleTemp #

  • Refreshes data and returns nozzle temp

FetchBedTemp #

  • Refreshes data and returns bed temp

Upload(File Text : String, Nickname : String, BGCODE : Bool, PrintRightAway : Bool) #

  • Sets path based off of nickname and BGCODE status
  • Sets upload state based on printRightAway
  • Sends request to Mk4

PrintFileOnUSB(Nickname : String, BGCODE : Bool, Storage : String) #

  • Selects print on USB to print

TransferStatus #

  • Refreshes data and sends transfer status (0-100)

Stop #

  • Sends request to stop current print job

Pause #

  • Sends request to pause current print job

Resume #

  • Sends request to pause current print job

State #