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

Develop into beta #128

Merged
merged 27 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
0a19597
flashing via usb fixed to not say CAN Flash Success (#90)
krautech Nov 21, 2024
96bdbc5
chore: rewrote lambda as def (#83)
krautech Nov 22, 2024
96c5bc8
Chore: removed random useless code (#80)
krautech Nov 22, 2024
497d030
Make MOVE argument configurable (#92)
Jomik Nov 22, 2024
a626619
chore: create macro to help us test (#97)
Jomik Nov 22, 2024
a99fe5d
feat: add 5.1.0 firmware (k1 missing) (#91)
krautech Nov 22, 2024
02e3131
feat: add k1 USB 5.1.0 firmware (#100)
krautech Nov 22, 2024
46e3740
fix: z offset bug (#102)
krautech Nov 22, 2024
cdd1cce
Merge branch 'beta' into develop
Jomik Nov 22, 2024
1dd2aed
Removed CARTOGRAPHER_THRESHOLD_TEST (#82)
krautech Nov 23, 2024
c59613d
Remove PROBE_CALIBRATE and associated helper function (#81)
krautech Nov 23, 2024
801e350
Added error message when error during calibration (#84)
krautech Nov 23, 2024
61225b9
Add types for config, printer and reactor (#94)
Jomik Nov 23, 2024
36ce5dc
Add 5.1.0 HT firmware (#107)
krautech Nov 24, 2024
097884c
fix/change max_retries float to int (#108)
krautech Nov 24, 2024
24ab8f2
feat: add types for gcode and gcode command (#106)
Jomik Nov 25, 2024
3b23abe
fix: fixes 5.1.0 HT firmware (#111)
krautech Nov 26, 2024
2135ccf
remove duplicate line (#116)
krautech Nov 26, 2024
bf55bf0
fix: pin python version to 3.9 (#118)
Jomik Nov 26, 2024
f351c25
removes graph generation and imports (#124)
krautech Nov 27, 2024
179d9a5
fix: tolerance is not a tuple (#125)
Jomik Nov 27, 2024
9b02325
change max_temp to wait_temp (#117)
krautech Nov 27, 2024
c1d8327
Chore: Removed unused ADXL functions and variables (#114)
krautech Nov 27, 2024
d2d5739
Check firmware version before homing (#112)
Jomik Nov 27, 2024
5bcef1a
Feature: pass params from calibrate to touch (#120)
krautech Nov 28, 2024
1dc411d
feat: setup ci to check k1 environment (#123)
Jomik Nov 28, 2024
8753a91
Merge branch 'develop' into develop-into-beta
Jomik Nov 28, 2024
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
19 changes: 16 additions & 3 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,30 @@ permissions:

jobs:
checks:
name: ${{ matrix.name }} Checks
strategy:
fail-fast: false
matrix:
include:
- name: Standard
requirements: ./ci/standard-requirements.txt
python-version: 3.9
- name: K1
requirements: ./ci/k1-requirements.txt
python-version: 3.8
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set Up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
python-version: ${{ matrix.python-version }}
cache: "pip"
- run: pip install -r requirements.txt
- run: pip install cython wheel
- run: pip install -r ${{ matrix.requirements }}
- name: Linting
uses: astral-sh/ruff-action@v1
continue-on-error: true # let's remove this once ruff has been implemented in scanner.py
- name: Type check
run: pip install basedpyright && basedpyright
run: |
pip install basedpyright && basedpyright
6 changes: 6 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,9 @@ Inside [./typings] is a file named after the module with some dummy classes.
These are the modules that our code will be checked against when pyright is executed.
We can improve our confidence by ensuring these are well defined and up to date with the actual code.
The files that we import with `from . import probe` are reexported in [./__init__.py] to allow pyright to infer this.

## Testing changes

A convenience macro, [./cartographer_ci_test.cfg], has been made to help us test changes.
This can be linked into your `printer_data/configs` and included in `printer.cfg` for ease of use.
We should strive to keep this up to date.
36 changes: 36 additions & 0 deletions cartographer_ci_test.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[respond]

[gcode_macro CARTOGRAPHER_CI_TEST]
variable_stages = ["G28", "PROBE", "PROBE_ACCURACY", "BED_MESH_CALIBRATE", "CARTOGRAPHER_CALIBRATE METHOD=manual", "CARTOGRAPHER_THRESHOLD_SCAN", "CARTOGRAPHER_CALIBRATE", "CARTOGRAPHER_TOUCH"]
variable_stage_index = 0
gcode:
{% set stage_count = stages | length %}
{action_respond_info("Executing %s" % (stages[stage_index]))}
{stages[stage_index]}
M400
G28 Z
{% set next_index = stage_index + 1 %}
RESPOND TYPE=command MSG='{"action:prompt_begin Cartographer CI Tests [%d / %d]" % (next_index, stage_count)}'
{% if next_index < stage_count %}
RESPOND TYPE=command MSG='{"action:prompt_text Next test is %s" % (stages[next_index])}'
RESPOND TYPE=command MSG="action:prompt_footer_button ABORT|_CARTOGRAPHER_CI_TEST_ABORT|error"
RESPOND TYPE=command MSG="action:prompt_footer_button Continue|_CARTOGRAPHER_CI_TEST_CONTINUE|primary"
{% else %}
RESPOND TYPE=command MSG="action:prompt_text All tests completed!!"
SET_GCODE_VARIABLE MACRO=CARTOGRAPHER_CI_TEST VARIABLE=stage_index VALUE=0
{% endif %}
RESPOND TYPE=command MSG="action:prompt_show"

[gcode_macro _CARTOGRAPHER_CI_TEST_CONTINUE]
gcode:
RESPOND TYPE=command MSG="action:prompt_end"
{% set vars = printer["gcode_macro CARTOGRAPHER_CI_TEST"]%}
SET_GCODE_VARIABLE MACRO=CARTOGRAPHER_CI_TEST VARIABLE=stage_index VALUE={vars.stage_index + 1}
CARTOGRAPHER_CI_TEST

[gcode_macro _CARTOGRAPHER_CI_TEST_ABORT]
gcode:
RESPOND TYPE=command MSG="action:prompt_end"
SET_GCODE_VARIABLE MACRO=CARTOGRAPHER_CI_TEST VARIABLE=stage_index VALUE=0
{action_respond_info("Cartographer CI tests aborted.")}

11 changes: 11 additions & 0 deletions ci/k1-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
greenlet==0.4.15
Jinja2==2.11.3
kiwisolver==1.1.0
MarkupSafe==1.1.1
matplotlib==2.2.3
numpy==1.16.4
Pillow==7.0.0
pyparsing==2.4.2
pyserial==3.4
python-dateutil==2.8.1
numpy-stubs@git+https://github.com/numpy/numpy-stubs.git
13 changes: 13 additions & 0 deletions ci/standard-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
greenlet==2.0.2
importlib_resources==6.4.5
Jinja2==2.11.3
kiwisolver==1.4.7
MarkupSafe==1.1.1
matplotlib==3.9.2
numpy==1.23.4
pillow==11.0.0
pyparsing==3.2.0
pyserial==3.4
python-can==3.3.4
python-dateutil==2.9.0.post0
scipy==1.13.1
118 changes: 89 additions & 29 deletions firmware.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
#!/bin/bash

SCRIPT_VERSION="v1.2.0"
SCRIPT_VERSION="v1.2.1"

while getopts s:t:f:b: flag; do
while getopts s:t:f:b:ht flag; do
case "${flag}" in
s) switch=${OPTARG} ;;
t) ftype=${OPTARG} ;;
f) flash=${OPTARG} ;;
b) branch=${OPTARG} ;;
s) switch=${OPTARG} ;; # Argument for -s
t) ftype=${OPTARG} ;; # Argument for -t
f) flash=${OPTARG} ;; # Argument for -f
b) branch=${OPTARG} ;; # Argument for -b
h) hightemp=true ;; # Set hightemp to true if -h flag is present
t) # Handle 't' as required, though there may be a conflict with `ht` as written
;;
*)
echo "Invalid option: -$flag" >&2
exit 1
;;
esac
done
# Define repository URLs
Expand Down Expand Up @@ -85,7 +92,9 @@ ${NC}"
printf "${RED}Firmware Script ${NC} ${SCRIPT_VERSION}\n"
printf "Created by ${GREEN}KrauTech${NC} ${BLUE}(https://github.com/krautech)${NC}\n"
echo
echo
if [[ $hightemp ]]; then
printf "${BLUE}Flashing High Temp Firmware${NC}\n"
fi
printf "${RED}###################################################################################${NC}\n"
#echo $switch
#echo $ftype
Expand Down Expand Up @@ -634,12 +643,25 @@ flashFirmware() {
for folder in "${folders[@]}"; do
if [[ -d "$folder" ]]; then
folder_name=$(basename "$folder")
# List the files inside each folder using the same search pattern
for file in "$folder"/$search_pattern; do
if [[ -f "$file" ]]; then
options+=("${folder_name}/$(basename "$file")")

# Check if $hightemp is true
if [[ $hightemp ]]; then
# Process only if "HT" subdirectory exists
if [[ -d "$folder/HT" ]]; then
for file in "$folder"/$search_pattern; do
if [[ -f "$file" ]]; then
options+=("${folder_name}/HT/$(basename "$file")")
fi
done
fi
done
else
# Process all folders regardless of "HT" subdirectory
for file in "$folder"/$search_pattern; do
if [[ -f "$file" ]]; then
options+=("${folder_name}/$(basename "$file")")
fi
done
fi
fi
done
fi
Expand Down Expand Up @@ -722,12 +744,25 @@ flashFirmware() {
for folder in "${folders[@]}"; do
if [[ -d "$folder" ]]; then
folder_name=$(basename "$folder")
# List the files inside each folder using the same search pattern
for file in "$folder"/$search_pattern; do
if [[ -f "$file" ]]; then
options+=("${folder_name}/$(basename "$file")")

# Check if $hightemp is true
if [[ $hightemp ]]; then
# Process only if "HT" subdirectory exists
if [[ -d "$folder/HT" ]]; then
for file in "$folder"/$search_pattern; do
if [[ -f "$file" ]]; then
options+=("${folder_name}/HT/$(basename "$file")")
fi
done
fi
done
else
# Process all folders regardless of "HT" subdirectory
for file in "$folder"/$search_pattern; do
if [[ -f "$file" ]]; then
options+=("${folder_name}/$(basename "$file")")
fi
done
fi
fi
done
fi
Expand Down Expand Up @@ -764,18 +799,30 @@ flashFirmware() {
archive_dir="$CARTOGRAPHER_KLIPPER_DIR/firmware/v2-v3/combined-firmware" # Corrected path
if [[ -d $archive_dir ]]; then
# Get the folder names sorted from largest to smallest version
cd $archive_dir
folders=($(ls -d "$archive_dir"/*/ | sort -rV))

for folder in "${folders[@]}"; do
if [[ -d "$folder" ]]; then
folder_name=$(basename "$folder")
# List the files inside each folder using the same search pattern
for file in "$folder"/$search_pattern; do
if [[ -f "$file" ]]; then
options+=("${folder_name}/$(basename "$file")")

# Check if $hightemp is true
if [[ $hightemp ]]; then
# Process only if "HT" subdirectory exists
if [[ -d "$folder/HT" ]]; then
for file in "$folder"/$search_pattern; do
if [[ -f "$file" ]]; then
options+=("${folder_name}/HT/$(basename "$file")")
fi
done
fi
done
else
# Process all folders regardless of "HT" subdirectory
for file in "$folder"/$search_pattern; do
if [[ -f "$file" ]]; then
options+=("${folder_name}/$(basename "$file")")
fi
done
fi
fi
done
fi
Expand Down Expand Up @@ -855,12 +902,25 @@ flashFirmware() {
for folder in "${folders[@]}"; do
if [[ -d "$folder" ]]; then
folder_name=$(basename "$folder")
# List the files inside each folder using the same search pattern
for file in "$folder"/$search_pattern; do
if [[ -f "$file" ]]; then
options+=("${folder_name}/$(basename "$file")")

# Check if $hightemp is true
if [[ $hightemp ]]; then
# Process only if "HT" subdirectory exists
if [[ -d "$folder/HT" ]]; then
for file in "$folder"/$search_pattern; do
if [[ -f "$file" ]]; then
options+=("${folder_name}/HT/$(basename "$file")")
fi
done
fi
done
else
# Process all folders regardless of "HT" subdirectory
for file in "$folder"/$search_pattern; do
if [[ -f "$file" ]]; then
options+=("${folder_name}/$(basename "$file")")
fi
done
fi
fi
done
fi
Expand Down Expand Up @@ -968,7 +1028,7 @@ flashing() {
if [[ $usbID != "" ]] && [[ $3 == "usb" ]] && [[ $flashed == 0 ]]; then
echo "Flashing USB Device $usbID"
# FLash USB Firmware
~/klippy-env/bin/python ~/klipper/lib/canboot/flash_can.py -f $firmwareFile -d /dev/serial/by-id/$usbID
python3 ~/katapult/scripts/flash_can.py -f $firmwareFile -d /dev/serial/by-id/$usbID
read -p "Press enter to continue"
display_flashed $cartoID "usb" $survey
flashed=1
Expand Down
Binary file not shown.
Binary file not shown.
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[tool.pyright]
pythonVersion = "3.8"
include = ["scanner.py"]
reportMissingModuleSource = false # klippy imports are always missing sources
reportPrivateLocalImportUsage = false
Expand All @@ -8,4 +9,5 @@ reportUninitializedInstanceVariable = false
failOnWarnings = false

[tool.ruff]
target-version = "py38"
include = ["scanner.py"]
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# klipper python virtual environment requirements for Cartographer
numpy>=1.16.6
scipy>=1.10.0
matplotlib>=3.7.0
numpy~=1.16
scipy~=1.10
matplotlib~=3.7
Loading