瀏覽代碼

Format stops added

HonestLocksmith 1 年之前
父節點
當前提交
13f98fd590
共有 3 個文件被更改,包括 49 次插入31 次删除
  1. 9 3
      key_copier.c
  2. 21 10
      key_formats.c
  3. 19 18
      key_formats.h

+ 9 - 3
key_copier.c

@@ -537,9 +537,15 @@ static void key_copier_view_measure_draw_callback(Canvas *canvas, void *model) {
   canvas_draw_line(canvas, level_contour_px, 62, level_contour_px + elbow_px,
                    62 - elbow_px);
 
-  canvas_draw_line(
-      canvas, level_contour_px, 20, level_contour_px,
-      63); // change to if stop ==tip and measure from this point back.
+  if (my_format.stop == 2) {
+    // Draw a line using level_contour_px if stop equals tip
+    canvas_draw_line(
+        canvas, level_contour_px, top_contour_px, level_contour_px,
+        63); // change to if stop ==tip and measure from this point back.
+  } else {
+    // Otherwise, draw a default line
+    canvas_draw_line(canvas, 1, top_contour_px, 1, 63);
+  }
 
   int slc_pin_px =
       (int)round((my_format.first_pin_inch +

+ 21 - 10
key_formats.c

@@ -30,7 +30,8 @@ const KeyFormat all_formats[] = {
      .pin_num = 6,
      .pin_width_inch = 0.031,
      .elbow_inch = 0.1,
-     .drill_angle = 90, // This should actually be 100 but the current resolution will make
+     .drill_angle =
+         90, // This should actually be 100 but the current resolution will make
      // 100 degrees very ugly and unsuable
      .uncut_depth_inch = 0.335,
      .deepest_depth_inch = 0.2,
@@ -49,7 +50,8 @@ const KeyFormat all_formats[] = {
      .pin_num = 6,
      .pin_width_inch = 0.060,
      .elbow_inch = 0.1,
-     .drill_angle = 90, // This should actually be 100 but the current resolution will
+     .drill_angle =
+         90, // This should actually be 100 but the current resolution will
      // make 100 degrees very ugly and unsuable
      .uncut_depth_inch = 0.312,
      .deepest_depth_inch = 0.186,
@@ -68,7 +70,8 @@ const KeyFormat all_formats[] = {
      .pin_num = 5,
      .pin_width_inch = 0.039,
      .elbow_inch = 0.1,
-     .drill_angle = 90, // This should actually be 100 but the current resolution will make
+     .drill_angle =
+         90, // This should actually be 100 but the current resolution will make
      // 100 degrees very ugly and unsuable
      .uncut_depth_inch = 0.276,
      .deepest_depth_inch = 0.171,
@@ -87,7 +90,8 @@ const KeyFormat all_formats[] = {
      .pin_num = 6,
      .pin_width_inch = 0.039,
      .elbow_inch = 0.1,
-     .drill_angle = 90, // This should actually be 100 but the current resolution will make
+     .drill_angle =
+         90, // This should actually be 100 but the current resolution will make
      // 100 degrees very ugly and unsuable
      .uncut_depth_inch = 0.283,
      .deepest_depth_inch = 0.173,
@@ -106,7 +110,8 @@ const KeyFormat all_formats[] = {
      .pin_num = 6,
      .pin_width_inch = 0.054,
      .elbow_inch = 0.1,
-     .drill_angle = 90, // This should actually be 100 but the current resolution will make
+     .drill_angle =
+         90, // This should actually be 100 but the current resolution will make
      // 100 degrees very ugly and unsuable
      .uncut_depth_inch = 0.320,
      .deepest_depth_inch = 0.145,
@@ -125,7 +130,8 @@ const KeyFormat all_formats[] = {
      .pin_num = 5,
      .pin_width_inch = 0.039,
      .elbow_inch = 0.1,
-     .drill_angle = 90, // This should actually be 100 but the current resolution will make
+     .drill_angle =
+         90, // This should actually be 100 but the current resolution will make
      // 100 degrees very ugly and unsuable
      .uncut_depth_inch = 0.246,
      .deepest_depth_inch = 0.167,
@@ -144,7 +150,8 @@ const KeyFormat all_formats[] = {
      .pin_num = 6,
      .pin_width_inch = 0.063,
      .elbow_inch = 0.1,
-     .drill_angle = 90, // This should actually be 100 but the current resolution will make
+     .drill_angle =
+         90, // This should actually be 100 but the current resolution will make
      // 100 degrees very ugly and unsuable
      .uncut_depth_inch = 0.328, // double check
      .deepest_depth_inch = 0.148,
@@ -163,7 +170,8 @@ const KeyFormat all_formats[] = {
      .pin_num = 5,
      .pin_width_inch = 0.039,
      .elbow_inch = 0.1,
-     .drill_angle = 90, // This should actually be 100 but the current resolution will make
+     .drill_angle =
+         90, // This should actually be 100 but the current resolution will make
      // 100 degrees very ugly and unsuable
      .uncut_depth_inch = 0.304,
      .deepest_depth_inch = 0.191,
@@ -182,7 +190,8 @@ const KeyFormat all_formats[] = {
      .pin_num = 6,
      .pin_width_inch = 0.047,
      .elbow_inch = 0.1,
-     .drill_angle = 90, // This should actually be 100 but the current resolution will make
+     .drill_angle =
+         90, // This should actually be 100 but the current resolution will make
      // 100 degrees very ugly and unsuable
      .uncut_depth_inch = 0.343,
      .deepest_depth_inch = 0.217,
@@ -231,6 +240,7 @@ const KeyFormat all_formats[] = {
     {.manufacturer = "Ford",
      .format_name = "H75",
      .sides = 2,
+     .stop = 2,
      .format_link = "https://lsamichigan.org/Tech/SCHLAGE_KeySpecs.pdf",
      .first_pin_inch = 0.201,
      .last_pin_inch = 0.845,
@@ -239,7 +249,8 @@ const KeyFormat all_formats[] = {
      .pin_width_inch = 0.039,
      .elbow_inch = 0.201, // this should be equal to first pin inch for tip
      // stopped key line
-     .drill_angle = 90, // This should actually be 100 but the current resolution will make
+     .drill_angle =
+         90, // This should actually be 100 but the current resolution will make
      // 100 degrees very ugly and unsuable
      .uncut_depth_inch = 0.354,
      .deepest_depth_inch = 0.254,

+ 19 - 18
key_formats.h

@@ -4,26 +4,27 @@
 #define FORMAT_NUM 13
 
 typedef struct {
-    char* manufacturer;
-    char* format_name;
-    char* format_link;
-    int sides;
-    double first_pin_inch;
-    double last_pin_inch;
-    double pin_increment_inch;
-    int pin_num;
-    double pin_width_inch;
-    double drill_angle;
-    double elbow_inch;
+  char *manufacturer;
+  char *format_name;
+  char *format_link;
+  int sides;
+  int stop;
+  double first_pin_inch;
+  double last_pin_inch;
+  double pin_increment_inch;
+  int pin_num;
+  double pin_width_inch;
+  double drill_angle;
+  double elbow_inch;
 
-    double uncut_depth_inch;
-    double deepest_depth_inch;
-    double depth_step_inch;
-    int min_depth_ind;
-    int max_depth_ind;
+  double uncut_depth_inch;
+  double deepest_depth_inch;
+  double depth_step_inch;
+  int min_depth_ind;
+  int max_depth_ind;
 
-    int macs;
-    int clearance;
+  int macs;
+  int clearance;
 } KeyFormat;
 
 extern const KeyFormat all_formats[FORMAT_NUM];