Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use port number passed into make and fix uploads #2

Merged
merged 4 commits into from
Aug 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
output-*.gcode
output-*.gcode
__pycache__
4 changes: 2 additions & 2 deletions LightBurnAdapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
help='Open the serial port PORT. Most likely this should be one port of a virtual serial port pair like com0com or tty0tty.')

target_device_args = parser.add_mutually_exclusive_group(required=True)
target_device_args.add_argument('--ip', nargs=1,
target_device_args.add_argument('--ip',
fritzw marked this conversation as resolved.
Show resolved Hide resolved
help='IP address of the laser cutter device.')
target_device_args.add_argument('--usb', action='store_const', dest='ip', const='201.234.3.1',
help='Connect to laser cutter via USB (which is a network interface with IP 201.234.3.1).')
Expand Down Expand Up @@ -101,7 +101,7 @@ def filename(i):
answer = input(f'Upload {translated_file} to Lasercutter (y/n/d[elete])? ').lower()
if answer == 'y':
print('Okay, uploading. Press the blue button on the M1 to execute.')
m1.upload_gcode(file=translated_file)
m1.upload_gcode_file(filename=translated_file)
elif answer == 'd' or answer == 'delete':
print(f'Okay, deleting 2 files {filename(i)} and {translated_file}.')
os.unlink(filename(i))
Expand Down
7 changes: 5 additions & 2 deletions tcp_bridge/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CFLAGS ?= -Wall -Werror -pedantic -DPORT=$(PORT)
CFLAGS ?= -Wall -Werror -pedantic -D LISTEN_PORT=$(PORT)

tcp_bridge: tcp_bridge.c
$(CC) $(CFLAGS) -o $@ $^
Expand All @@ -8,4 +8,7 @@ tcp_bridge: tcp_bridge.c

setcap: tcp_bridge
@echo "Please enter your sudo password to grant $< access to ports below 1024."
sudo setcap CAP_NET_BIND_SERVICE=+eip "$<"
sudo setcap CAP_NET_BIND_SERVICE=+eip "$<"

clean:
rm -f tcp_bridge
3 changes: 1 addition & 2 deletions tcp_bridge/tcp_bridge.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#define IP_TO_INT(A, B, C, D) (((A) & 0xFF) << 24 | ((B) & 0xFF) << 16 | ((C) & 0xFF) << 8 | ((D) & 0xFF))

#define LISTEN_ADDRESS IP_TO_INT(127,0,0,1)
#define LISTEN_PORT 23
#define BUFFER_SIZE 1024
#define MAX_CLIENTS 1

Expand Down Expand Up @@ -130,4 +129,4 @@ int main()
close(server_socket);

return 0;
}
}