---
# System prepended metadata

title: TODO

---

TODO
====
- Jonatan
    - [x] Få Yocto op at køre
    - [x] Teste ny skærmdriver
    - [ ] Gøre kassen færdig
    - [ ] Lav vinkelmodel
    - [ ] Gøre frontpladen større, tilføje solderpads (thermisk isoleret)

Frontplate:
- [ ] ADD: COPY/DUPLICATE/CLIPBOARD/CLONE
- [ ] ADD: MAP/LEARN

HARDWARE CHECKLIST
==================


feature/rewrite
---------------
 - [x] Build skia in yocto
 - [x] Port skia test to yocto
 - [x] Finish recipes and commit otto-bsp/otto-meta repos
 - [x] Update to GCC 10.2 to solve this bug: https://godbolt.org/z/qeTM6P
     - [x] Wait till poky merges gcc 10.2 to master: https://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/recipes-devtools/gcc?h=master
 - [ ] Services
     - [x] Runtime
     - [x] LogicThread
     - [x] Graphics
         - [ ] Fonts
         - [x] Clear screen/ remove terminal?
         - [x] FBCP on yocto?
            - [x] Use https://github.com/juj/fbcp-ili9341 instead
     - [x] Config
         - [x] Design?
             - Let other (services) register config options
         - [x] Use something other than json for files?
             - [x] TOML: [toml11](https://github.com/ToruNiina/toml11)
         - [x] Comments & writing the config file?
             - toml11 supports comments, so we could have a `WithComment<int>` 
               wrapper type to add descriptive comments, which would automatically 
               be added to the config file. Then we would also write the config file
               on close, (or possibly on post-initialization.)
     - [x] Controller
         - [x] Implement MCU communicator
         - [x] Implement/test i2c controller
         - [x] LEDs
         - [ ] Implement/test usb/midi controller 
         - [ ] MIDI communication over i2c (@jmidt)
     - [ ] Audio
     - [ ] StateManager
     - [ ] Presets
 - [x] Registry
     - [x] llvm-style generic registry class
         - [x] Allows easy setup of `REGISTER_X` macros
         - [x] Per-type

Hardware Design
---------------
2-3 mm from underside of frontplate to AUX board
2.8 mm from underside of frontplate to upper edge of screw. This gives a distance of 2.8+(3/2) = 4.3 mm from frontplate/top of the box to the center of the screw.
screw length: 6mm.
Cutout for this should be 6 mm wide?
Lengths from left AUX-board edge to fasteners: 
 - Back:
     - 33.62 mm
     - 97.04 mm
     - 192.49 mm (short)
     - 272.67 mm (short)
 - Front:
     - 18.02 mm (short)
     - 90.02 mm (short)
     - 198.52 mm (short)
     - 270.52 mm (short)

Size difference of frontplate to other boards:
 - Left/right: 291.5-288.5 = 3 mm
 - Front/Back: 98.4-95 = 3.4 mm

From board to inner edge of box:
- Front: 5 mm (Main reason is the power plug sticking out)
- Sides: 2 mm

Final size of frontplate: 294.55 mm -by- 102.03 mm. Subtract 2 mm from these to get inner dimensions of box

Height calculations:
- from inside to bottom of bottom of mainboard: at least 12 mm, since ethernet is 11mm. For some room, we choose 13 mm. With a sheet thickness of 1 mm, the length of the PEMs will be 14 mm.
- Mainboard thiccness: 1.6mm
- space from main- to aux-board: 6 mm
- mainboard thiccness: 1.6mm
- From aux-board to frontplate: 2.5-3 mm
    - This gives 24.7-25.2 mm as inside height of the box. We choose 25 mm as it is inbetween and nice and round.
    - This gives 2.8 mm from aux-board to frontplate

Slots for fastening frontplate:
 - M3 screws are used, Let's do 3.2 mm holes.
 - 2.2 mm from bottom of right angle to edge of hole in right angle.
     - This gives 2.7+0.8 = 3.5 mm from top of box to middle of hole.

 - [ ] Front plate
     - [x] Make fastener 3D models
     - [x] Make fastener footprints
     - [x] Add screw terminals
     - [x] Make bigger, to fit case
     - [x] Make small rounded edges
     - [ ] OTTO logo and final touches?
 - [x] AUX Board
     - [x] Make space for screws / terminals (1-by-8 mm)
         -  Needs to not cover anything vital for 12 mm at the back, (12-clearance) mm on front. Clearance is probably ~5 mm?)
         - [x] Back: Power/USB-B, USB-A, right of screen. Made big cutouts in back, none needed on other sides  
     - [x] Rotate LEDs
         - [x] check that this is actually done
             - Markings are in the same corner as on the real hardware (pin 3)
 - [ ] Case
     - [x] PEMs
     - [x] Cutouts
         - [x] Find correct size of minijack plugs for cutouts
     - [x] Determine proper size of PEMs
     - [ ] Screw holes for terminals
     - [x] Determine proper size, to allow assembly

Hardware Production
-------------------
 - [ ] Order 30 boxes
 - [ ] Make exhaustive list of parts/components needed/had
     - [ ] Include prices
 - [ ] Target: Sell 20 BETAs in 2020.

Other stuff
-----------
- Innobooster deadline 15 Nov
  - [ ] Deadline 1 Nov: First draft
    - https://www.techfunding.eu/innobooster/7251

```cpp
 struct Widget {
    Widget(Anchor f) : func_anchor(f) {};

    void draw(SkCanvas& ctx, int x, int y, int size_x, int size_y) {
      ctx.save();
      // Translate func_anchor to draw_anchor
      std::array<int, 2> dv = diff_vec(draw_anchor, func_anchor, size_x, size_y);
      ctx.translate(dv[0], dv[1]);
      // Translate from origin to draw_anchor
      ctx.translate(x, y);
      draw_func(ctx, size_x, size_y);
      ctx.restore();
    }
    void setAnchor(Anchor a) {
      draw_anchor = a;
    }

    Anchor draw_anchor;
    Anchor func_anchor;
  protected:
    virtual void do_draw(SkCanvas& ctx) = 0;
  }

  env = graphics::ADSREnvelope;

  struct ADSREnvelope : Widget {
    ADSREnvelope() : Widget(Anchor::NorthWest) {};

    float a = 0, d = 0, s = 0, r = 0;
    
    void set_adsr(float a, float d);;
  protected:
    void do_draw(SkCanvas& ctx) final {
      
    }
  };
  
  struct FuncWidget : Widget {
      FuncWidget(std::function<void(SkCanvas&)> func) : func_(func) {}
      
  protected:
    void do_draw(SkCanvas& ctx) override {
        func_(ctx);
    }
  private:
    std::function<void(SkCanvas&)> func_;
  };
  
  template<typename Derived>
  struct Widget {
  
      void draw(SkCanvas& ctx)
      {
          // translate etc
          ctx.save();
          static_cast<Derived*>(this)->do_draw(ctx, FWD(args)...);
          ctx.restore();
          // restore etc
      }
      Box bounding_box;
  };
  
  struct Env : Widget<Derived> {
      float a, d, s, r;
      void do_draw(SkCanvas& ctx) {
          ctx.translate(bounding_box.get_point(Anchors::center));
          ctx.draw_an_envelope();
      }
  };
  
  struct Anchor {
      float x, float y;
  };
  struct Anchors {
      static constexpr Anchor top_left = {0,0};
      static constexpr Anchor bottom_right = {1,1};
  };
  
  struct Box {
      Box();
      void bottom_right(Point p, Anchor a = Anchors::top_left) {
          top_left_ = 
      }
      
      void size(Size p, Anchor a) {
          top_left_ = 
      }
  private:
    Point top_left_;
    Size s;
  }
  
  struct Box {
      Box(Point, Size);
      Box(Point, SkPoint);
      
      void move_to(Point p, Anchor a);
      
      void resize(Size p, Anchor a) {
          top_left_ = 
      }
    private:
        Anchor _a;
        Point top_left_;
        Size s;
  }
  
  Output<float> anim;
  
  Env env;
  env.bounding_box.top_left({120, 30});
  env.bounding_box.bottom_right({120, 30})
  env.bounding_box.size({20,20});
  env.draw(ctx, 5.f);
  env.bounding_box = Box(TopLeft({3, 2}, Size(120,60 * anim));
  env.draw(ctx, 5.f);
  
  
  
  // in draw()
  struct Screen {
      
    void draw(SkCanvas& ctx) {
       AdsrEnvelope adsr;
  	  adsr.size = {14, 24};
  	  adsr.position = {whuptiod}
  	  adsr.anchor = Anchor::center;
  	  adsr.a = 3;
  
      adsr.draw(ctx);
  }
  
  };
  
  
  
  FuncWidget widget = [] (SkCanvas& ctx) {
  
  }
  
  
  ```