pre-first-release

This commit is contained in:
ADElectronics 2017-12-26 20:49:06 +03:00
parent c6c5eeed6f
commit 9e39a46764
76 changed files with 190786 additions and 90598 deletions

BIN
Device body/Base.SLDPRT Normal file

Binary file not shown.

BIN
Device body/Base.STL Normal file

Binary file not shown.

BIN
Device body/Button.SLDPRT Normal file

Binary file not shown.

BIN
Device body/Button.STL Normal file

Binary file not shown.

Binary file not shown.

BIN
Device body/PCB/A1.sldasm Normal file

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load diff

Binary file not shown.

BIN
Device body/PCB/C1.sldasm Normal file

Binary file not shown.

BIN
Device body/PCB/C2.sldasm Normal file

Binary file not shown.

BIN
Device body/PCB/C3.sldasm Normal file

Binary file not shown.

BIN
Device body/PCB/C4.sldasm Normal file

Binary file not shown.

BIN
Device body/PCB/C5.sldasm Normal file

Binary file not shown.

BIN
Device body/PCB/C6.sldasm Normal file

Binary file not shown.

BIN
Device body/PCB/C7.sldasm Normal file

Binary file not shown.

BIN
Device body/PCB/DA1.sldasm Normal file

Binary file not shown.

BIN
Device body/PCB/DD1.sldasm Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
Device body/PCB/R1.sldasm Normal file

Binary file not shown.

BIN
Device body/PCB/R2.sldasm Normal file

Binary file not shown.

BIN
Device body/PCB/R3.sldasm Normal file

Binary file not shown.

BIN
Device body/PCB/R4.sldasm Normal file

Binary file not shown.

BIN
Device body/PCB/R5.sldasm Normal file

Binary file not shown.

BIN
Device body/PCB/SB1.sldasm Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
Device body/PCB/VD1.sldasm Normal file

Binary file not shown.

BIN
Device body/PCB/XP1.sldasm Normal file

Binary file not shown.

BIN
Device body/PCB/XP2.sldasm Normal file

Binary file not shown.

Binary file not shown.

BIN
Device body/Top.SLDPRT Normal file

Binary file not shown.

BIN
Device body/Top.STL Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1 @@
<UserSettings><ApplicationIdentity version="14.0"/><ToolsOptions/><Category name="Environment_Group" RegisteredName="Environment_Group"><Category name="Environment_ExternalTools" Category="{E8FAE9E8-FBA2-4474-B134-AB0FFCFB291D}" Package="{DA9FB551-C724-11d0-AE1F-00A0C90FFFC3}" RegisteredName="Environment_ExternalTools" PackageName="Visual Studio Environment Package"><ExternalTools><UserCreatedTool><Arguments>-s runram</Arguments><CloseOnExit>true</CloseOnExit><Command>mingw32-make.exe</Command><Index>0</Index><InitialDirectory>$(ProjectDir)</InitialDirectory><IsGUIapp>false</IsGUIapp><NameID>0</NameID><Package>{00000000-0000-0000-0000-000000000000}</Package><PromptForArguments>false</PromptForArguments><SaveAllDocs>true</SaveAllDocs><Title>[RTL] Run in RAM</Title><Unicode>false</Unicode><UseOutputWindow>true</UseOutputWindow><UseTaskList>false</UseTaskList></UserCreatedTool><UserCreatedTool><Arguments>-s runsdram</Arguments><CloseOnExit>true</CloseOnExit><Command>mingw32-make.exe</Command><Index>1</Index><InitialDirectory>$(ProjectDir)</InitialDirectory><IsGUIapp>false</IsGUIapp><NameID>0</NameID><Package>{00000000-0000-0000-0000-000000000000}</Package><PromptForArguments>false</PromptForArguments><SaveAllDocs>true</SaveAllDocs><Title>[RTL] Run in SDRAM</Title><Unicode>false</Unicode><UseOutputWindow>true</UseOutputWindow><UseTaskList>false</UseTaskList></UserCreatedTool><UserCreatedTool><Arguments>-s flashburn</Arguments><CloseOnExit>true</CloseOnExit><Command>mingw32-make.exe</Command><Index>2</Index><InitialDirectory>$(ProjectDir)</InitialDirectory><IsGUIapp>false</IsGUIapp><NameID>0</NameID><Package>{00000000-0000-0000-0000-000000000000}</Package><PromptForArguments>false</PromptForArguments><SaveAllDocs>true</SaveAllDocs><Title>[RTL] Flash and Run</Title><Unicode>false</Unicode><UseOutputWindow>true</UseOutputWindow><UseTaskList>false</UseTaskList></UserCreatedTool><UserCreatedTool><Arguments>-s flashboot</Arguments><CloseOnExit>true</CloseOnExit><Command>mingw32-make.exe</Command><Index>3</Index><InitialDirectory>$(ProjectDir)</InitialDirectory><IsGUIapp>false</IsGUIapp><NameID>0</NameID><Package>{00000000-0000-0000-0000-000000000000}</Package><PromptForArguments>false</PromptForArguments><SaveAllDocs>true</SaveAllDocs><Title>[RTL] Flash Boot</Title><Unicode>false</Unicode><UseOutputWindow>true</UseOutputWindow><UseTaskList>false</UseTaskList></UserCreatedTool><UserCreatedTool><Arguments>-s flashwebfs</Arguments><CloseOnExit>true</CloseOnExit><Command>mingw32-make.exe</Command><Index>4</Index><InitialDirectory>$(ProjectDir)</InitialDirectory><IsGUIapp>false</IsGUIapp><NameID>0</NameID><Package>{00000000-0000-0000-0000-000000000000}</Package><PromptForArguments>false</PromptForArguments><SaveAllDocs>true</SaveAllDocs><Title>[RTL] Flash WEB Image</Title><Unicode>false</Unicode><UseOutputWindow>true</UseOutputWindow><UseTaskList>false</UseTaskList></UserCreatedTool><UserCreatedTool><Arguments>-s reset</Arguments><CloseOnExit>true</CloseOnExit><Command>mingw32-make.exe</Command><Index>5</Index><InitialDirectory>$(ProjectDir)</InitialDirectory><IsGUIapp>false</IsGUIapp><NameID>0</NameID><Package>{00000000-0000-0000-0000-000000000000}</Package><PromptForArguments>false</PromptForArguments><SaveAllDocs>true</SaveAllDocs><Title>[RTL] Reset CPU</Title><Unicode>false</Unicode><UseOutputWindow>true</UseOutputWindow><UseTaskList>false</UseTaskList></UserCreatedTool><UserCreatedTool><Arguments>-select USB -device Cortex-M3 -if SWD -speed 1000 -ir</Arguments><CloseOnExit>false</CloseOnExit><Command>JLinkGDBServer.exe</Command><Index>6</Index><InitialDirectory>$(ProjectDir)</InitialDirectory><IsGUIapp>true</IsGUIapp><NameID>0</NameID><Package>{00000000-0000-0000-0000-000000000000}</Package><PromptForArguments>false</PromptForArguments><SaveAllDocs>true</SaveAllDocs><Title>[RTL] Start J-Link GDB Server M3</Title><Unicode>false</Unicode><UseOutputWindow>false</UseOutputWindow><UseTaskList>false</UseTaskList></UserCreatedTool><UserCreatedTool><Arguments>-select USB -device Cortex-M4 -if SWD -speed 1000 -ir</Arguments><CloseOnExit>false</CloseOnExit><Command>JLinkGDBServer.exe</Command><Index>7</Index><InitialDirectory>$(ProjectDir)</InitialDirectory><IsGUIapp>true</IsGUIapp><NameID>0</NameID><Package>{00000000-0000-0000-0000-000000000000}</Package><PromptForArguments>false</PromptForArguments><SaveAllDocs>true</SaveAllDocs><Title>[RTL] Start J-Link GDB Server M4</Title><Unicode>false</Unicode><UseOutputWindow>false</UseOutputWindow><UseTaskList>false</UseTaskList></UserCreatedTool><ExcludeRegisteredTool SourceKeyName="Error Loo&amp;kup"/><ExcludeRegisteredTool SourceKeyName="Sp&amp;y++"/><ExcludeRegisteredTool SourceKeyName="Spy++ (x64)"/><ExcludeRegisteredTool SourceKeyName="PreEmptive Protection - Dot&amp;fuscator"/><ExcludeRegisteredTool SourceKeyName="Create GUID"/></ExternalTools></Category></Category></UserSettings>

Binary file not shown.

View file

@ -1,10 +1,5 @@
 ===========================================================
Compile (Debug)
project/user_start.c
project/WS2812/ledfilters.c
project/WS2812/ledeffectsserver.c
project/web/web_int_callbacks.c
project/web/web_int_vars.c
===========================================================
Link (Debug)
===========================================================
@ -18,9 +13,9 @@
copy size 8520
===========================================================
Create image2ns (Debug/bin/ram_2.ns.bin)
b:268460032 s:268460032 e:268727448
size 267416
copy size 267416
b:268460032 s:268460032 e:268728976
size 268944
copy size 268944
===========================================================
Create image3 (SDRAM, Debug/bin/sdram.p.bin)
30000000 30000000
@ -29,21 +24,21 @@
copy size 0
===========================================================
Make OTA image (Debug/bin/ota.bin)
size = 267448
size = 268976
checksum 1a71a99
checksum 1aa0f6e
===========================================================
Create image2p (Debug/bin/ram_2.p.bin)
b:268460032 s:268460032 e:268727448
size 267416
copy size 267416
b:268460032 s:268460032 e:268728976
size 268944
copy size 268944
===========================================================
Make Flash image (Debug/bin/ram_all.bin)
total 44 k, padding data 0, name Debug/bin/ram_all.bin
Original size zd
Padding size zd
-----------------------------------------------------------
Image (Debug/bin/ota.bin) size 267452 bytes
Image (Debug/bin/ram_all.bin) size 312504 bytes
Image (Debug/bin/ota.bin) size 268980 bytes
Image (Debug/bin/ram_all.bin) size 314032 bytes
===========================================================

Binary file not shown.

Binary file not shown.

View file

@ -1,9 +1,34 @@
ws_striplen
ws_striplen
wifi_st_ssid
wifi_st_psw
wifi_st_ip
wifi_ap_ssid
wifi_ap_psw
wifi_ap_ip
ws_isenable
ws_filt_rbw_enbl
ws_filt_flick_enbl
ws_filt_fd_enbl
ws_filt_rbw_huesteps
ws_filt_rbw_cyclesteps
ws_filt_fd_enbl
ws_filt_fd_cyclesteps
ws_filt_fd_min
ws_filt_fd_max
ws_filt_fd_chance
ws_filt_wave_enbl
ws_filt_wave_step
ws_filt_wave_wavesteps
wifi_mode
wifi_bgn
wifi_txpow
wifi_st_ssid
wifi_st_psw
wifi_st_auth
wifi_st_ip
wifi_ap_ssid
wifi_ap_psw
wifi_ap_auth
wifi_ap_ip
ws_filt_const_hue
ws_filt_const_sat
ws_filt_const_value

File diff suppressed because it is too large Load diff

Binary file not shown.

File diff suppressed because it is too large Load diff

View file

@ -9,50 +9,48 @@ SemaphoreHandle_t cfg_sema = NULL;
ctx_rainbow_t filt_rainbow;
ctx_fade_t filt_fade;
ctx_const_t filt_const;
ctx_wave_t filt_wave;
void ledEffectsServer_Init()
{
cfg_sema = xSemaphoreCreateMutex();
ws2812_cfg = ws2812_Init(WS2812_LEDS_MAX);
if (ws2812_cfg == NULL)
{
printf("[%s] ws2812_Init() failed\n", __func__);
goto error;
return;
}
ledFilter_Init(&strip, ws2812_cfg);
ledFilter_InitRainbow(&filt_rainbow);
ledFilter_InitFade(&filt_fade);
ledFilter_InitConstant(&filt_const);
ledFilter_InitWave(&filt_wave);
ledFilter_SetDefualtValue(&strip, MAX_STRIP_BRIGHT);
filt_fade.enabled = 1;
}
void ledEffectsServer_Task()
{
cfg_sema = xSemaphoreCreateMutex();
while (1)
{
if(xSemaphoreTake(cfg_sema, 5 * configTICK_RATE_HZ))
if (xSemaphoreTake(cfg_sema, 5 * configTICK_RATE_HZ))
{
ledFilter_Rainbow(&filt_rainbow, &strip);
ledFilter_Constant(&filt_const, &strip);
ledFilter_Wave(&filt_wave, &strip);
ledFilter_Fade(&filt_fade, &strip);
ws2812_Update(ws2812_cfg, strip.hsv_vals, strip.strip_len, strip.delay);
ws2812_Update(ws2812_cfg, strip.hsv_vals, strip.strip_len, strip.delay);
xSemaphoreGive(cfg_sema);
}
WDGRefresh();
}
error:
while (1)
{
vTaskDelay(1000);
}
}
/*
void ledEffectsServer_LoadConfigFromFlash()

View file

@ -5,14 +5,14 @@
// Ïóáëè÷íûå êîíôèíãè ôèëüòðîâ
extern strip_handler_t strip;
extern ctx_rainbow_t filt_rainbow;
extern ctx_fade_t filt_fade;
extern ctx_const_t filt_const;
extern ctx_wave_t filt_wave;
void ledEffectsServer_Init();
void ledEffectsServer_Task();
#endif // _LEDEFFECTSSERVER_H_

View file

@ -2,6 +2,41 @@
extern uint32_t cfg_updated;
uint8_t sin_table[256] = {
0x80, 0x83, 0x86, 0x89, 0x8C, 0x90, 0x93, 0x96,
0x99, 0x9C, 0x9F, 0xA2, 0xA5, 0xA8, 0xAB, 0xAE,
0xB1, 0xB3, 0xB6, 0xB9, 0xBC, 0xBF, 0xC1, 0xC4,
0xC7, 0xC9, 0xCC, 0xCE, 0xD1, 0xD3, 0xD5, 0xD8,
0xDA, 0xDC, 0xDE, 0xE0, 0xE2, 0xE4, 0xE6, 0xE8,
0xEA, 0xEB, 0xED, 0xEF, 0xF0, 0xF1, 0xF3, 0xF4,
0xF5, 0xF6, 0xF8, 0xF9, 0xFA, 0xFA, 0xFB, 0xFC,
0xFD, 0xFD, 0xFE, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFE, 0xFE, 0xFD,
0xFD, 0xFC, 0xFB, 0xFA, 0xFA, 0xF9, 0xF8, 0xF6,
0xF5, 0xF4, 0xF3, 0xF1, 0xF0, 0xEF, 0xED, 0xEB,
0xEA, 0xE8, 0xE6, 0xE4, 0xE2, 0xE0, 0xDE, 0xDC,
0xDA, 0xD8, 0xD5, 0xD3, 0xD1, 0xCE, 0xCC, 0xC9,
0xC7, 0xC4, 0xC1, 0xBF, 0xBC, 0xB9, 0xB6, 0xB3,
0xB1, 0xAE, 0xAB, 0xA8, 0xA5, 0xA2, 0x9F, 0x9C,
0x99, 0x96, 0x93, 0x90, 0x8C, 0x89, 0x86, 0x83,
0x80, 0x7D, 0x7A, 0x77, 0x74, 0x70, 0x6D, 0x6A,
0x67, 0x64, 0x61, 0x5E, 0x5B, 0x58, 0x55, 0x52,
0x4F, 0x4D, 0x4A, 0x47, 0x44, 0x41, 0x3F, 0x3C,
0x39, 0x37, 0x34, 0x32, 0x2F, 0x2D, 0x2B, 0x28,
0x26, 0x24, 0x22, 0x20, 0x1E, 0x1C, 0x1A, 0x18,
0x16, 0x15, 0x13, 0x11, 0x10, 0x0F, 0x0D, 0x0C,
0x0B, 0x0A, 0x08, 0x07, 0x06, 0x06, 0x05, 0x04,
0x03, 0x03, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x03,
0x03, 0x04, 0x05, 0x06, 0x06, 0x07, 0x08, 0x0A,
0x0B, 0x0C, 0x0D, 0x0F, 0x10, 0x11, 0x13, 0x15,
0x16, 0x18, 0x1A, 0x1C, 0x1E, 0x20, 0x22, 0x24,
0x26, 0x28, 0x2B, 0x2D, 0x2F, 0x32, 0x34, 0x37,
0x39, 0x3C, 0x3F, 0x41, 0x44, 0x47, 0x4A, 0x4D,
0x4F, 0x52, 0x55, 0x58, 0x5B, 0x5E, 0x61, 0x64,
0x67, 0x6A, 0x6D, 0x70, 0x74, 0x77, 0x7A, 0x7D
};
#pragma region Áàçîâûå ôóíêöèè ïî ðàáîòå ñ ôèëüòðàìè
int32_t ledFilter_Init(strip_handler_t *strip, ws2812_t *ws2812)
{
@ -12,7 +47,7 @@ int32_t ledFilter_Init(strip_handler_t *strip, ws2812_t *ws2812)
strip->strip_len = DEF_STRIP_LEN;
strip->delay = 10;
strip->brightness = MAX_STRIP_BRIGHT;
strip->isEnable = 1;
cfg_updated = 1;
}
@ -79,7 +114,7 @@ void ledFilter_Rainbow(ctx_rainbow_t *ctx, strip_handler_t *strip)
ws2812_hsv_t tmp_hsv;
uint8_t tmp_hue;
if (ctx->enabled == 0) return;
if (ctx->enabled == 0 || strip->isEnable == 0) return;
tmp_hue = ctx->curr_hue;
tmp_hsv.sat = 255;
@ -96,7 +131,7 @@ void ledFilter_Rainbow(ctx_rainbow_t *ctx, strip_handler_t *strip)
tmp_hsv.value = strip->hsv_vals[i].value;
strip->hsv_vals[i] = tmp_hsv;
tmp_hue += 255/ ctx->hue_steps;
tmp_hue %= 256;
//tmp_hue %= 256;
}
ctx->curr_hue += ctx->cycle_steps;
@ -109,11 +144,11 @@ void ledFilter_InitFade(ctx_fade_t *ctx)
{
if (ctx->valid != LEDFILTERS_CFG_CHECKWORD)
{
ctx->valid = 1;
ctx->valid = LEDFILTERS_CFG_CHECKWORD;
ctx->min = 0;
ctx->max = 255;
ctx->steps = LEDFILTERS_MAX_STEPS;
ctx->enabled = 1;
ctx->enabled = 0;
cfg_updated = 1;
}
@ -130,7 +165,7 @@ void ledFilter_Fade(ctx_fade_t *ctx, strip_handler_t *strip)
{
uint32_t i;
if (ctx->enabled == 0) return;
if (ctx->enabled == 0 || strip->isEnable == 0) return;
if (ctx->curr_val == 0)
{
@ -186,24 +221,84 @@ void ledFilter_Fade(ctx_fade_t *ctx, strip_handler_t *strip)
#pragma region Wave
void ledFilter_InitWave(ctx_wave_t *ctx)
{
if (ctx->valid != LEDFILTERS_CFG_CHECKWORD)
{
ctx->valid = LEDFILTERS_CFG_CHECKWORD;
ctx->enabled = 0;
ctx->wave_steps = 20;
ctx->angle = 0;
ctx->step = 1;
cfg_updated = 1;
}
//for (uint16_t i = 0; i < 255; i++)
// sin_table[i] = (uint16_t)(sin((double)(((double)i + 2.0) * M_PI)/ 255.0) * UINT8_MAX);
}
void ledFilter_Wave(ctx_wave_t *ctx, strip_handler_t *strip)
{
uint32_t i, j;
uint8_t tmp_angle = 0;
if (ctx->enabled == 0 || strip->isEnable == 0) return;
tmp_angle = ctx->angle;
for (i = 0, j = ctx->wave_steps; i < strip->strip_len; i++)
{
if (i == j)
{
j += ctx->wave_steps;
tmp_angle = ctx->angle;
}
strip->hsv_vals[i].value = sin_table[tmp_angle]/2;
tmp_angle += 255 / ctx->wave_steps;
//tmp_angle %= 256;
}
ctx->angle += ctx->step;
}
#pragma endregion
#pragma region Constant
void ledFilter_InitConstant(ctx_const_t *ctx)
{
if (ctx->valid != LEDFILTERS_CFG_CHECKWORD)
{
ctx->valid = LEDFILTERS_CFG_CHECKWORD;
ctx->hue = 128;
ctx->sat = 255;
ctx->value = 255;
ctx->enabled = 0;
ctx->update = 0;
cfg_updated = 1;
}
}
void ledFilter_Constant(ctx_const_t *ctx, strip_handler_t *strip)
{
uint32_t i;
if (strip->isEnable == 0)
{
for (i = 0; i < strip->strip_len; i++)
{
if (strip->hsv_vals[i].value > 0)
strip->hsv_vals[i].value--;
}
return;
}
else if (ctx->enabled == 0) return;
if (ctx->update > 0)
{
for (i = 0; i < strip->strip_len; i++)
{
strip->hsv_vals[i].hue = ctx->hue;
strip->hsv_vals[i].sat = ctx->sat;
strip->hsv_vals[i].value = ctx->value;
}
ctx->update = 0;
}
}
#pragma endregion

View file

@ -48,6 +48,9 @@ typedef struct
{
uint8_t enabled;
uint32_t valid;
uint8_t wave_steps;
uint8_t step;
uint8_t angle;
} ctx_wave_t;
#pragma endregion
@ -55,6 +58,10 @@ typedef struct
typedef struct
{
uint8_t enabled;
uint8_t hue;
uint8_t sat;
uint8_t value;
uint8_t update;
uint32_t valid;
} ctx_const_t;
#pragma endregion
@ -66,6 +73,7 @@ typedef struct
uint32_t strip_len;
uint32_t brightness;
uint32_t delay;
uint8_t isEnable;
} strip_handler_t;
int32_t ledFilter_Init(strip_handler_t *strip, ws2812_t *ws2812);
@ -76,7 +84,8 @@ void ledFilter_InitFade(ctx_fade_t *ctx);
void ledFilter_Fade(ctx_fade_t *ctx, strip_handler_t *strip);
void ledFilter_InitWave(ctx_wave_t *ctx);
void ledFilter_Wave(ctx_wave_t *ctx, strip_handler_t *strip);
void ledFilter_InitConstant(ctx_const_t *ctx);
void ledFilter_Constant(ctx_const_t *ctx, strip_handler_t *strip);
void ledFilter_SetDefualtValue(strip_handler_t *strip, uint8_t val);
#endif // _LEDFILTERS_H_

View file

@ -1,6 +1,6 @@
#define UTS_VERSION "2017/12/24-02:16:14"
#define RTL8195AFW_COMPILE_TIME "2017/12/24-02:16:14"
#define RTL8195AFW_COMPILE_DATE "20171224"
#define UTS_VERSION "2017/12/26-19:51:38"
#define RTL8195AFW_COMPILE_TIME "2017/12/26-19:51:38"
#define RTL8195AFW_COMPILE_DATE "20171226"
#define RTL8195AFW_COMPILE_BY "Andrew"
#define RTL8195AFW_COMPILE_HOST ""
#define RTL8195AFW_COMPILE_DOMAIN

View file

@ -77,11 +77,13 @@ extern void console_init(void);
void user_ws_thrd(void)
{
ledEffectsServer_Init();
while (1)
{
if (xSemaphoreTake(sema_WEBReady, 10 * configTICK_RATE_HZ))
{
ledEffectsServer_Init();
ledEffectsServer_Task();
}
WDGRefresh();
}

View file

@ -404,7 +404,26 @@ void ICACHE_FLASH_ATTR web_int_callback(TCP_SERV_CONN *ts_conn, uint8 *cstr)
else ifcmp("max") tcp_puts("%d", filt_fade.max);
else ifcmp("cyclesteps") tcp_puts("%d", filt_fade.steps);
}
else ifcmp("wave_")
{
cstr += 5;
ifcmp("enbl") tcp_puts("%d", filt_wave.enabled);
else ifcmp("step") tcp_puts("%d", filt_wave.step);
else ifcmp("wavesteps") tcp_puts("%d", filt_wave.wave_steps);
}
else ifcmp("const_")
{
cstr += 6;
ifcmp("enbl") tcp_puts("%d", filt_const.enabled);
else ifcmp("hue") tcp_puts("%d", filt_const.hue);
else ifcmp("sat") tcp_puts("%d", filt_const.sat);
else ifcmp("value") tcp_puts("%d", filt_const.value);
}
}
else ifcmp("isenable") tcp_puts("%d", strip.isEnable);
else ifcmp("striplen") tcp_puts("%d", strip.strip_len);
}
// **************************************************************************************************** //
// **************************************************************************************************** //

View file

@ -113,7 +113,27 @@ void ICACHE_FLASH_ATTR web_int_vars(TCP_SERV_CONN *ts_conn, uint8 *pcmd, uint8 *
else ifcmp("max") filt_fade.max = (uint8_t)val;
else ifcmp("cyclesteps") filt_fade.steps = (uint8_t)val;
}
else ifcmp("wave_")
{
cstr += 5;
ifcmp("enbl") filt_wave.enabled = (uint8_t)val;
else ifcmp("step") filt_wave.step = (uint8_t)val;
else ifcmp("wavesteps") filt_wave.wave_steps = (uint8_t)val;
}
else ifcmp("const_")
{
cstr += 6;
ifcmp("enbl") filt_const.enabled = (uint8_t)val;
else ifcmp("hue") filt_const.hue = (uint8_t)val;
else ifcmp("sat") filt_const.sat = (uint8_t)val;
else ifcmp("value") filt_const.value = (uint8_t)val;
else ifcmp("update") filt_const.update = (uint8_t)val;
}
}
else ifcmp("isenable") strip.isEnable = (uint8_t)val;
//else ifcmp("striplen") strip.strip_len = (uint8_t)val;
}
// **************************************************************************************************** //
// **************************************************************************************************** //

View file

@ -10,7 +10,7 @@
// ====================================================================================================================================
// ============================================ Wlan Config ===========================================================================
#define DEF_WIFI_MODE RTW_MODE_STA // Стартовый режим WiFi: RTW_MODE_STA_AP, RTW_MODE_AP, RTW_MODE_STA, RTW_MODE_NONE
#define DEF_WIFI_MODE RTW_MODE_STA_AP // Стартовый режим WiFi: RTW_MODE_STA_AP, RTW_MODE_AP, RTW_MODE_STA, RTW_MODE_NONE
#define DEF_WIFI_AP_STATIONS 3 // Max number of STAs, should be 1..3, default is 3
#define DEF_WIFI_COUNTRY RTW_COUNTRY_RU // Регион использования WiFi...
#define DEF_WIFI_TX_PWR RTW_TX_PWR_PERCENTAGE_12_5 // RTW_TX_PWR_PERCENTAGE_75 // RTW_TX_PWR_PERCENTAGE_100

View file

@ -81,7 +81,6 @@
<None Include="userset.mk" />
<None Include="WEBFiles\elements.css" />
<None Include="WEBFiles\elements.js" />
<None Include="WEBFiles\html5kellycolorpicker.min.js" />
<None Include="WEBFiles\index.html" />
<None Include="webfs.mk" />
</ItemGroup>

View file

@ -38,9 +38,6 @@
<None Include="WEBFiles\elements.js">
<Filter>WEBFiles</Filter>
</None>
<None Include="WEBFiles\html5kellycolorpicker.min.js">
<Filter>WEBFiles</Filter>
</None>
<None Include="WEBFiles\index.html">
<Filter>WEBFiles</Filter>
</None>

View file

@ -1,5 +1,5 @@
define call1
set $ImageSize = 0x3BE0
set $ImageSize = 0x83C0
set $ImageAddr = 0x0D0000
end
define call2

View file

@ -1,17 +1,27 @@
body {font-family: Arial;}
.hblockcont {
text-align:center;
align:center;
}
fieldset {
display: block;
border: 0px;
margin: 20px;
}
.on, .off {
width: 80px;
height: 80px;
}
.range {
max-width: 600px;
}
.tab {
overflow: hidden;
height: 45px;
border: 1px solid #ccc;
background-color: #f1f1f1;
}
@ -49,6 +59,57 @@ fieldset {
border: 1px solid #ccc;
}
.button {
background-color: #00cc99;
border: none;
color: black;
padding: 10px 15px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
}
.select {
//background-color:#00cc99;
width: 180px;
padding: 5px;
font-size: 16px;
border: 1px solid #ccc;
height: 28px;
}
.inputtext {
width: 180px;
font-size: 16px;
border: 1px solid #ccc;
text-align: center;
height: 26px;
}
/* https://www.w3schools.com/html/html_tables.asp */
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
max-width: 500px;
}
.td1st {
border: 0px solid #dddddd;
text-align: left;
padding: 4px;
}
td {
border: 0px solid #dddddd;
text-align: right;
padding: 4px;
}
/* http://dimox.name/custom-checkboxes-and-radio-buttons-using-css-only/ */
.checkbox + label {

View file

@ -38,6 +38,22 @@ function openFilterSettings(chkbx)
sendFilterState(chkbx.name, chkbx.checked);
}
function changeOnOff(field)
{
if (field.className === 'off')
{
sendFilterParam('ws_isenable', "1");
field.src = 'on.gif';
field.className = 'on';
}
else
{
sendFilterParam('ws_isenable', "0");
field.src = 'off.gif';
field.className = 'off';
}
}
function setFormValues(form, cfg)
{
var name, field;
@ -55,6 +71,19 @@ function setFormValues(form, cfg)
field.checked = cfg[name] === '1' ? true : false;
openFilterSettings(field);
}
else if (field.type === 'image')
{
if (cfg[name] == '1')
{
field.src = 'on.gif';
field.className = 'on';
}
else
{
field.src = 'off.gif';
field.className = 'off';
}
}
else
{
field.value = cfg[name];
@ -78,6 +107,65 @@ function sendFilterState(filtName, en)
xhr.send(params);
}
function sendHSV(HSV)
{
var xhr = new XMLHttpRequest();
var hue = Math.round(255 * HSV.h);
var sat = Math.round(255 * HSV.s);
var val = Math.round(255 * HSV.v);
var params = 'ws_filt_const_hue=' + encodeURIComponent(hue) +
'&ws_filt_const_sat=' + encodeURIComponent(sat) +
'&ws_filt_const_value=' + encodeURIComponent(val) +
'&ws_filt_const_update=' + encodeURIComponent('1');
xhr.open("POST", '/index.html', true);
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.onreadystatechange = function () {
};
xhr.send(params);
}
function loadHSV(picker, HSV)
{
var hue = HSV[0] / 255;
var sat = HSV[1] / 255;
var val = HSV[2] / 255;
var rgb = hsvToRgb(hue, sat, val);
var hex = '#' + byteToHex(rgb[0]) + byteToHex(rgb[1]) + byteToHex(rgb[2]);
picker.setColorByHex(hex);
}
function byteToHex(d)
{
var hex = d.toString(16);
hex = "00".substr(0, 2 - hex.length) + hex;
return hex;
}
function hsvToRgb(h, s, v) {
var r, g, b;
var i = Math.floor(h * 6);
var f = h * 6 - i;
var p = v * (1 - s);
var q = v * (1 - f * s);
var t = v * (1 - (1 - f) * s);
switch (i % 6) {
case 0: r = v, g = t, b = p; break;
case 1: r = q, g = v, b = p; break;
case 2: r = p, g = v, b = t; break;
case 3: r = p, g = q, b = v; break;
case 4: r = t, g = p, b = v; break;
case 5: r = v, g = p, b = q; break;
}
return [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255)];
}
function sendFilterParam(filtParam, val)
{
var xhr = new XMLHttpRequest();

View file

@ -1,94 +1,256 @@
<!DOCTYPE html>
<!DOCTYPE html>
<html>
<head>
<link href="elements.css" rel="stylesheet">
<style></style>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Глупая гирлянда</title>
<link href="elements.css" rel="stylesheet">
<style></style>
</head>
<body>
<p align="center">Ãëóïàÿ ãèðëÿíäà</p>
<div class="tab" align="center">
<button class="tablinks" onclick="openTab(event, 0)">Ôèëüòðû</button>
<button class="tablinks" onclick="openTab(event, 1)">?</button>
<button class="tablinks" onclick="openTab(event, 2)">Íàñòðîéêè</button>
<div class="hblockcont">
<input type="image" src="off.gif" class='off' name='ws_isenable' onclick="changeOnOff(this)" />
</div>
<div class="tab" align="center">
<button class="tablinks" onclick="openTab(event, 0)">Режим работы</button>
<button class="tablinks" onclick="openTab(event, 1)">Настройки Wi-Fi</button>
</div>
<div id="0" class="tabcontent" align="center">
<form method="post">
<fieldset>
<input type="checkbox" class="checkbox" id="filt0" name='ws_filt_rbw_enbl' onclick="openFilterSettings(this)" />
<label for="filt0">Ðàäóãà</label>
<label for="filt0">Радуга</label>
<input type="checkbox" class="checkbox" id="filt1" name='ws_filt_const_enbl' onclick="openFilterSettings(this)" />
<label for="filt1">Îòòåíîê</label>
<label for="filt1">Оттенок</label>
<input type="checkbox" class="checkbox" id="filt2" name='ws_filt_fd_enbl' onclick="openFilterSettings(this)" />
<label for="filt2">Âûöâåòàíèå</label>
<label for="filt2">Выцветание</label>
<input type="checkbox" class="checkbox" id="filt3" name='ws_filt_wave_enbl' onclick="openFilterSettings(this)" />
<label for="filt3">Âîëíà</label>
<label for="filt3">Волна</label>
</fieldset>
<div id="filt0" class="filtercontent">
<h4 align="center">Ðàäóãà</h4>
Ðàçìåñòèòü ïîëíóþ ðàäóãó íà ïèêñåëÿõ, åä. :<br>
<input type="range" class="range" step="1" min="10" name='ws_filt_rbw_huesteps' max="400" onchange="sendFilterParam(this.name, this.value)"/><br>
Ñêîðîñòü ñìåíû îòòåíêà:<br>
<h4 align="center">Радуга</h4>
Разместить полную радугу на пикселях, ед. :<br>
<input type="range" class="range" step="1" min="10" name='ws_filt_rbw_huesteps' max="~ws_striplen~" onchange="sendFilterParam(this.name, this.value)"/><br>
Скорость смены оттенка:<br>
<input type="range" class="range" min="1" name='ws_filt_rbw_cyclesteps' max="10" onchange="sendFilterParam(this.name, this.value)"/><br>
</div>
<div id="filt1" class="filtercontent">
<h4 align="center">Îòòåíîê</h4>
<h4 align="center">Оттенок</h4>
<canvas id="picker"></canvas><br>
<input id="color" value="#54aedb">
<input id="color" value="#007fff">
</div>
<div id="filt2" class="filtercontent">
<h4 align="center">Âûöâåòàíèå</h4>
Ñêîðîñòü ñìåíû ÿðêîñòè:<br>
<input type="range" class="range" min="1" name='ws_filt_fd_cyclesteps' max="254" onchange="sendFilterParam(this.name, this.value)"/><br>
Ìèíèìàëüíàÿ ÿðêîñòü:<br>
<h4 align="center">Выцветание</h4>
Скорость смены яркости:<br>
<input type="range" class="range" min="1" name='ws_filt_fd_cyclesteps' max="127" onchange="sendFilterParam(this.name, this.value)"/><br>
Минимальная яркость:<br>
<input type="range" class="range" min="0" name='ws_filt_fd_min' max="254" onchange="sendFilterParam(this.name, this.value)"/><br>
Ìàêñèìàëüíàÿ ÿðêîñòü:<br>
Максимальная яркость:<br>
<input type="range" class="range" min="1" name='ws_filt_fd_max' max="255" onchange="sendFilterParam(this.name, this.value)"/><br>
Øàíñ ñðàáàòûâàíèÿ:<br>
<!--
Шанс срабатывания:<br>
<input type="range" class="range" min="1" name='ws_filt_fd_chance' onchange="sendFilterParam(this.name, this.value)"/><br>
-->
</div>
<div id="filt3" class="filtercontent">
<h4 align="center">Âîëíà</h4>
<h4 align="center">Волна</h4>
Скорость:<br>
<input type="range" class="range" min="1" name='ws_filt_wave_step' max="10" onchange="sendFilterParam(this.name, this.value)" /><br>
Длина волны :<br>
<input type="range" class="range" step="1" min="10" max="128" name='ws_filt_wave_wavesteps' max="~ws_striplen~" onchange="sendFilterParam(this.name, this.value)"/><br>
</div>
</form>
</div>
<div id="1" class="tabcontent" align="center">
<h3>Íè÷åãî</h3>
<form method="post">
<table>
<tr>
<td class="td1st">Режим Wi-Fi</td>
<td>
<select class="select" name='wifi_mode'>
<option value='1'>Клиент</option>
<option value='2'>Точка доступа</option>
<option value='3'>Клиент + Точка доступа</option>
</select>
</td>
</tr>
<tr>
<td class="td1st">IEEE PHY</td>
<td>
<select class="select" name='wifi_bgn'>
<option value='1'>802.11b</option>
<option value='3'>802.11g</option>
<option value='11'>802.11n</option>
</select>
</td>
</tr>
<tr>
<td class="td1st">Мощность передачи</td>
<td>
<select class="select" name='wifi_txpow'>
<option value='0'>100%</option>
<option value='1'>75%</option>
<option value='2'>50%</option>
<option value='3'>25%</option>
<option value='4'>12.5%</option>
</select>
</td>
</tr>
<tr>
<td class="td1st"><b>Настройки клиента:</b></td>
</tr>
<tr>
<td class="td1st">SSID</td>
<td>
<input name="wifi_st_ssid" class="inputtext" maxlength='31' value='~wifi_st_ssid~'/>
</td>
</tr>
<tr>
<td class="td1st">Пароль</td>
<td>
<input name="wifi_st_psw" class="inputtext" maxlength='63' value='~wifi_st_psw~' />
</td>
</tr>
<tr>
<td class="td1st">Аутентификация</td>
<td>
<select class="select" name='wifi_st_auth'>
<option value='0'>Open</option>
<option value='1'>WEP PSK</option>
<option value='2'>WEP Shared</option>
<option value='3'>WPA TKIP</option>
<option value='4'>WPA AES</option>
<option value='5'>WPA2 TKIP</option>
<option value='6'>WPA2 AES</option>
<option value='7'>WPA2 Mixed</option>
<option value='8'>WPA2/WPA AES</option>
<option value='9'>Unknown</option>
</select>
</td>
</tr>
<tr>
<td class="td1st">IP</td>
<td>
<input name="wifi_st_ip" class="inputtext" maxlength='31' value='~wifi_st_ip~' />
</td>
</tr>
<tr>
<td class="td1st"><b>Настройки точки доступа:</b></td>
</tr>
<tr>
<td class="td1st">SSID</td>
<td>
<input name="wifi_ap_ssid" class="inputtext" maxlength='31' value='~wifi_ap_ssid~' />
</td>
</tr>
<tr>
<td class="td1st">Пароль</td>
<td>
<input name="wifi_ap_psw" class="inputtext" maxlength='63' value='~wifi_ap_psw~' />
</td>
</tr>
<tr>
<td class="td1st">Аутентификация</td>
<td>
<select class="select" name='wifi_ap_auth'>
<option value='0'>Open</option>
<option value='1'>WPA_WPA2_PSK</option>
</select>
</td>
</tr>
<tr>
<td class="td1st">IP</td>
<td>
<input name="wifi_ap_ip" class="inputtext" maxlength='31' value='~wifi_ap_ip~' />
</td>
</tr>
<tr>
<td></td>
<td>
<input type='hidden' name='wifi_newcfg' value='0xffff' />
<button class="button">Применить...</button>
</td>
</tr>
</table>
</form>
</div>
<div id="2" class="tabcontent">
<h3>Íàñòðîéêè</h3>
</div>
<script src="html5kellycolorpicker.min.js"></script>
<script src="colorpicker.min.js"></script>
<script src="elements.js"></script>
<script type="text/javascript">
/* https://github.com/NC22/HTML5-Color-Picker/wiki/Документация */
var colorPickerT = new KellyColorPicker(
{
place: 'picker',
input: 'color',
size: 300,
});
new KellyColorPicker({place : 'picker', input : 'color', size : 300});
var onchange = function (self)
{
var hsv = colorPickerT.getCurColorHsv();
sendHSV(hsv);
};
//colorPickerT.addUserEvent("change", onchange);
colorPickerT.addUserEvent("mouseuph", onchange);
colorPickerT.addUserEvent("mouseupsv", onchange);
var cfg =
{
ws_filt_rbw_enbl: "~ws_filt_rbw_enbl~",
ws_filt_flick_enbl: "~ws_filt_flick_enbl~",
ws_filt_fd_enbl: "~ws_filt_fd_enbl~",
ws_filt_rbw_huesteps: "~ws_filt_rbw_huesteps~",
ws_filt_rbw_cyclesteps: "~ws_filt_rbw_cyclesteps~",
ws_filt_fd_cyclesteps: "~ws_filt_fd_cyclesteps~",
ws_filt_fd_min: "~ws_filt_fd_min~",
ws_filt_fd_max: "~ws_filt_fd_max~",
ws_filt_fd_chance: "~ws_filt_fd_chance~"
}
setFormValues(document.forms[0], cfg);
var cfg_f0 =
{
ws_isenable: "~ws_isenable~",
}
setFormValues(document.getElementsByName("ws_isenable"), cfg_f0);
var cfg_f1 =
{
ws_filt_rbw_enbl: "~ws_filt_rbw_enbl~",
ws_filt_rbw_huesteps: "~ws_filt_rbw_huesteps~",
ws_filt_rbw_cyclesteps: "~ws_filt_rbw_cyclesteps~",
ws_filt_fd_enbl: "~ws_filt_fd_enbl~",
ws_filt_fd_cyclesteps: "~ws_filt_fd_cyclesteps~",
ws_filt_fd_min: "~ws_filt_fd_min~",
ws_filt_fd_max: "~ws_filt_fd_max~",
//ws_filt_fd_chance: "~ws_filt_fd_chance~",
ws_filt_wave_enbl: "~ws_filt_wave_enbl~",
ws_filt_wave_step: "~ws_filt_wave_step~",
ws_filt_wave_wavesteps: "~ws_filt_wave_wavesteps~"
}
setFormValues(document.forms[0], cfg_f1);
var cfg_f2 =
{
wifi_mode: "~wifi_mode~",
wifi_bgn: "~wifi_bgn~",
wifi_txpow: "~wifi_txpow~",
wifi_st_ssid: "~wifi_st_ssid~",
wifi_st_psw: "~wifi_st_psw~",
wifi_st_auth: "~wifi_st_auth~",
wifi_st_ip: "~wifi_st_ip~",
wifi_ap_ssid: "~wifi_ap_ssid~",
wifi_ap_psw: "~wifi_ap_psw~",
wifi_ap_auth: "~wifi_ap_auth~",
wifi_ap_ip: "~wifi_ap_ip~"
}
setFormValues(document.forms[1], cfg_f2);
var cfg_hsv =
{
ws_filt_const_hue: "~ws_filt_const_hue~",
ws_filt_const_sat: "~ws_filt_const_sat~",
ws_filt_const_value: "~ws_filt_const_value~"
}
loadHSV(colorPickerT, cfg_hsv);
</script>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Binary file not shown.

View file

@ -96,7 +96,7 @@ AnnotateStartValue=1
AnnotationIndexControlEnabled=0
AnnotateSuffix=
AnnotateScope=All
AnnotateOrder=-1
AnnotateOrder=0
DoLibraryUpdate=1
DoDatabaseUpdate=1
ClassGenCCAutoEnabled=0
@ -133,7 +133,7 @@ Value=A_D.000000.001
[Parameter3]
Name=GlobalProjectName
Value=RTL-00 WS2812
Value=Ãëóïàÿ ãèðëÿíäà
[Parameter4]
Name=GlobalOrganizationName
@ -785,11 +785,6 @@ OutputName3=AutoCAD dwg/dxf File Schematic
OutputDocumentPath3=
OutputVariantName3=
OutputDefault3=0
OutputType4=ExportIDF
OutputName4=Export IDF
OutputDocumentPath4=
OutputVariantName4=
OutputDefault4=0
[Modification Levels]
Type1=1

Binary file not shown.