Add indicators info module

This commit is contained in:
redfast00 2022-02-03 07:02:23 +01:00
parent 97db983ef0
commit ed05ea75c4
No known key found for this signature in database
GPG key ID: 5946E0E34FD0553C
6 changed files with 251 additions and 0 deletions

View file

@ -0,0 +1 @@
drawing.svg

View file

@ -0,0 +1 @@
*.stl

View file

@ -0,0 +1,66 @@
front_panel_thickness=2;
cut=200;
container_wall_thickness=1;
$fn=50;
front_panel_height=100;
front_panel_width=50;
module ccube(size = [1,1,1], center = false)
{
sz = (len(size) == 3)?size:[size,size,size];
if (len(center) == 1)
cube(size, center);
else
translate([center[0]?-sz[0]/2:0,center[1]?-sz[1]/2:0,center[2]?-sz[2]/2:0])
cube(size);
}
module front_panel() {
difference() {
union() {
ccube([front_panel_height, front_panel_width, front_panel_thickness], center=[1, 1, 0]);
translate([0, 0, -4]) {
translate([front_panel_height/2 - 5 - container_wall_thickness, -front_panel_width/2 + container_wall_thickness]) cube(5);
translate([front_panel_height/2 - 5 - container_wall_thickness, front_panel_width/2 - container_wall_thickness - 5]) cube(5);
translate([-front_panel_height/2 + container_wall_thickness, -front_panel_width/2 + container_wall_thickness]) cube(5);
translate([-front_panel_height/2 + container_wall_thickness, front_panel_width/2 - container_wall_thickness - 5]) cube(5);
}
}
translate([0, 0, -1]) union() {
translate([0, front_panel_width/3]) ccube([55, 6, cut], center=[1, 1, 0]);
translate([0, -front_panel_width/3]) for ( i = [1 : 8] ){
translate([10*i - front_panel_height/2 + 5, 0])
cylinder(d = 3, h=cut);
}
}
}
}
module back_panel() {
difference() {
union() {
ccube([front_panel_height, front_panel_width, 50+container_wall_thickness], center=[0, 1, 0]);
}
union() {
translate([container_wall_thickness, 0, container_wall_thickness]) ccube([front_panel_height-2*container_wall_thickness, front_panel_width-2*container_wall_thickness, cut], center=[0, 1, 0]);
translate([front_panel_height/2, 0, -1]) cylinder(d=10, h=cut);
translate([-1, 0, container_wall_thickness+7]) rotate([0, 90, 0]) cylinder(d=12, h=cut);
// Holes for M3 bolts
translate([0, 0, -1]) {
translate([container_wall_thickness + 5, -front_panel_width/2 + container_wall_thickness + 5]) cylinder(d=3.5, h=cut);
translate([container_wall_thickness + 5, front_panel_width/2 - container_wall_thickness - 5]) cylinder(d=3.5, h=cut);
translate([front_panel_height-container_wall_thickness-5, -front_panel_width/2 + container_wall_thickness + 5]) cylinder(d=3.5, h=cut);
translate([front_panel_height-container_wall_thickness-5, front_panel_width/2 - container_wall_thickness - 5]) cylinder(d=3.5, h=cut);
}
}
}
translate([container_wall_thickness+13, 0]) ccube([5, 10, container_wall_thickness+10], center=[0, 1, 0]);
}
/* front_panel(); */
/* back_panel(); */
// plate to insert between button and main case
cube([10, 10, 4.8]);

View file

@ -0,0 +1,29 @@
# Appendix B: Indicatorlampen
\begin{figure}[!b]
\centering
\includegraphics[width=10cm,height=5cm,keepaspectratio]{./info_002_indicators/description.png}
\end{figure}
Er zijn 2 soorten indicatorlampen: gelabelde en gekleurde. De gelabelde lampen staan
bovenaan de module, de gekleurde onderaan.
## Gelabelde indicatorlampen
De labels zijn (in volgorde): `WPI`, `KEL`, `DER`, `ZEUS`, `JDV`, `QRV`, `PSE`, `DRV`.
## Gekleurde indicatorlampen
Mogelijke kleuren zijn:
\fcolorbox{black}{red}{\rule{0pt}{6pt}\rule{6pt}{0pt}} rood, \fcolorbox{black}{green}{\rule{0pt}{6pt}\rule{6pt}{0pt}} groen, \fcolorbox{black}{blue}{\rule{0pt}{6pt}\rule{6pt}{0pt}} blauw, \fcolorbox{black}{yellow}{\rule{0pt}{6pt}\rule{6pt}{0pt}} geel, \fcolorbox{black}{cyan}{\rule{0pt}{6pt}\rule{6pt}{0pt}} cyaan, \fcolorbox{black}{orange}{\rule{0pt}{6pt}\rule{6pt}{0pt}} oranje, \fcolorbox{black}{magenta}{\rule{0pt}{6pt}\rule{6pt}{0pt}} roze, \fcolorbox{black}{violet}{\rule{0pt}{6pt}\rule{6pt}{0pt}} paars
Indien je niet zeker bent wat de kleur is van een bepaalde gekleurde indicatorlamp,
kan je op de witte knop op de zijkant van de module drukken. Zolang deze knop ingedrukt is,
worden tijdelijk alle kleuren in de volgorde van het lijstje hierboven getoond en gaan de gelabelde
indicatorlampen uit. Wanneer in de handleiding verwezen wordt naar indicatorlampen, gaat
dit enkel over hun staat wanneer de knop niet ingedrukt is.
**Waarschuwing**: wanneer er in de handleiding verwezen wordt naar de kleur van indicatorlampen,
mag je enkel de gekleurde indicatorlampen in beschouwing nemen, niet de gelabelde indicatorlampen
(de leds in de gelabelde indicatorlampen zijn geel, maar deze tellen niet mee).

View file

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg id="svg5" width="210mm" height="297mm" version="1.1" viewBox="0 0 210 297" xmlns="http://www.w3.org/2000/svg">
<g id="layer1">
<rect id="rect848" x="55.25" y="100.54" width="99.5" height="49.5" fill="none" stroke="#000" stroke-width=".5"/>
<circle id="path1110" cx="100" cy="107.5" r="1.3677" fill="none" stroke="#000" stroke-width=".26458"/>
<circle id="path1110-3" cx="130" cy="107.08" r="1.3677" fill="none" stroke="#000" stroke-width=".26458"/>
<circle id="path1110-6" cx="110" cy="107.08" r="1.3677" fill="none" stroke="#000" stroke-width=".26458"/>
<circle id="path1110-7" cx="120" cy="107.08" r="1.3677" fill="none" stroke="#000" stroke-width=".26458"/>
<circle id="path1110-35" cx="140" cy="107.5" r="1.3677" fill="none" stroke="#000" stroke-width=".26458"/>
<circle id="path1110-62" cx="90" cy="107.5" r="1.3677" fill="none" stroke="#000" stroke-width=".26458"/>
<circle id="path1110-9" cx="80" cy="107.5" r="1.3677" fill="none" stroke="#000" stroke-width=".26458"/>
<circle id="path1110-1" cx="70" cy="107.5" r="1.3677" fill="none" stroke="#000" stroke-width=".26458"/>
<rect id="rect1438" x="77.75" y="140.23" width="54.5" height="5.5" fill="none" stroke="#000" stroke-width=".5"/>
<text id="text5068" transform="scale(.26458)" fill="#000000" font-family="sans-serif" font-size="16px" letter-spacing="0px" word-spacing="0px" style="line-height:1.25;shape-inside:url(#rect5070);white-space:pre" xml:space="preserve"/>
<text id="text8332" x="70.209808" y="113.68592" fill="#000000" font-family="monospace" font-size="4.2333px" letter-spacing="0px" stroke-width=".26458" text-align="center" text-anchor="middle" word-spacing="0px" style="line-height:1.25" xml:space="preserve"><tspan id="tspan8330" x="70.209808" y="113.68592" font-family="monospace" font-size="4.2333px" stroke-width=".26458" text-align="center" text-anchor="middle">WPI</tspan></text>
<text id="text14928" x="83.34375" y="119.0625" fill="#000000" font-family="sans-serif" font-size="4.2333px" letter-spacing="0px" stroke-width=".26458" text-align="center" text-anchor="middle" word-spacing="0px" style="line-height:1.25" xml:space="preserve"><tspan id="tspan14926" x="83.34375" y="119.0625" font-size="4.2333px" stroke-width=".26458" text-align="center" text-anchor="middle"/></text>
<text id="text8332-2" x="79.955559" y="119.31482" fill="#000000" font-family="monospace" font-size="4.2333px" letter-spacing="0px" stroke-width=".26458" text-align="center" text-anchor="middle" word-spacing="0px" style="line-height:1.25" xml:space="preserve"><tspan id="tspan8330-7" x="79.955559" y="119.31482" font-family="monospace" font-size="4.2333px" stroke-width=".26458" text-align="center" text-anchor="middle">KEL</tspan></text>
<text id="text8332-0" x="89.858406" y="113.68592" fill="#000000" font-family="monospace" font-size="4.2333px" letter-spacing="0px" stroke-width=".26458" text-align="center" text-anchor="middle" word-spacing="0px" style="line-height:1.25" xml:space="preserve"><tspan id="tspan8330-9" x="89.858406" y="113.68592" font-family="monospace" font-size="4.2333px" stroke-width=".26458" text-align="center" text-anchor="middle">DER</tspan></text>
<text id="text8332-3" x="99.978294" y="119.31482" fill="#000000" font-family="monospace" font-size="4.2333px" letter-spacing="0px" stroke-width=".26458" text-align="center" text-anchor="middle" word-spacing="0px" style="line-height:1.25" xml:space="preserve"><tspan id="tspan8330-6" x="99.978294" y="119.31482" font-family="monospace" font-size="4.2333px" stroke-width=".26458" text-align="center" text-anchor="middle">ZEUS</tspan></text>
<text id="text8332-06" x="109.94625" y="113.68592" fill="#000000" font-family="monospace" font-size="4.2333px" letter-spacing="0px" stroke-width=".26458" text-align="center" text-anchor="middle" word-spacing="0px" style="line-height:1.25" xml:space="preserve"><tspan id="tspan8330-2" x="109.94625" y="113.68592" font-family="monospace" font-size="4.2333px" stroke-width=".26458" text-align="center" text-anchor="middle">JDV</tspan></text>
<text id="text8332-6" x="119.93798" y="119.31482" fill="#000000" font-family="monospace" font-size="4.2333px" letter-spacing="0px" stroke-width=".26458" text-align="center" text-anchor="middle" word-spacing="0px" style="line-height:1.25" xml:space="preserve"><tspan id="tspan8330-1" x="119.93798" y="119.31482" font-family="monospace" font-size="4.2333px" stroke-width=".26458" text-align="center" text-anchor="middle">QRV</tspan></text>
<text id="text8332-8" x="129.93179" y="113.68592" fill="#000000" font-family="monospace" font-size="4.2333px" letter-spacing="0px" stroke-width=".26458" text-align="center" text-anchor="middle" word-spacing="0px" style="line-height:1.25" xml:space="preserve"><tspan id="tspan8330-79" x="129.93179" y="113.68592" font-family="monospace" font-size="4.2333px" stroke-width=".26458" text-align="center" text-anchor="middle">PSE</tspan></text>
<text id="text8332-20" x="139.91731" y="119.31482" fill="#000000" font-family="monospace" font-size="4.2333px" letter-spacing="0px" stroke-width=".26458" text-align="center" text-anchor="middle" word-spacing="0px" style="line-height:1.25" xml:space="preserve"><tspan id="tspan8330-23" x="139.91731" y="119.31482" font-family="monospace" font-size="4.2333px" stroke-width=".26458" text-align="center" text-anchor="middle">DRV</tspan></text>
<text id="text8332-1" x="67.731209" y="16.998295" fill="#000000" font-family="monospace" font-size="4.2333px" letter-spacing="0px" stroke-width=".26458" text-align="center" text-anchor="middle" word-spacing="0px" style="line-height:1.25" xml:space="preserve"><tspan id="tspan8330-4" x="67.731209" y="16.998295" font-family="monospace" font-size="4.2333px" stroke-width=".26458" text-align="center" text-anchor="middle">WPI</tspan></text>
<text id="text8332-2-9" x="77.476959" y="22.627193" fill="#000000" font-family="monospace" font-size="4.2333px" letter-spacing="0px" stroke-width=".26458" text-align="center" text-anchor="middle" word-spacing="0px" style="line-height:1.25" xml:space="preserve"><tspan id="tspan8330-7-2" x="77.476959" y="22.627193" font-family="monospace" font-size="4.2333px" stroke-width=".26458" text-align="center" text-anchor="middle">KEL</tspan></text>
<text id="text8332-0-0" x="87.379807" y="16.998295" fill="#000000" font-family="monospace" font-size="4.2333px" letter-spacing="0px" stroke-width=".26458" text-align="center" text-anchor="middle" word-spacing="0px" style="line-height:1.25" xml:space="preserve"><tspan id="tspan8330-9-6" x="87.379807" y="16.998295" font-family="monospace" font-size="4.2333px" stroke-width=".26458" text-align="center" text-anchor="middle">DER</tspan></text>
<text id="text8332-3-8" x="97.499695" y="22.627193" fill="#000000" font-family="monospace" font-size="4.2333px" letter-spacing="0px" stroke-width=".26458" text-align="center" text-anchor="middle" word-spacing="0px" style="line-height:1.25" xml:space="preserve"><tspan id="tspan8330-6-9" x="97.499695" y="22.627193" font-family="monospace" font-size="4.2333px" stroke-width=".26458" text-align="center" text-anchor="middle">ZEUS</tspan></text>
<text id="text8332-06-2" x="107.46764" y="16.998295" fill="#000000" font-family="monospace" font-size="4.2333px" letter-spacing="0px" stroke-width=".26458" text-align="center" text-anchor="middle" word-spacing="0px" style="line-height:1.25" xml:space="preserve"><tspan id="tspan8330-2-6" x="107.46764" y="16.998295" font-family="monospace" font-size="4.2333px" stroke-width=".26458" text-align="center" text-anchor="middle">JDV</tspan></text>
<text id="text8332-6-6" x="117.45937" y="22.627193" fill="#000000" font-family="monospace" font-size="4.2333px" letter-spacing="0px" stroke-width=".26458" text-align="center" text-anchor="middle" word-spacing="0px" style="line-height:1.25" xml:space="preserve"><tspan id="tspan8330-1-4" x="117.45937" y="22.627193" font-family="monospace" font-size="4.2333px" stroke-width=".26458" text-align="center" text-anchor="middle">QRV</tspan></text>
<text id="text8332-8-9" x="127.4532" y="16.998295" fill="#000000" font-family="monospace" font-size="4.2333px" letter-spacing="0px" stroke-width=".26458" text-align="center" text-anchor="middle" word-spacing="0px" style="line-height:1.25" xml:space="preserve"><tspan id="tspan8330-79-5" x="127.4532" y="16.998295" font-family="monospace" font-size="4.2333px" stroke-width=".26458" text-align="center" text-anchor="middle">PSE</tspan></text>
<text id="text8332-20-0" x="137.43871" y="22.627193" fill="#000000" font-family="monospace" font-size="4.2333px" letter-spacing="0px" stroke-width=".26458" text-align="center" text-anchor="middle" word-spacing="0px" style="line-height:1.25" xml:space="preserve"><tspan id="tspan8330-23-4" x="137.43871" y="22.627193" font-family="monospace" font-size="4.2333px" stroke-width=".26458" text-align="center" text-anchor="middle">DRV</tspan></text>
<rect id="rect25417" x="59.531" y="10.583" width="85.99" height="15.875" fill="none" stroke="#000" stroke-width=".26458"/>
<text id="text8332-1-8" x="67.731201" y="270.99832" fill="#000000" font-family="monospace" font-size="4.2333px" letter-spacing="0px" stroke-width=".26458" text-align="center" text-anchor="middle" word-spacing="0px" style="line-height:1.25" xml:space="preserve"><tspan id="tspan8330-4-7" x="67.731201" y="270.99832" font-family="monospace" font-size="4.2333px" stroke-width=".26458" text-align="center" text-anchor="middle">WPI</tspan></text>
<text id="text8332-2-9-1" x="77.476952" y="276.6272" fill="#000000" font-family="monospace" font-size="4.2333px" letter-spacing="0px" stroke-width=".26458" text-align="center" text-anchor="middle" word-spacing="0px" style="line-height:1.25" xml:space="preserve"><tspan id="tspan8330-7-2-7" x="77.476952" y="276.6272" font-family="monospace" font-size="4.2333px" stroke-width=".26458" text-align="center" text-anchor="middle">KEL</tspan></text>
<text id="text8332-0-0-2" x="87.379799" y="270.99832" fill="#000000" font-family="monospace" font-size="4.2333px" letter-spacing="0px" stroke-width=".26458" text-align="center" text-anchor="middle" word-spacing="0px" style="line-height:1.25" xml:space="preserve"><tspan id="tspan8330-9-6-7" x="87.379799" y="270.99832" font-family="monospace" font-size="4.2333px" stroke-width=".26458" text-align="center" text-anchor="middle">DER</tspan></text>
<text id="text8332-3-8-2" x="97.499687" y="276.6272" fill="#000000" font-family="monospace" font-size="4.2333px" letter-spacing="0px" stroke-width=".26458" text-align="center" text-anchor="middle" word-spacing="0px" style="line-height:1.25" xml:space="preserve"><tspan id="tspan8330-6-9-2" x="97.499687" y="276.6272" font-family="monospace" font-size="4.2333px" stroke-width=".26458" text-align="center" text-anchor="middle">ZEUS</tspan></text>
<text id="text8332-06-2-6" x="107.46764" y="270.99832" fill="#000000" font-family="monospace" font-size="4.2333px" letter-spacing="0px" stroke-width=".26458" text-align="center" text-anchor="middle" word-spacing="0px" style="line-height:1.25" xml:space="preserve"><tspan id="tspan8330-2-6-1" x="107.46764" y="270.99832" font-family="monospace" font-size="4.2333px" stroke-width=".26458" text-align="center" text-anchor="middle">JDV</tspan></text>
<text id="text8332-6-6-0" x="117.45937" y="276.6272" fill="#000000" font-family="monospace" font-size="4.2333px" letter-spacing="0px" stroke-width=".26458" text-align="center" text-anchor="middle" word-spacing="0px" style="line-height:1.25" xml:space="preserve"><tspan id="tspan8330-1-4-6" x="117.45937" y="276.6272" font-family="monospace" font-size="4.2333px" stroke-width=".26458" text-align="center" text-anchor="middle">QRV</tspan></text>
<text id="text8332-8-9-1" x="127.45319" y="270.99832" fill="#000000" font-family="monospace" font-size="4.2333px" letter-spacing="0px" stroke-width=".26458" text-align="center" text-anchor="middle" word-spacing="0px" style="line-height:1.25" xml:space="preserve"><tspan id="tspan8330-79-5-5" x="127.45319" y="270.99832" font-family="monospace" font-size="4.2333px" stroke-width=".26458" text-align="center" text-anchor="middle">PSE</tspan></text>
<text id="text8332-20-0-9" x="137.43871" y="276.6272" fill="#000000" font-family="monospace" font-size="4.2333px" letter-spacing="0px" stroke-width=".26458" text-align="center" text-anchor="middle" word-spacing="0px" style="line-height:1.25" xml:space="preserve"><tspan id="tspan8330-23-4-4" x="137.43871" y="276.6272" font-family="monospace" font-size="4.2333px" stroke-width=".26458" text-align="center" text-anchor="middle">DRV</tspan></text>
<rect id="rect25417-9" x="59.531" y="264.58" width="85.99" height="15.875" fill="none" stroke="#000" stroke-width=".26458"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 13 KiB

View file

@ -0,0 +1,110 @@
// (c) 2022, redfast00
// See the LICENSE file for conditions for copying
/* Format of the info message
length = 5 bytes
id = 2
message:
X X X X A
------v -> the labeled indicators
the colored indicators
The first 4 bytes are for the 8 colored indicators, every
byte contains 2 indices into the color table. The first colored indicator index is
in the first (or most sigificant) 4 bits of the first byte, the second colored indicator
index in the last 4 bits of the first byte, and so on.
The color table is defined below in the `colortable` variable
The fifth byte is for the labeled indicators. The most significant bit (128) is
for the WPI label light, the least sigificant bit (1) for the DRV label light. The bit is 1
if the light is on, 0 otherwise. All labels, in order:
WPI 0b10000000
KEL 0b01000000
DER 0b00100000
ZEUS 0b00010000
JDV 0b00001000
QRV 0b00000100
PSE 0b00000010
DRV 0b00000001
Some code to loop over all colored indicator values, assuming the info message was saved in `buffer`
```
for (uint8_t idx = 0; idx < 8; idx++) {
coloridx = (buffer[idx / 2] >> (4 * (1 - (idx & 1)))) & 0b111;
}
```
*/
uint8_t colortable[8][3] = {
{20, 0, 0}, // red 0b0000
{0, 20, 0}, // green 0b0001
{0, 0, 20}, // blue 0b0010
{10, 10, 0}, // yellow 0b0011
{0, 10, 10}, // cyan 0b0100
{15, 5, 0}, // orange 0b0101
{15, 0, 5}, // pink 0b0110
{5, 0, 15} // purple 0b0111
};
#include <obus_module.h>
#include <Adafruit_NeoPixel.h>
#define WS2812_PIN 6
#define BUTTON_PIN 9
uint8_t led_pins[8] = {A0, A1, A2, A3, A4, A5, 3, 2};
Adafruit_NeoPixel pixels(8, WS2812_PIN, NEO_GRB + NEO_KHZ800);
uint8_t led_buffer[5] = {0b00000001, 0b00100011, 0b01000101, 0b01100111, 0b11101100};
bool render_now = true;
void setup() {
Serial.begin(115200);
obus_module::setup(OBUS_TYPE_INFO, 2);
pixels.begin();
pinMode(BUTTON_PIN, INPUT_PULLUP);
for (int i = 0; i < 8; i++) {
pinMode(led_pins[i], OUTPUT);
digitalWrite(led_pins[i], true);
}
}
obus_can::message message;
void render(bool realcolors) {
render_now = false;
for (uint8_t idx = 0; idx < 8; idx++) {
uint8_t coloridx = idx;
if (realcolors) {
coloridx = (led_buffer[idx / 2] >> (4 * (1 - (idx & 1)))) & 0b111;
}
pixels.setPixelColor(idx, pixels.Color(colortable[coloridx][0], colortable[coloridx][1], colortable[coloridx][2]));
}
pixels.show();
for (int i = 0; i < 8; i++) {
digitalWrite(led_pins[i], ((led_buffer[4] >> i) & 0b1) && realcolors);
}
}
void loop() {
obus_module::loopInfo(&message, info_generator);
render(digitalRead(BUTTON_PIN) == HIGH);
}
int info_generator(uint8_t* buffer) {
for (int i = 0; i < 4; i++) {
led_buffer[i] = random(256) & 0b01110111;
}
led_buffer[4] = random(256);
render_now = true;
memcpy(buffer, led_buffer, 5);
return 5;
}