Skip to content

Commit

Permalink
git-svn-id: svn://192.168.1.10/public/Zimodem@22212 0d6f1817-ed0e-041…
Browse files Browse the repository at this point in the history
…0-87c9-987e46238f29
  • Loading branch information
bozimmerman committed Apr 3, 2023
1 parent 438b1d2 commit 0a13d6b
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions zimodem/zslipmode.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

#ifdef INCLUDE_SLIP
#include "lwip/raw.h"

class ZSLIPMode: public ZMode
{
Expand Down
31 changes: 31 additions & 0 deletions zimodem/zslipmode.ino
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,31 @@
*/
#ifdef INCLUDE_SLIP

static uint8_t _raw_recv(void *arg, raw_pcb *pcb, pbuf *pb, const ip_addr_t *addr)
{
debugPrintf("->\n\r");
while(pb != NULL)
{
pbuf * this_pb = pb;
pb = pb->next;
this_pb->next = NULL;
for(int i=0;i<this_pb->len;i+=4)
{
for(int l=i;l<i+4;l++)
{
if(l<this_pb->len)
{
debugPrintf(tohex(((uint8_t *)this_pb->payload)[l]));
debugPrintf(" ");
}
}
debugPrintf("\n\r");
}
//pbuf_free(this_pb); // at this point, there are no refs, so errs out.
}
debugPrintf("<\n\r");
return 0;
}

void ZSLIPMode::switchBackToCommandMode()
{
Expand All @@ -14,6 +39,12 @@ void ZSLIPMode::switchBackToCommandMode()

void ZSLIPMode::switchTo()
{
raw_pcb *_pcb = raw_new(IP_PROTO_TCP);
if(!_pcb){
return;
}
//_lock = xSemaphoreCreateMutex();
raw_recv(_pcb, &_raw_recv, (void *) _pcb);
currMode=&slipMode;
debugPrintf("Switched to SLIP mode\n\r");
}
Expand Down

0 comments on commit 0a13d6b

Please sign in to comment.