Skip to content

Commit

Permalink
🚀 1.add octoprint api 2.combine prusa firmware
Browse files Browse the repository at this point in the history
  • Loading branch information
fiber-punk committed Sep 29, 2022
1 parent 5ec6bfc commit ab034ba
Show file tree
Hide file tree
Showing 5 changed files with 256 additions and 123 deletions.
8 changes: 7 additions & 1 deletion WifiNode/nodeconfig.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "nodeconfig.h"

AsyncWebServer server(88);
AsyncWebServer octo_server(80);
AsyncEventSource events("/events");

HTTPClient http_client;
Expand Down Expand Up @@ -42,7 +43,12 @@ bool paused_for_user = false;
bool paused_for_filament = false;

//printer sd type: 0==spi 1==sdio
uint8_t printer_sd_type = 0;
#if MB(MARLIN_VER)
uint8_t printer_sd_type = 0;
#elif MB(PRUSA_VER)
uint8_t printer_sd_type = 1;
#endif


//last power status 0==idle 1==printing
uint8_t last_power_status = 0;
Expand Down
16 changes: 14 additions & 2 deletions WifiNode/nodeconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,18 @@
#include "crc8.h"
#include "FiberPunk_SSD1306.h"

#define VERSION "2022-9-21-2006-Beta"
#define MARLIN_VER 0x01
#define PRUSA_VER 0x02
#define FMTYPE MARLIN_VER
// #define FMTYPE PRUSA_VER
#define MB(V) (V==FMTYPE)

#if MB(MARLIN_VER)
#define VERSION "2022-9-29-2007"
#elif MB(PRUSA_VER)
#define VERSION "2022-9-29-2007-PRUSA-MK3S"
#endif

#define DBG_OUTPUT_PORT Serial
#define PRINTER_PORT Serial
#define RED_LED 26
Expand Down Expand Up @@ -51,6 +62,7 @@ enum ERROR_CODE
};

extern AsyncWebServer server;
extern AsyncWebServer octo_server;
extern AsyncEventSource events;
// extern HTTPClient http_client;
extern AsyncClient socket_client;
Expand Down Expand Up @@ -105,7 +117,7 @@ extern void sendHttpMsg(String);
extern void writeLog(String);
extern void saveCurrentPrintStatus(String status_str);
extern String getValue(String data, char separator, int index);
extern void Write_String(int a,int b,String str);
extern void writeString(int a,int b,String str);
extern uint8_t lastPowerOffPrinting();
class NodeConfig
{
Expand Down
20 changes: 7 additions & 13 deletions WifiNode/printerprocess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ void setWifiConfigByPort(String config_str)
}
else if(cmd_name=="SAVE")
{
Write_String(1,30,cf_ssid);
writeString(1,30,cf_ssid);
delay(100);
Write_String(5,60,cf_password);
writeString(5,60,cf_password);
delay(100);
Write_String(9,90,cf_node_name);
writeString(9,90,cf_node_name);
delay(100);
Serial.print("SAVE");
}
Expand Down Expand Up @@ -111,7 +111,10 @@ void readPrinterBack()
}
else if(inData.indexOf("$f")!=-1)
{
current_usb_status = 0;
if(g_status!=PRINTING)
{
current_usb_status = 0;
}
}

if(inData.indexOf("@Stop")!=-1)
Expand Down Expand Up @@ -158,15 +161,6 @@ void readPrinterBack()
cancleOrFinishPrint();

}

// if(inData.indexOf("no file")!=-1)
// {
// cancleOrFinishPrint();
// print_start_flag = 1;
// }

//Current file: (no file)


}
inData="";
Expand Down
Loading

0 comments on commit ab034ba

Please sign in to comment.