Skip to content

Commit

Permalink
merge repositories manually
Browse files Browse the repository at this point in the history
  • Loading branch information
314rs committed May 14, 2024
1 parent 5bfe5f9 commit 0fab546
Show file tree
Hide file tree
Showing 9 changed files with 752 additions and 64 deletions.
2 changes: 1 addition & 1 deletion .doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ DOXYFILE_ENCODING = UTF-8
# title of most generated pages and in a few other places.
# The default value is: My Project.

PROJECT_NAME = CPP_CROSS_PLATTFORM_TEMPLATE
PROJECT_NAME = LPKF91s

# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
# could be handy for archiving the generated documentation or if some version
Expand Down
53 changes: 28 additions & 25 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
cmake_minimum_required(VERSION 3.23)

set(MY_PROJECT_NAME "CPP_TEMPLATE")
cmake_minimum_required(VERSION 3.29)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

project(
MY_PROJECT_NAME
VERSION 0.1.0
LANGUAGES CXX
)
LPKF91s
VERSION 0.1.0
LANGUAGES CXX
)

find_package(GTest REQUIRED)
find_package(SQLite3 REQUIRED)
find_package(Boost REQUIRED)
find_package(fmt REQUIRED)
find_package(spdlog REQUIRED)
find_package(wxWidgets REQUIRED)

if (GCC)

add_compile_options(-pedantic) # Warn on language extensions
add_compile_options(-Wall) # -Wextra reasonable and standard
add_compile_options(-Wshadow) # warn the user if a variable declaration shadows one from a parent context
Expand Down Expand Up @@ -46,7 +41,7 @@ if (GCC)

elseif(MSVC)

add_compile_definitions(_WIN32_WINNT=0x0601) # windows feature magic happening here (just here to avoid compiler warning from boost??)
add_compile_definitions(_WIN32_WINNT=0x0601) # windows feature magic happening here (just here to avoid compiler warning from boost??)

add_compile_options(/permissive-) # Enforces standards conformance.
add_compile_options(/W4) # All reasonable warnings
Expand All @@ -72,18 +67,33 @@ elseif(MSVC)
add_compile_options(/w14928) # illegal copy-initialization; more than one user-defined conversion has been implicitly applied
endif()

add_executable(MY_PROJECT_NAME src/main.cpp)
target_link_libraries(MY_PROJECT_NAME gtest::gtest)
target_link_libraries(MY_PROJECT_NAME SQLite::SQLite3)
target_link_libraries(MY_PROJECT_NAME Boost::boost)
configure_file(src/test.h.in project_version.h)
include_directories(${PROJECT_BINARY_DIR})

add_executable(gcode2hpgl src/gcode2hpgl_cli.cpp)
target_link_libraries(gcode2hpgl gtest::gtest)
target_link_libraries(gcode2hpgl boost::boost)

add_executable(hpgl2lpkf91s src/hpgl2lpkf91s_cli.cpp)
target_link_libraries(hpgl2lpkf91s boost::boost)

add_executable(lpkf91s src/lpkf91s_gui.cpp)
set_target_properties(lpkf91s PROPERTIES WIN32_EXECUTABLE $<CONFIG:Release>)
target_link_libraries(lpkf91s wxWidgets::wxWidgets)
target_link_libraries(lpkf91s boost::boost)
# target_sources(lpkf91s PRIVATE ./src/resource.rc)

add_executable(sendHPGL src/sendhpgl_gui.cpp)
set_target_properties(sendHPGL PROPERTIES WIN32_EXECUTABLE $<CONFIG:Release>)
target_link_libraries(sendHPGL wxWidgets::wxWidgets)
target_link_libraries(sendHPGL boost::boost)
# target_sources(sendHPGL PRIVATE ./src/resource.rc)



# Prevent building in the source directory
if(PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
message(FATAL_ERROR "In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there.\n")
message(FATAL_ERROR "In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there.\n")
endif()


Expand All @@ -92,20 +102,13 @@ endif()
# Testing
include(CTest)
include(GoogleTest)
gtest_discover_tests(gcode2hpgl)

add_executable(mainTest ./src/mainTest.cpp)
target_link_libraries(mainTest GTest::gtest_main)

add_test(NAME testMainReturns COMMAND MY_PROJECT_NAME)

add_test(NAME testMainOuput COMMAND MY_PROJECT_NAME)
set_property(TEST testMainOuput PROPERTY PASS_REGULAR_EXPRESSION "Hello World!")

add_compile_options(-DCMAKE_EXPORT_COMPILE_COMMANDS=ON)
set(CMAKE_CXX_CLANG_TIDY
clang-tidy-11;
-header-filter=${CMAKE_CURRENT_SOURCE_DIR};
)

gtest_discover_tests(mainTest TEST_PREFIX gtest.)
gtest_discover_tests(MY_PROJECT_NAME)
104 changes: 83 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,91 @@
[![CMake and CTest on ubuntu-latest](https://github.com/314rs/lpkf91s/actions/workflows/cmake-ubuntu-latest.yml/badge.svg)](https://github.com/314rs/lpkf91s/actions/workflows/cmake-ubuntu-latest.yml)
# LPKF91s tooling - gcode to hpgl converter
[![CMake and CTest on ubuntu-latest](https://github.com/314rs/cpp_cross_plattform_template_study/actions/workflows/cmake-ubuntu-latest.yml/badge.svg?branch=main)](https://github.com/314rs/cpp_cross_plattform_template_study/actions/workflows/cmake-ubuntu-latest.yml)
# C++ cross-plattform template

This project features some helper programs to revive the LPKF91s PCB mill.
with:
- cmake
- conan
- doxygen
- github actions

The individual components are:
- __gcode2hpgl__: a converter from gcode to hpgl. (cli, gui)
- __hpgl2serial__: send a hpgl file to the PCB mill via a serial port. (cli, gui)
- a manual hpgl sender (gui)

## Download
Download the program for your platform from the releases
## Commands

gcode -> hpgl absolute (hpgl relative)

## Build yourself
### Dependencies
- CMake
- conan package manager
- WxWidgets
- boost (asio, program_options)
### G00 & G01

### Build
```bash
conan install conanfile.txt --build=missing
```
#### Parameters

Not all parameters need to be used, but at least one has to be used

```bash
cmake
```text
Xnnn The position to move to on the X axis
Ynnn The position to move to on the Y axis
Znnn The position to move to on the Z axis
Ennn The amount to extrude between the starting point and ending point
Fnnn The feedrate per minute of the move between the starting point and ending poin (if supplied)
Hnnn (RepRapFirmware) Flag to check if an endstop was hit (H1 to check, H0 to ignore, other Hnnn see note, default is H0)1
Rnnn (RepRapFirmware) Restore point number 4
Snnn Laser cutter/engraver power. In RepRapFirmware, when not in laser mode S in interpreted the same as H.
```

absolute -> `PA (x1,y1{,...xn,yn}){;}` (plot absolute)

relative -> `PR (x1,y1{,...xn,yn}){;}` (plot relative)

-> `PD {;}` (pen down) iff Z position is low _parameter z_

-> `PU {;}` (pen up) iff Z position is high _parameter z_

-> `VS (v{,n}){;}` Velocity select
Defines the track speed in the XY level v=[mm/s] with the tool lowered and allocates this speed to the tool with number n. _parameter F ?!?!?_

### G21

Set units to mm

### G90
set to absolute positioning

### G91
set to relative positioning

### G92
set position
> i.e. Give the current position a new name
#### Parameters
This command can be used without any additional parameters.
`Xnnn` new X axis position
`Ynnn` new Y axis position
`Znnn` new Z axis position
`Ennn` new extruder position

### M0
Stop or unconditional stop

#### Parameters
This command can be used without any additional parameters.
`Pnnn` Time to wait, in milliseconds1
`Snnn` Time to wait, in seconds2
#### Example
`M0`


### M3
Spindle On, Clockwise

#### Parameters
```Snnn Spindle RPM```
#### Example
```M3 S4000```


### M5
Spindle off

### M6
Tool change

### T1
select tool
6 changes: 2 additions & 4 deletions conanfile.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
[requires]
sqlite3/3.45.0
fmt/10.2.1
spdlog/1.13.0
gtest/1.14.0
boost/1.84.0
asio/1.30.2
boost/1.85.0

[generators]
CMakeDeps
Expand Down
Loading

0 comments on commit 0fab546

Please sign in to comment.