Added meter_shunt_y() function to led_meter.

This commit is contained in:
Chris Palmer 2020-05-26 15:19:38 +01:00
parent d3f308a45e
commit 98e17080d8
2 changed files with 4 additions and 1 deletions

View File

@ -1443,6 +1443,7 @@ The 7 SEGMENT.TTF font from the [docs](docs) directory needs to be installed to
| ```meter_bezel_rad(type)``` | Printed bezel corner radius |
| ```meter_bezel_wall(type)``` | Printed bezel wall thickness |
| ```meter_bezel_width(type)``` | Printed bezel width |
| ```meter_shunt_y(type)``` | Shunt y coordinate |
### Modules
| Module | Description |

View File

@ -44,6 +44,8 @@ module meter_hole_positions(type) //! Position children over the holes
translate([side * meter_hole_pitch(type) / 2, meter_lug_pos(type)])
children();
function meter_shunt_y(type) = meter_pos(type) - meter_pcb_size(type).y / 2; //! Shunt y coordinate
module meter(type, colour = "red", value = "888", display_colour = false) //! Draw a meter with optional colour and display value
{
vitamin(str("meter(", type[0], arg(colour, "red", "colour"), "): LED ", meter_shunt(type) ? "am" : "volt", "meter ", colour));
@ -80,7 +82,7 @@ module meter(type, colour = "red", value = "888", display_colour = false) //! Dr
shunt = meter_shunt(type);
if(shunt)
translate([0, -meter_pcb_size(type).y / 2 + meter_pos(type), size.z])
translate([0, meter_shunt_y(type), size.z])
vflip()
color("#b87333")
wire_link(shunt.y, shunt.x, shunt.z, tail = 2);