Skip to content

Commit

Permalink
Repair emu compilation (#194)
Browse files Browse the repository at this point in the history
* Correctly unpack protocol commands

* Repair emulator compilation
  • Loading branch information
Xenoamor authored and kanflo committed Oct 20, 2019
1 parent e870b15 commit 8618ef6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
18 changes: 14 additions & 4 deletions emu/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
TARGET = dpsemu
LIBS = -lm -lpthread
CC = gcc
CFLAGS = -m32 -g -Wall -I. -I../opendps -DCONFIG_DPS_MAX_CURRENT=5000 -Ddbg_printf=printf -DDPS5005 -DDPS_EMULATOR -DCONFIG_CC_ENABLE -Wmissing-braces
CFLAGS = -m32 -g -Wall -I. -I../opendps -DCONFIG_DPS_MAX_CURRENT=5000 -Ddbg_printf=printf -DDPS5005 -DDPS_EMULATOR -DCONFIG_CC_ENABLE -DCOLOR_INPUT=WHITE -DCOLOR_VOLTAGE=WHITE -DCOLOR_AMPERAGE=WHITE -Wmissing-braces

.PHONY: default all clean

Expand Down Expand Up @@ -30,9 +30,19 @@ SRCS = opendps.c \
func_cv.c \
func_cc.c \
misc.c \
font-18.c \
font-24.c \
font-48.c \
font-full_small.o \
font-meter_small.o \
font-meter_medium.o \
font-meter_large.o \
gfx-cc.o \
gfx-crosshair.o \
gfx-cv.o \
gfx-cl.o \
gfx-padlock.o \
gfx-thermometer.o \
gfx-wifi.o \
gfx-power.o \
settings_calibration.o \

#OBJECTS = $(patsubst ../%, %, $(patsubst %.c, %.o, $(SRCS)))
OBJECTS = $(patsubst %.c, %.o, $(SRCS))
Expand Down
5 changes: 5 additions & 0 deletions emu/dpsemul.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ struct sockaddr_in comm_client_sock;
void dps_emul_send_frame(frame_t *frame)
{
int slen = sizeof(comm_client_sock);

printf("[Com] Transmitted %u bytes\n", frame->length);
for (uint32_t i = 0; i < frame->length; ++i)
printf(" 0x%02X\n", frame->buffer[i]);

if (sendto(comm_sock, frame->buffer, frame->length, 0, (struct sockaddr*) &comm_client_sock, slen) == -1) {
printf("Error: sendto()\n");
}
Expand Down

0 comments on commit 8618ef6

Please sign in to comment.