Skip to content

Commit

Permalink
Assorted cleaning (#332)
Browse files Browse the repository at this point in the history
* Merge/cleanup USBIP part 1

* Fix clang-tidy and cleanup errors

* Cleaning & washing of code
  • Loading branch information
vintagepc committed Oct 27, 2021
1 parent 3b10f40 commit 029cc59
Show file tree
Hide file tree
Showing 73 changed files with 5,720 additions and 59 deletions.
2 changes: 1 addition & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
Checks: '*,-modernize-use-emplace,-hicpp-use-emplace,-readability*,-cppcoreguidelines-pro-type-union-access,-hicpp-braces*,-fuchsia*,-llvm-header-guard,-cppcoreguidelines-special-member-functions,-hicpp-special-member-functions'
Checks: '*,-modernize-use-emplace,-hicpp-use-emplace,-readability*,-cppcoreguidelines-pro-type-union-access,-hicpp-braces*,-fuchsia*,-llvm-header-guard,-cppcoreguidelines-special-member-functions,-hicpp-special-member-functions,-clang-diagnostic-unused-command-line-argument'
HeaderFilterRegex: 'parts|utility'
}
76 changes: 76 additions & 0 deletions 3rdParty/MK3/thermistortables_2.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#pragma once

// TODO: more descriptive name.
const short table_100k_ntc[][2] = {
{ 25, 125 },
{ 29, 120 },
{ 34, 115 },
{ 40, 110 },
{ 46, 105 },
{ 54, 100 },
{ 64, 95 },
{ 75, 90 },
{ 88, 85 },
{ 105, 80 },
{ 124, 75 },
{ 146, 70 },
{ 173, 65 },
{ 204, 60 },
{ 241, 55 },
{ 282, 50 },
{ 330, 45 },
{ 382, 40 },
{ 439, 35 },
{ 500, 30 },
{ 563, 25 },
{ 625, 20 },
{ 687, 15 },
{ 744, 10 },
{ 796, 5 },
{ 842, 0 },
{ 882, -5 },
{ 915, -10 },
{ 941, -15 },
{ 963, -20 },
{ 979, -25 },
{ 992, -30 },
{ 1001, -35 },
{ 1008, -40 }
};

const short table_NCP21WF104J03RA[][2] = {
{ 73, 125 },
{ 83, 120 },
{ 95, 115 },
{ 109, 110 },
{ 125, 105 },
{ 144, 100 },
{ 165, 95 },
{ 189, 90 },
{ 217, 85 },
{ 248, 80 },
{ 284, 75 },
{ 323, 70 },
{ 366, 65 },
{ 412, 60 },
{ 462, 55 },
{ 514, 50 },
{ 567, 45 },
{ 620, 40 },
{ 673, 35 },
{ 723, 30 },
{ 770, 25 },
{ 813, 20 },
{ 851, 15 },
{ 885, 10 },
{ 913, 5 },
{ 937, 0 },
{ 957, -5 },
{ 973, -10 },
{ 986, -15 },
{ 995, -20 },
{ 1003, -25 },
{ 1009, -30 },
{ 1013, -35 },
{ 1016, -40 }
};
37 changes: 34 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ else()
endif()

if (ENABLE_TIDY)
set(CMAKE_CXX_CLANG_TIDY "/usr/bin/clang-tidy;-config=")
set(CMAKE_CXX_CLANG_TIDY "/usr/bin/clang-tidy-5.0;-config=")
else()
unset(CMAKE_CXX_CLANG_TIDY)
endif()
Expand All @@ -62,10 +62,12 @@ set(H_FILES_base
parts/ADCPeripheral.h
parts/BasePeripheral.h
parts/Board.h
parts/boards/CW1S.h
parts/boards/EinsyRambo.h
parts/boards/MiniRambo.h
parts/boards/MM_Control_01.h
parts/boards/Test_Board.h
parts/components/74HCT4052.h
parts/components/A4982.h
parts/components/ADC_Buttons.h
parts/components/Beeper.h
Expand All @@ -82,6 +84,7 @@ set(H_FILES_base
parts/components/Heater.h
parts/components/IRSensor.h
parts/components/LED.h
parts/components/MCP23S17.h
parts/components/MMU1.h
parts/components/MMU2.h
parts/components/PAT9125.h
Expand All @@ -93,6 +96,7 @@ set(H_FILES_base
parts/components/TMC2130.h
parts/components/UART_Logger.h
parts/components/uart_pty.h
parts/components/usbip.h
parts/components/VoltageSrc.h
parts/components/w25x20cl.h
parts/I2CPeripheral.h
Expand All @@ -106,6 +110,8 @@ set(H_FILES_base
parts/Printer.h
parts/printers/IPCPrinter.h
parts/printers/IPCPrinter_MMU2.h
parts/printers/Prusa_CW1.h
parts/printers/Prusa_CW1S.h
parts/printers/Prusa_MK1_13.h
parts/printers/Prusa_MK2_13.h
parts/printers/Prusa_MK25_13.h
Expand All @@ -125,6 +131,7 @@ set(H_FILES_base
parts/wiring/Einsy_1_0a.h
parts/wiring/Einsy_1_1a.h
parts/Wiring.h
parts/wiring/CW1S.h
parts/wiring/miniRAMBo_1_1b.h
parts/wiring/miniRAMBo_1_3a.h
parts/wiring/MM_Control_01.h
Expand Down Expand Up @@ -162,13 +169,23 @@ set(H_FILES_3rdParty

set(H_FILES ${H_FILES_base} ${H_FILES_3rdParty})

if (NOT APPLE)
set(NON_APPLE_SRC parts/components/usbip.c)
set_source_files_properties(parts/components/usbip.c PROPERTIES SKIP_PRECOMPILE_HEADERS ON)
else()
set(NON_APPLE_SRC)
endif()

set(MK404_SOURCES_base
${NON_APPLE_SRC}
parts/Board.cpp
parts/I2CPeripheral.cpp
parts/boards/CW1S.cpp
parts/boards/EinsyRambo.cpp
parts/boards/MiniRambo.cpp
parts/boards/MM_Control_01.cpp
parts/boards/Test_Board.cpp
parts/components/74HCT4052.cpp
parts/components/A4982.cpp
parts/components/ADC_Buttons.cpp
parts/components/Beeper.cpp
Expand All @@ -185,6 +202,7 @@ set(MK404_SOURCES_base
parts/components/IRSensor.cpp
parts/components/GLIndicator.cpp
parts/components/LED.cpp
parts/components/MCP23S17.cpp
parts/components/MMU1.cpp
parts/components/MMU2.cpp
parts/components/PAT9125.cpp
Expand All @@ -200,6 +218,7 @@ set(MK404_SOURCES_base
parts/components/w25x20cl.cpp
parts/printers/IPCPrinter.cpp
parts/printers/IPCPrinter_MMU2.cpp
parts/printers/Prusa_CW1S.cpp
parts/printers/Prusa_MK1_13.cpp
parts/printers/Prusa_MK2_13.cpp
parts/printers/Prusa_MK25_13.cpp
Expand Down Expand Up @@ -235,7 +254,6 @@ set(MK404_SOURCES_base
parts/KeyController.cpp
)


set(MK404_SOURCES_3rdparty
3rdParty/arcball/Camera.cpp
)
Expand Down Expand Up @@ -435,7 +453,14 @@ add_custom_command(TARGET MK404 POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${PROJECT_SOURCE_DIR}/assets/Firmware/stk500boot_v2_mega2560.hex"
"${PROJECT_BINARY_DIR}/stk500boot_v2_mega2560.hex")

add_custom_command(TARGET MK404 POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${PROJECT_SOURCE_DIR}/assets/Firmware/Prusa-CW1-Firmware-en-v3.1.0.hex"
"${PROJECT_BINARY_DIR}/Prusa-CW1-Firmware.hex")
add_custom_command(TARGET MK404 POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${PROJECT_SOURCE_DIR}/assets/Firmware/Prusa-CW1S-Firmware-en-v3.1.0.hex"
"${PROJECT_BINARY_DIR}/Prusa-CW1S-Firmware.hex")
# Copies the models/materials:

file(GLOB_RECURSE MODEL_FILES
Expand Down Expand Up @@ -512,6 +537,9 @@ add_test(ext1_MK2_Lite env ${TEST_EXPORT_PREFIX} ${TEST_XVFB_PREFIX} ./MK404 Pru
add_test(ext1_IPC env ${TEST_EXPORT_PREFIX} ${TEST_XVFB_PREFIX} ./MK404 IPCPrinter --script ../scripts/tests/test_boot_ipc.txt)
add_test(ext1_IPCMMU2 env ${TEST_EXPORT_PREFIX} ${TEST_XVFB_PREFIX} ./MK404 IPCPrinter_MMU2 -g lite --script ../scripts/tests/test_boot_ipcmmu2.txt )
add_test(ext1_MMU2 env ${TEST_EXPORT_PREFIX} ${TEST_XVFB_PREFIX} ./MK404 Prusa_MMU2 -f MM-control-01.hex --script ../scripts/tests/test_boot_mmu2.txt )
add_test(ext1_CW1 env ${TEST_EXPORT_PREFIX} ${TEST_XVFB_PREFIX} ./MK404 Prusa_CW1 -f Prusa-CW1-Firmware.hex --script ../scripts/tests/test_boot_cw1.txt )
add_test(ext1_CW1S env ${TEST_EXPORT_PREFIX} ${TEST_XVFB_PREFIX} ./MK404 Prusa_CW1S -f Prusa-CW1S-Firmware.hex --script ../scripts/tests/test_boot_cw1s.txt )



# TODO- move these images out of parts and to their own ext2 dir...
Expand Down Expand Up @@ -540,6 +568,8 @@ add_custom_target(MK3S.afx COMMAND cd ${PROJECT_SOURCE_DIR}


SET(PRINTERS
Prusa_CW1
Prusa_CW1S
Prusa_MK3
Prusa_MK3MMU2
Prusa_MK3S
Expand All @@ -549,6 +579,7 @@ SET(PRINTERS
Prusa_MK2MMU_mR13
Prusa_MK2_mR13
Prusa_MK1_mR13
Prusa_MMU2
)

add_subdirectory(${PROJECT_SOURCE_DIR}/SDCard)
Expand Down
6 changes: 5 additions & 1 deletion MK404.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,10 +422,14 @@ int main(int argc, char *argv[])
std::ifstream ifBL {argStrBoot.getValue()};
if (!argStrBoot.isSet() && ifBL.good())
{
if (argModel.getValue() != "Prusa_MMU2") {
if (argModel.getValue() != "Prusa_MMU2" && argModel.getValue() != "Prusa_CW1S" && argModel.getValue() != "Prusa_CW1" ) {
std::cout << "No bootloader specified, using default: " << argStrBoot.getValue() << '\n';
strBoot = argStrBoot.getValue();
} // MMU does not take a bootloader.
else
{
std::cout << "Model does not take standard bootloader. Skipping... \n";
}
}
else if (argStrBoot.getValue().empty())
{
Expand Down
Loading

0 comments on commit 029cc59

Please sign in to comment.