diff --git a/gen_configs.py b/gen_configs.py index cb87afd..cb654a2 100644 --- a/gen_configs.py +++ b/gen_configs.py @@ -1,7 +1,9 @@ +import math +import hashlib + import json from enum import IntEnum from typing import Optional, Tuple -import math class Shape(IntEnum): @@ -62,12 +64,17 @@ def __init__(self, nc, nr, cs=19, rs=19, switchHoleSize=13.97, self.mcu_footprint = mcu_footprint def update_name(self): - self.name = 'atreus_{}{}_{}'.format( + name = 'atreus_{}{}_{}'.format( 2 * (self.nCols * self.nRows + (len(self.thumbKeys) if self.thumbKeys else 0)), ('h' if self.shape == Shape.HULL else 'l') + ('s' if self.split else ''), 'cnc' if self.cnc else 'print') + name2 = str(self.hOffset) + \ + str(self.angle) + str(self.staggering) + m = hashlib.sha1() + m.update(name2.encode('utf-8')) + self.name = name + "_" + m.hexdigest()[:7] configs = [ @@ -90,7 +97,7 @@ def update_name(self): Config(6, 3, hOffset=50, angle=18.5, staggering=[8, 0, 5, 11, 6, 3, 2], thumbKeys=[(-1, -1), (0, -1), (-1, -2), (1, -1)]), - + Config(6, 4, angle=18.5, staggering=[0, 5, 11, 6, 3, 2]), @@ -98,6 +105,10 @@ def update_name(self): staggering=[0, 0, 5, 11, 6, 3, 2], thumbKeys=[(-1, 0), (1, -1)]), + Config(6, 4, hOffset=55, angle=15.0, + staggering=[-12, 0, 5, 11, 6, 3, 2], + thumbKeys=[(-1, 0), (-1, 1)]), + # # some bigger edge case :) Config(10, 10, angle=18.5, staggering=[0, 0, 5, 11, 6, 3, 2], diff --git a/keyboard.py b/keyboard.py index dcadca2..53dae31 100644 --- a/keyboard.py +++ b/keyboard.py @@ -391,7 +391,7 @@ def generate(config: Config, odir='output', switch_mesh=False): if len(sys.argv) > 1: fn = sys.argv[-1].split(':')[-1] else: - fn = 'configs/atreus_52l_print.json' + fn = 'configs/atreus_52l_print_5b320d0.json' with open(fn, 'r', encoding='utf-8') as f: def config(): return None