Merge pull request #20 from cyberman54/test

sync Test to Master
This commit is contained in:
Verkehrsrot 2018-04-03 11:09:13 +02:00 committed by GitHub
commit 672b510ba4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 35 additions and 38 deletions

View File

@ -110,7 +110,7 @@ void saveConfig() {
nvs_set_i8(my_handle, "blescantime", cfg.blescantime);
if( nvs_get_i8(my_handle, "blescancycle", &flash8) != ESP_OK || flash8 != cfg.blescancycle )
nvs_set_i8(my_handle, "blescantime", cfg.blescancycle);
nvs_set_i8(my_handle, "blescancycle", cfg.blescancycle);
if( nvs_get_i8(my_handle, "blescanmode", &flash8) != ESP_OK || flash8 != cfg.blescan )
nvs_set_i8(my_handle, "blescanmode", cfg.blescan);

View File

@ -34,7 +34,7 @@ typedef struct {
int8_t blescancycle; // BLE scan frequency, once after [blescancycle] full wifi scans
int8_t blescan; // 0=disabled, 1=enabled
int8_t wifiant; // 0=internal, 1=external (for LoPy/LoPy4)
int8_t rgblum; // RGB Led luminosity (0 100%)
int8_t rgblum; // RGB Led luminosity (0..100%)
char version[10]; // Firmware version
} configData_t;

View File

@ -136,7 +136,7 @@ static void lora_init (osjob_t* j) {
LMIC_startJoining();
}
// LMIC Task
// LMIC FreeRTos Task
void lorawan_loop(void * pvParameters) {
configASSERT( ( ( uint32_t ) pvParameters ) == 1 ); // FreeRTOS check
@ -152,24 +152,25 @@ void lorawan_loop(void * pvParameters) {
// is prior to send because joining state send data
if ( LMIC.opmode & (OP_JOINING | OP_REJOIN) ) {
color = COLOR_YELLOW;
// Joining Quick blink 20ms on each 1/5 second
// quick blink 20ms on each 1/5 second
new_led_state = ((millis() % 200) < 20) ? HIGH : LOW;
// Small blink 10ms on each 1/2sec (not when joining)
// TX data pending
} else if (LMIC.opmode & (OP_TXDATA | OP_TXRXPEND)) {
color = COLOR_BLUE;
// small blink 10ms on each 1/2sec (not when joining)
new_led_state = ((millis() % 500) < 20) ? HIGH : LOW;
// This should not happen so indicate a pb
// This should not happen so indicate a problem
} else if ( LMIC.opmode & (OP_TXDATA | OP_TXRXPEND | OP_JOINING | OP_REJOIN) == 0 ) {
color = COLOR_RED;
// Heartbeat long blink 200ms on each 2 seconds
// heartbeat long blink 200ms on each 2 seconds
new_led_state = ((millis() % 2000) < 200) ? HIGH : LOW;
} else {
// led off
rgb_set_color(COLOR_NONE);
}
// led need to change state ?
// avoid digitalWrite() for nothing
// led need to change state? avoid digitalWrite() for nothing
if (led_state != new_led_state) {
if (new_led_state == HIGH) {
set_onboard_led(1);
@ -308,11 +309,10 @@ void wifi_sniffer_loop(void * pvParameters) {
u8x8.setPowerSave(1 && cfg.screensaver); // set display off if screensaver is enabled
} // end of send data cycle
else {
#ifdef BLECOUNTER // execute BLE count if BLE function is enabled
if (nloop % (WIFI_CHANNEL_MAX * cfg.blescancycle) == 0 ) { // once after cfg.blescancycle Wifi scans, do a BLE scan
#ifdef BLECOUNTER
if (nloop % (WIFI_CHANNEL_MAX * cfg.blescancycle) == 0 ) // once after cfg.blescancycle Wifi scans, do a BLE scan
if (cfg.blescan) // execute BLE count if BLE function is enabled
BLECount();
}
#endif
} // end of channel rotation loop
} // end of infinite wifi scan loop

View File

@ -1,5 +1,5 @@
// program version
#define PROGVERSION "1.2.85" // use max 10 chars here!
// program version - note: increment version after modifications to configData_t struct!!
#define PROGVERSION "1.2.87" // use max 10 chars here!
#define PROGNAME "PAXCNT"
// Verbose enables serial output

View File

@ -7,9 +7,6 @@
// RGB Led instance
SmartLed rgb_led(LED_WS2812, 1, HAS_RGB_LED);
// Luminosity from 0 to 100%
uint8_t rgb_luminosity = 50 ;
float rgb_CalcColor(float p, float q, float t)
{
if (t < 0.0f)
@ -70,7 +67,7 @@ void rgb_set_color(uint16_t hue) {
// H (is color from 0..360) should be between 0.0 and 1.0
// S is saturation keep it to 1
// L is brightness should be between 0.0 and 0.5
// rgb_luminosity is between 0 and 100 (percent)
// cfg.rgblum is between 0 and 100 (percent)
RGBColor target = rgb_hsl2rgb( hue / 360.0f, 1.0f, 0.005f * cfg.rgblum);
//uint32_t color = target.R<<16 | target.G<<8 | target.B;
rgb_led[0] = Rgb(target.R, target.G, target.B);