stash
This commit is contained in:
parent
084161eba9
commit
875b3a8999
6 changed files with 123 additions and 9 deletions
|
@ -29,8 +29,7 @@ void gpio_intr_handler(uint8_t gpio_num);
|
|||
|
||||
void manual_switch(void);
|
||||
|
||||
void buttonIntTask(void *pvParameters)
|
||||
{
|
||||
_Noreturn void buttonIntTask(void *pvParameters) {
|
||||
printf("Waiting for button press interrupt on gpio %d...\r\n", SWITCH_PIN);
|
||||
QueueHandle_t *tsqueue = (QueueHandle_t *) pvParameters;
|
||||
gpio_set_interrupt(SWITCH_PIN, int_type, gpio_intr_handler);
|
||||
|
|
|
@ -30,7 +30,7 @@ void system_clear_config() {
|
|||
spiflash_erase_sector(start + i * sdk_flashchip.sector_size);
|
||||
}
|
||||
if(sysparam_create_area(start, num_sectors, true) == SYSPARAM_OK) {
|
||||
sysparam_init(start, 0);
|
||||
sysparam_init(start, start + 0x2000);
|
||||
}
|
||||
sysparam_init(start, start + 0x2000);
|
||||
sdk_system_restart();
|
||||
|
@ -39,13 +39,13 @@ void system_clear_config() {
|
|||
void system_init_config() {
|
||||
uint32_t base_addr = 0x00100000;
|
||||
uint32_t num_sectors;
|
||||
sysparam_init(base_addr, 0);
|
||||
sysparam_init(base_addr, base_addr + 0x2000);
|
||||
if(sysparam_get_info(&base_addr, &num_sectors) != SYSPARAM_OK) {
|
||||
syslog("Warning: WiFi config, sysparam not initialized\n");
|
||||
num_sectors = 0x2000 / sdk_flashchip.sector_size;
|
||||
//base_addr = sdk_flashchip.chip_size - (5 + num_sectors) * sdk_flashchip.sector_size;
|
||||
if(sysparam_create_area(base_addr, num_sectors, true) == SYSPARAM_OK) {
|
||||
sysparam_init(base_addr, 0);
|
||||
sysparam_init(base_addr, base_addr + 0x2000);
|
||||
}
|
||||
sdk_system_restart();
|
||||
}
|
||||
|
|
|
@ -325,6 +325,30 @@ void websocket_cb(struct tcp_pcb *pcb, char *data, u16_t data_len,
|
|||
}
|
||||
cmd = 'C';
|
||||
break;
|
||||
case 'T': {
|
||||
auto A = *(int32_t *) &data[4];
|
||||
auto B = *(int32_t *) &data[8];
|
||||
auto C = *(int32_t *) &data[12];
|
||||
auto D = *(int32_t *) &data[16];
|
||||
/*sysparam_set_int32("noctis_A", A);
|
||||
sysparam_set_int32("noctis_B", B);
|
||||
sysparam_set_int32("noctis_C", C);
|
||||
sysparam_set_int32("noctis_D", D);*/
|
||||
}
|
||||
cmd = 'T';
|
||||
break;
|
||||
case 'N': {
|
||||
if(data[1] == 'W')
|
||||
printf("WS2812\n");
|
||||
else if(data[1] == 'A')
|
||||
printf("APA103C\n");
|
||||
else if(data[1] == 'Z')
|
||||
printf("APA103C-Z\n");
|
||||
auto num_leds = *(uint16_t *) &data[2];
|
||||
/*sysparam_set_int32("noctis_leds", num_leds);*/
|
||||
}
|
||||
cmd = 'N';
|
||||
break;
|
||||
case 'S': {
|
||||
if(data[1] == 'E')
|
||||
en = 1;
|
||||
|
|
|
@ -10,7 +10,7 @@ canvas {
|
|||
width: 100%;
|
||||
}
|
||||
|
||||
main section:target ~ section, main section#io, main section#wifi, main section#ota {
|
||||
main section:target ~ section, main section#io, main section#wifi, main section#noctis, main section#ota {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
<div class="menu">
|
||||
<a href="/#" class="button icon-picture">Dashboard</a>
|
||||
<a href="/#io" class="button icon-puzzle">I/O</a>
|
||||
<a href="/#noctis" class="button icon-puzzle">Time</a>
|
||||
<a href="/#wifi" class="button icon-puzzle">Wifi Settings</a>
|
||||
<a href="/#ota" class="button icon-picture">System</a>
|
||||
</div>
|
||||
|
@ -131,6 +132,61 @@
|
|||
</div>
|
||||
</article>
|
||||
</section>
|
||||
<section id="noctis">
|
||||
<h2>Time</h2>
|
||||
<article class="card">
|
||||
<header>
|
||||
<h3>Times</h3>
|
||||
</header>
|
||||
<div class="table">
|
||||
<div class="row">
|
||||
<label>Sunrise Start</label>
|
||||
<span><input type="time" class="plain" id="sunrise_start" value="07:30"/></span>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label>Sunrise End</label>
|
||||
<span><input type="time" class="plain" id="sunrise_end" value="08:00"/></span>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label>Sunrise Limit</label>
|
||||
<span><input type="time" class="plain" id="sunrise_shutdown" value="09:00"/></span>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label>Sunset</label>
|
||||
<span><input type="time" class="plain" id="sunset_time" value="22:00"/></span>
|
||||
</div>
|
||||
<div class="row">
|
||||
<span><input type="reset" class="button"/></span>
|
||||
<span><input onclick="noctis_times();" type="submit" value="Save"></span>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
<article class="card">
|
||||
<header>
|
||||
<h3>Output</h3>
|
||||
</header>
|
||||
<div class="table">
|
||||
<div class="row">
|
||||
<label>Leds</label>
|
||||
<span><input type="number" min="0" step="1" class="plain" id="noctisnumber"/></span>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label>Mode</label>
|
||||
<span>
|
||||
<select id="noctismode">
|
||||
<option value="W">WS2812</option>
|
||||
<option value="A">APA102C</option>
|
||||
<option value="Z">APA102C-Z</option>
|
||||
</select>
|
||||
</span>
|
||||
</div>
|
||||
<div class="row">
|
||||
<span><input type="reset" class="button"/></span>
|
||||
<span><input onclick="noctis_output();" type="submit" value="Save"></span>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
</section>
|
||||
<section id="wifi">
|
||||
<h2>Wifi Settings</h2>
|
||||
<article class="card">
|
||||
|
@ -502,6 +558,42 @@
|
|||
wsWrite(buffer);
|
||||
}
|
||||
|
||||
var sunrise_start = document.getElementById("sunrise_start");
|
||||
var sunrise_end = document.getElementById("sunrise_end");
|
||||
var sunrise_shutdown = document.getElementById("sunrise_shutdown");
|
||||
var sunset_time = document.getElementById("sunset_time");
|
||||
|
||||
var noctisnumber = document.getElementById("noctisnumber");
|
||||
var noctismode = document.getElementById("noctismode");
|
||||
|
||||
function noctis_times() {
|
||||
const buffer = new ArrayBuffer(20);
|
||||
const view1 = new DataView(buffer);
|
||||
var tx_len = 0;
|
||||
view1.setChar(tx_len, 'T');
|
||||
tx_len += 4;
|
||||
view1.setUint32(tx_len, sunrise_start.valueAsNumber);
|
||||
tx_len += 4;
|
||||
view1.setUint32(tx_len, sunrise_end.valueAsNumber);
|
||||
tx_len += 4;
|
||||
view1.setUint32(tx_len, sunrise_shutdown.valueAsNumber);
|
||||
tx_len += 4;
|
||||
view1.setUint32(tx_len, sunset_time.valueAsNumber);
|
||||
tx_len += 4;
|
||||
wsWrite(buffer);
|
||||
}
|
||||
|
||||
function noctis_output() {
|
||||
const buffer = new ArrayBuffer(4);
|
||||
const view1 = new DataView(buffer);
|
||||
var tx_len = 0;
|
||||
view1.setChar(tx_len++, 'N');
|
||||
view1.setChar(tx_len++, noctismode.value);
|
||||
view1.setUint16(tx_len, noctisnumber.valueAsNumber);
|
||||
tx_len += 2;
|
||||
wsWrite(buffer);
|
||||
}
|
||||
|
||||
var makeCRCTable = function () {
|
||||
var c;
|
||||
var crcTable = [];
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue