Parcourir la source

add case design by kauzerei, with some tweaks. scad render github actions workflow.

Thomas Buck il y a 10 mois
Parent
révision
1b7f4e8506
6 fichiers modifiés avec 282 ajouts et 51 suppressions
  1. 62
    48
      .github/workflows/cmake.yml
  2. 43
    0
      .github/workflows/scad.yml
  3. 1
    0
      .gitignore
  4. 1
    0
      README.md
  5. 122
    3
      case/case.scad
  6. 53
    0
      case/generate_stls.sh

+ 62
- 48
.github/workflows/cmake.yml Voir le fichier

@@ -1,6 +1,8 @@
1 1
 # https://github.com/raspberrypi/pico-examples/blob/master/.github/workflows/cmake.yml
2 2
 
3 3
 name: Firmware
4
+
5
+# build for each push and pull request
4 6
 on: [push, pull_request]
5 7
 
6 8
 env:
@@ -11,51 +13,63 @@ jobs:
11 13
     runs-on: ubuntu-latest
12 14
 
13 15
     steps:
14
-    - name: Install dependencies
15
-      run: sudo apt-get install -y cxxtest build-essential gcc-arm-none-eabi mtools
16
-
17
-    - name: Checkout repo
18
-      uses: actions/checkout@v3
19
-      with:
20
-        path: repo
21
-
22
-    - name: Checkout repo submodules
23
-      working-directory: ${{github.workspace}}/repo
24
-      run: git submodule update --init
25
-
26
-    - name: Checkout pico-sdk submodules
27
-      working-directory: ${{github.workspace}}/repo/pico-sdk
28
-      run: git submodule update --init
29
-
30
-    - name: Create Build Environment
31
-      working-directory: ${{github.workspace}}/repo
32
-      run:  cmake -E make_directory ${{github.workspace}}/repo/build
33
-
34
-    - name: Configure CMake
35
-      shell: bash
36
-      working-directory: ${{github.workspace}}/repo/build
37
-      run: cmake .. -DPICO_BOARD=pico_w -DCMAKE_BUILD_TYPE=$BUILD_TYPE
38
-
39
-    - name: Get core count
40
-      id: core_count
41
-      run : cat /proc/cpuinfo  | grep processor | wc -l
42
-
43
-    - name: Build
44
-      working-directory: ${{github.workspace}}/repo/build
45
-      shell: bash
46
-      # Execute the build.  You can specify a specific target with "--target <NAME>"
47
-      run: cmake --build . --config $BUILD_TYPE --parallel $(nproc)
48
-
49
-    - name: Upload a Build Artifact
50
-      uses: actions/upload-artifact@v4.0.0
51
-      with:
52
-        name: firmware.uf2
53
-        path: ${{github.workspace}}/repo/build/picowota_gadget.uf2
54
-        if-no-files-found: error
55
-
56
-    - name: Upload a Build Artifact
57
-      uses: actions/upload-artifact@v4.0.0
58
-      with:
59
-        name: update.elf
60
-        path: ${{github.workspace}}/repo/build/gadget.elf
61
-        if-no-files-found: error
16
+      - name: Install dependencies
17
+        run: sudo apt-get install -y cxxtest build-essential gcc-arm-none-eabi mtools zip
18
+
19
+      - name: Checkout repo
20
+        uses: actions/checkout@v4
21
+        with:
22
+          path: repo
23
+          fetch-depth: 0
24
+
25
+      - name: Checkout repo submodules
26
+        working-directory: ${{github.workspace}}/repo
27
+        run: git submodule update --init
28
+
29
+      - name: Checkout pico-sdk submodules
30
+        working-directory: ${{github.workspace}}/repo/pico-sdk
31
+        run: git submodule update --init
32
+
33
+      - name: Create Build Environment
34
+        working-directory: ${{github.workspace}}/repo
35
+        run:  cmake -E make_directory ${{github.workspace}}/repo/build
36
+
37
+      - name: Configure CMake
38
+        shell: bash
39
+        working-directory: ${{github.workspace}}/repo/build
40
+        run: cmake .. -DPICO_BOARD=pico_w -DCMAKE_BUILD_TYPE=$BUILD_TYPE
41
+
42
+      - name: Get core count
43
+        id: core_count
44
+        run : cat /proc/cpuinfo  | grep processor | wc -l
45
+
46
+      - name: Build
47
+        working-directory: ${{github.workspace}}/repo/build
48
+        shell: bash
49
+        run: cmake --build . --config $BUILD_TYPE --parallel $(nproc)
50
+
51
+      - name: Upload a Build Artifact
52
+        uses: actions/upload-artifact@v4.0.0
53
+        with:
54
+          name: firmware.uf2
55
+          path: ${{github.workspace}}/repo/build/picowota_gadget.uf2
56
+          if-no-files-found: error
57
+
58
+      - name: Upload a Build Artifact
59
+        uses: actions/upload-artifact@v4.0.0
60
+        with:
61
+          name: update.elf
62
+          path: ${{github.workspace}}/repo/build/gadget.elf
63
+          if-no-files-found: error
64
+
65
+      - name: Archive release files
66
+        if: startsWith(github.ref, 'refs/tags/')
67
+        run: |
68
+          cd ${{github.workspace}}/repo/build
69
+          zip -r picowota_gadget.uf2 gadget.elf firmware
70
+
71
+      - name: Upload release files
72
+        if: startsWith(github.ref, 'refs/tags/')
73
+        uses: softprops/action-gh-release@v1
74
+        with:
75
+          files: ${{github.workspace}}/repo/build/firmware.zip

+ 43
- 0
.github/workflows/scad.yml Voir le fichier

@@ -0,0 +1,43 @@
1
+name: STLs
2
+
3
+# build for each push and pull request
4
+on: [push, pull_request]
5
+
6
+jobs:
7
+  render:
8
+    runs-on: ubuntu-latest
9
+
10
+    steps:
11
+      - name: Checkout repo
12
+        uses: actions/checkout@v4
13
+        with:
14
+          fetch-depth: 0
15
+
16
+      - name: Checkout repo submodules
17
+        run: git submodule update --init
18
+
19
+      - name: Install dependencies
20
+        run: sudo apt-get install -y openscad zip
21
+
22
+      - name: Render STLs
23
+        run: |
24
+          ./case/generate_stls.sh
25
+
26
+      - name: Upload part files
27
+        uses: actions/upload-artifact@v4.0.0
28
+        with:
29
+          name: volcano-remote-stl
30
+          path: case/stl
31
+          if-no-files-found: error
32
+
33
+      - name: Archive release files
34
+        if: startsWith(github.ref, 'refs/tags/')
35
+        run: |
36
+          cd case
37
+          zip -r volcano-remote-stl stl
38
+
39
+      - name: Upload release files
40
+        if: startsWith(github.ref, 'refs/tags/')
41
+        uses: softprops/action-gh-release@v1
42
+        with:
43
+          files: case/volcano-remote-stl.zip

+ 1
- 0
.gitignore Voir le fichier

@@ -7,3 +7,4 @@ build_debug
7 7
 *.sl1
8 8
 *.wow
9 9
 .directory
10
+case/stl

+ 1
- 0
README.md Voir le fichier

@@ -131,6 +131,7 @@ I'm also using the MicroPython DHCP server, licensed as MIT and included with pi
131 131
 The case design is also licensed as GPLv3.
132 132
 It uses a [Pi Pico case model](https://www.printables.com/model/210898-raspberry-pi-pico-case) licensed as CC-BY-NC-SA.
133 133
 But this is only used for visualization purposes and doesn't influence the 3D model at all.
134
+The case design itself has initially been made by [Kauzerei](https://github.com/kauzerei/OpensCadaver/blob/main/models/pico_stuff.scad).
134 135
 
135 136
     This program is free software: you can redistribute it and/or modify
136 137
     it under the terms of the GNU General Public License as published by

+ 122
- 3
case/case.scad Voir le fichier

@@ -1,3 +1,24 @@
1
+/*
2
+ * case.scad
3
+ *
4
+ * https://github.com/kauzerei/OpensCadaver/blob/main/models/pico_stuff.scad
5
+ *
6
+ * Copyright (c) 2023 Kauzerei (openautolab@kauzerei.de)
7
+ * Copyright (c) 2023 Thomas Buck (thomas@xythobuz.de)
8
+ *
9
+ * This program is free software: you can redistribute it and/or modify
10
+ * it under the terms of the GNU General Public License as published by
11
+ * the Free Software Foundation, either version 3 of the License, or
12
+ * (at your option) any later version.
13
+ *
14
+ * This program is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
+ * GNU General Public License for more details.
18
+ *
19
+ * See <http://www.gnu.org/licenses/>.
20
+ */
21
+
1 22
 // https://www.waveshare.com/wiki/Pico-LCD-1.3
2 23
 lcd_w = 52.0;
3 24
 lcd_h = 26.5;
@@ -9,12 +30,30 @@ use <pico_case.scad>
9 30
 p_w = 21;
10 31
 p_h = 51;
11 32
 p_t = 1.0;
33
+p_usb_h = 2.8;
12 34
 
13
-pico_header_h = 2.0; // todo
35
+pico_header_h = 2.5; // todo
14 36
 lcd_header_h = 10.0; // todo
15 37
 
16 38
 header_h = pico_header_h + lcd_header_h;
17 39
 
40
+part="OPT_assembly"; //[bottom,top,button,print,OPT_assembly]
41
+wall=1.5;
42
+extra=4; //lip on the lid that presses top pcb down
43
+thread=3;
44
+air=0.5;
45
+bissl=1/100;
46
+button=4;
47
+joystick=6;
48
+height=16.8+air+extra;
49
+width=52.4+1.5+2*air;
50
+length=26.7+2*air;
51
+$fa=1/1;
52
+$fs=1/2;
53
+
54
+total_width = width+2*wall;
55
+total_len = length+4*wall+2*thread;
56
+
18 57
 module lcd() {
19 58
     color("blue")
20 59
     translate([-lcd_h / 2, -lcd_w / 2, 0])
@@ -24,10 +63,90 @@ module lcd() {
24 63
 module hw() {
25 64
     translate([0, 0, header_h])
26 65
     lcd();
27
-    
66
+
28 67
     translate([p_w / 2, -p_h / 2, 0])
29 68
     rotate([0, 180, 0])
30 69
     pico();
31 70
 }
32 71
 
33
-hw();
72
+module bottom() {
73
+  difference() {
74
+    cube([total_width, total_len, height + wall]);
75
+    translate([wall,2*wall+thread,wall])cube([width,length,height+bissl]);
76
+    for (tr=[[wall+thread/2,wall+thread/2,height/2+wall],
77
+             [wall+thread/2,length+3*wall+1.5*thread,height/2+wall],
78
+             [width+wall-thread/2,wall+thread/2,height/2+wall],
79
+             [width+wall-thread/2,length+3*wall+1.5*thread,height/2+wall]])
80
+      translate(tr) cylinder(h=height/2+bissl,d=thread);
81
+    translate([wall/2,2*wall+thread+length/2,3-bissl])cube([wall+bissl,8,6],center=true);
82
+    translate([0,2*wall+thread+length/2,wall+7])rotate([0,90,0])cylinder(d=button,h=2*wall+bissl,center=true);
83
+  }
84
+}
85
+
86
+module top() {
87
+  difference() {
88
+    cube([total_width, total_len, wall]);
89
+    for (tr=[[wall+thread/2,wall+thread/2,-bissl],
90
+             [wall+thread/2,length+3*wall+1.5*thread,-bissl],
91
+             [width+wall-thread/2,wall+thread/2,-bissl],
92
+             [width+wall-thread/2,length+3*wall+1.5*thread,-bissl]])
93
+      translate(tr) cylinder(h=wall+2*bissl,d=thread);
94
+    translate([wall+1.5,2*wall+thread,-bissl])
95
+      for (tr=[[47.7+air,5.5+0],
96
+               [47.7+air,5.5+5.7],
97
+               [47.7+air,5.5+2*5.7],
98
+               [47.7+air,5.5+3*5.7],
99
+               [6.7+0.5,13.8+air]])
100
+        translate(tr) cylinder(h=wall+2*bissl,d=button);
101
+    translate([wall+1.5+6.7+air,2*wall+thread+13.8+air,-bissl]) cylinder(h=wall+2*bissl,d=joystick);
102
+    translate([wall+13.5+1.5,2*wall+thread,-bissl])cube([31,27,wall+2*bissl]);
103
+  }
104
+  translate([wall+13.5+1.5-2,2*wall+thread,-extra])cube([2,27,extra]);
105
+  translate([wall+13.5+1.5+31,2*wall+thread,-extra])cube([2,27,extra]);
106
+}
107
+
108
+module button() {
109
+  cylinder(h=1,d=5);
110
+  cylinder(h=5,d=3);
111
+}
112
+
113
+module bottom_assm() {
114
+    %translate([0, 0, wall + p_t + p_usb_h])
115
+    rotate([0, 0, 90])
116
+    hw();
117
+
118
+    translate([-total_width / 2, -total_len / 2, 0])
119
+    bottom();
120
+}
121
+
122
+if (part == "bottom") {
123
+    bottom_assm();
124
+} else if (part == "top") {
125
+    rotate([180, 0, 0])
126
+    top();
127
+} else if (part == "button") {
128
+    button();
129
+} else if (part == "print"){
130
+    translate([0, 10, 0])
131
+    bottom();
132
+
133
+    translate([0, -10, wall])
134
+    rotate([180, 0, 0])
135
+    top();
136
+
137
+    for (i = [1 : 4])
138
+    translate([-10, -25 + i * 10, 0])
139
+    button();
140
+} else {
141
+    difference() {
142
+        union() {
143
+            bottom_assm();
144
+
145
+            translate([-total_width / 2, -total_len / 2, height + wall])
146
+            top();
147
+        }
148
+
149
+        translate([-total_width / 2 - 1, 0, -2])
150
+        cube([total_width + 2, total_len / 2 + 2, height + wall + 4]);
151
+    }
152
+}

+ 53
- 0
case/generate_stls.sh Voir le fichier

@@ -0,0 +1,53 @@
1
+#!/bin/bash
2
+
3
+# ----------------------------------------------------------------------------
4
+# Copyright (c) 2023 Kauzerei (openautolab@kauzerei.de)
5
+# Copyright (c) 2023 Thomas Buck (thomas@xythobuz.de)
6
+#
7
+# This program is free software: you can redistribute it and/or modify
8
+# it under the terms of the GNU General Public License as published by
9
+# the Free Software Foundation, either version 3 of the License, or
10
+# (at your option) any later version.
11
+#
12
+# This program is distributed in the hope that it will be useful,
13
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+# GNU General Public License for more details.
16
+#
17
+# See <http://www.gnu.org/licenses/>.
18
+# ----------------------------------------------------------------------------
19
+
20
+# space separated list of scad files (without extension)
21
+MODULES="case"
22
+OUTDIR="stl"
23
+
24
+# enter directory of script (case)
25
+cd "$(dirname "$0")"
26
+
27
+# Detect OS
28
+if [[ "$OSTYPE" == "darwin"* ]]; then
29
+    echo "Mac OS X detected"
30
+    SCAD="open -n -a OpenSCAD --args"
31
+else
32
+    echo "Linux detected"
33
+    SCAD="openscad"
34
+fi
35
+
36
+echo "deleting previous build output"
37
+rm -rf $OUTDIR
38
+mkdir -p $OUTDIR
39
+
40
+for MODULE in $MODULES
41
+do
42
+    PARTS=$(grep -o "part.*//.*\[.*]" ${MODULE}.scad | sed 's/,/ /g' | sed 's/.*\[\([^]]*\)\].*/\1/g')
43
+    echo "generating from ${MODULE}"
44
+
45
+    for PART in ${PARTS}
46
+    do
47
+        if [[ "${PART}" != "OPT_"* ]]; then
48
+            echo ${PART}
49
+            FILENAME=$(echo $OUTDIR/${MODULE}_${PART}.stl | tr '[:upper:]' '[:lower:]')
50
+            $SCAD $(pwd)/${MODULE}.scad --D part=\"${PART}\" --o $(pwd)/${FILENAME}
51
+        fi
52
+    done
53
+done

Chargement…
Annuler
Enregistrer