add reset button, led to node mcu
This commit is contained in:
parent
70345f0b79
commit
ce9dceb589
|
@ -207,4 +207,21 @@
|
|||
#define ESP32_CAN_RX_PIN GROOVE_PIN_2
|
||||
#endif
|
||||
|
||||
#ifndef GWLED_TYPE
|
||||
#ifdef GWLED_CODE
|
||||
#if GWLED_CODE == 0
|
||||
#define GWLED_TYPE SK6812
|
||||
#endif
|
||||
#if GWLED_CODE == 1
|
||||
#define GWLED_TYPE WS2812
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#ifdef GWLED_TYPE
|
||||
#define GWLED_FASTLED
|
||||
#ifndef GWLED_BRIGHTNESS
|
||||
#define GWLED_BRIGHTNESS 64
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -34,7 +34,7 @@ void handleLeds(void *param){
|
|||
#else
|
||||
CRGB leds[1];
|
||||
#ifdef GWLED_SCHEMA
|
||||
FastLED.addLeds<GWLED_TYPE,GWLED_PIN,GWLED_SCHEMA>(leds,1);
|
||||
FastLED.addLeds<GWLED_TYPE,GWLED_PIN,(EOrder)GWLED_SCHEMA>(leds,1);
|
||||
#else
|
||||
FastLED.addLeds<GWLED_TYPE,GWLED_PIN>(leds,1);
|
||||
#endif
|
||||
|
|
|
@ -245,6 +245,97 @@ types:
|
|||
help: 'set the number of the GPIO pin for the CAN(NMEA2000) TX function'
|
||||
target: "define:ESP32_CAN_TX_PIN"
|
||||
|
||||
- &resetButton
|
||||
type: checkbox
|
||||
label: reset button
|
||||
key: resetButton
|
||||
values:
|
||||
- key: true
|
||||
children:
|
||||
- <<: *gpiopin
|
||||
label: Button
|
||||
key: button
|
||||
target: "define:GWBUTTON_PIN"
|
||||
help: 'the gpio pin for a reset to factory settings'
|
||||
- type: dropdown
|
||||
label: active mode
|
||||
help: 'select if the button should be active high or low'
|
||||
key: resetButtonMode
|
||||
target: "define:GWBUTTON_ACTIVE"
|
||||
values:
|
||||
- label: unset
|
||||
value:
|
||||
- label: LOW
|
||||
value: 0
|
||||
- label: HIGH
|
||||
value: 1
|
||||
- type: checkbox
|
||||
label: pullupdown
|
||||
description: "pull up/pull down resistor"
|
||||
key: resetButtonPUD
|
||||
values:
|
||||
- key: true
|
||||
target: define
|
||||
value: GWBUTTON_PULLUPDOWN
|
||||
|
||||
- &led
|
||||
type: checkbox
|
||||
label: Led
|
||||
key: led
|
||||
description: 'RGB LED'
|
||||
values:
|
||||
- key: true
|
||||
children:
|
||||
- <<: *gpiopin
|
||||
label: LedPin
|
||||
key: ledpin
|
||||
mandatory: true
|
||||
target: "define:GWLED_PIN"
|
||||
- type: dropdown
|
||||
label: ledtype
|
||||
help: "the type of the led"
|
||||
key: ledtype
|
||||
target: "define:GWLED_CODE"
|
||||
mandatory: true
|
||||
values:
|
||||
- label: unset
|
||||
value:
|
||||
- label: SK6812
|
||||
value: 0
|
||||
key: sk6812
|
||||
- label: WS2812
|
||||
key: ws2812
|
||||
value: 1
|
||||
- type: dropdown
|
||||
key: ledorder
|
||||
label: color order
|
||||
target: "define:GWLED_SCHEMA"
|
||||
mandatory: true
|
||||
values:
|
||||
- label: unset
|
||||
value:
|
||||
- label: RGB
|
||||
value: 10
|
||||
- label: RBG
|
||||
value: 17
|
||||
- label: GRB
|
||||
value: 66
|
||||
- label: GBR
|
||||
value: 80
|
||||
- label: BRG
|
||||
value: 129
|
||||
- label: BGR
|
||||
value: 136
|
||||
- type: range
|
||||
label: brigthness
|
||||
target: "define:GWLED_BRIGHTNESS"
|
||||
key: brightness
|
||||
min: 0
|
||||
max: 255
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
resources:
|
||||
default: &esp32default
|
||||
|
@ -278,9 +369,12 @@ config:
|
|||
- *m5groove
|
||||
- value: nodemcu-generic
|
||||
label: nodemcu
|
||||
description: "Node mcu"
|
||||
description: "Node mcu esp32"
|
||||
url: "https://docs.platformio.org/en/stable/boards/espressif32/nodemcu-32s.html"
|
||||
resource: *esp32default
|
||||
children:
|
||||
- *serial1
|
||||
- *serial2
|
||||
- *can
|
||||
- *can
|
||||
- *resetButton
|
||||
- *led
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
/* reused stuff from configui */
|
||||
.configui.container{
|
||||
max-width: 35em;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
position: relative;
|
||||
|
@ -51,6 +50,7 @@
|
|||
z-index: unset;
|
||||
appearance: auto;
|
||||
float:none;
|
||||
margin-right: 0.5em;
|
||||
}
|
||||
|
||||
.configui .buttons {
|
||||
|
@ -143,13 +143,15 @@
|
|||
}
|
||||
|
||||
.configui .tcheckbox>.inputFrame,
|
||||
.configui .tdropdown>.inputFrame {
|
||||
.configui .tdropdown>.inputFrame,
|
||||
.configui .trange>.inputFrame {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
}
|
||||
.configui .title.tdropdown,
|
||||
.configui .title.tcheckbox {
|
||||
.configui .title.tcheckbox,
|
||||
.configui .title.trange {
|
||||
width: 10em;
|
||||
font-weight: normal !important;
|
||||
}
|
||||
|
@ -173,7 +175,7 @@
|
|||
width: initial;
|
||||
}
|
||||
.configui .overlayContainer {
|
||||
position: fixed;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
|
@ -181,6 +183,7 @@
|
|||
background-color: #80808070;
|
||||
display: flex;
|
||||
overflow-y: auto;
|
||||
padding: 0.5em;
|
||||
}
|
||||
|
||||
.configui .overlay {
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
</head>
|
||||
|
||||
<body>
|
||||
<div class="configui container">
|
||||
<div class="configui cibuild container">
|
||||
<h1>Build your own ESP32-NMEA2000</h1>
|
||||
<h3>New Build</h3>
|
||||
<div class="row">
|
||||
|
|
|
@ -325,12 +325,12 @@ class PipelineInfo{
|
|||
if (frame === undefined) return;
|
||||
if (v.description){
|
||||
if(v.url) {
|
||||
let lnk = addEl('a', 'radioDescription', frame, v.description);
|
||||
let lnk = addEl('a', 'description', frame, v.description);
|
||||
lnk.setAttribute('href', v.url);
|
||||
lnk.setAttribute('target', '_');
|
||||
}
|
||||
else{
|
||||
let de=addEl('span','radioDescription',frame,v.description);
|
||||
let de=addEl('div','description',frame,v.description);
|
||||
}
|
||||
}
|
||||
if (v.help){
|
||||
|
@ -412,6 +412,48 @@ class PipelineInfo{
|
|||
callback(v,false);
|
||||
});
|
||||
}
|
||||
if (config.type === 'range'){
|
||||
if (config.min !== undefined && config.max !== undefined) {
|
||||
let min=config.min+0;
|
||||
let step=1;
|
||||
if (config.step !== undefined) step=config.step+0;
|
||||
let max=config.max+0;
|
||||
let valid=false;
|
||||
if (step > 0){
|
||||
if (min < max) valid=true;
|
||||
}
|
||||
else{
|
||||
if (min > max) {
|
||||
let tmp=max;
|
||||
max=min;
|
||||
min=tmp;
|
||||
valid=true;
|
||||
}
|
||||
}
|
||||
if (! valid){
|
||||
console.log("invalid range config",config);
|
||||
}
|
||||
else {
|
||||
let sel = addEl('select', 'tdropdown', inputFrame);
|
||||
for (let idx=min;idx <=max;idx+=step){
|
||||
let opt=addEl('option','',sel,idx);
|
||||
opt.setAttribute('value',idx);
|
||||
if (idx == current){
|
||||
opt.setAttribute('selected',true);
|
||||
initialConfig=expandObject({key:idx,value:idx},config);
|
||||
}
|
||||
}
|
||||
if (! initialConfig){
|
||||
initialConfig=expandObject({key:min,value:min},config);
|
||||
}
|
||||
addDescription(config, inputFrame);
|
||||
sel.addEventListener('change', (ev) => {
|
||||
let v = expandObject({ key: ev.target.value, value: ev.target.value },config);
|
||||
callback(v, false);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
if (expandedValues.length > 0 && config.type === 'checkbox'){
|
||||
let act=undefined;
|
||||
let inact=undefined;
|
||||
|
|
Loading…
Reference in New Issue