Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
c7d548a7cc
@ -110,7 +110,7 @@ void saveConfig() {
|
|||||||
nvs_set_i8(my_handle, "blescantime", cfg.blescantime);
|
nvs_set_i8(my_handle, "blescantime", cfg.blescantime);
|
||||||
|
|
||||||
if( nvs_get_i8(my_handle, "blescancycle", &flash8) != ESP_OK || flash8 != cfg.blescancycle )
|
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 )
|
if( nvs_get_i8(my_handle, "blescanmode", &flash8) != ESP_OK || flash8 != cfg.blescan )
|
||||||
nvs_set_i8(my_handle, "blescanmode", cfg.blescan);
|
nvs_set_i8(my_handle, "blescanmode", cfg.blescan);
|
||||||
|
@ -34,7 +34,7 @@ typedef struct {
|
|||||||
int8_t blescancycle; // BLE scan frequency, once after [blescancycle] full wifi scans
|
int8_t blescancycle; // BLE scan frequency, once after [blescancycle] full wifi scans
|
||||||
int8_t blescan; // 0=disabled, 1=enabled
|
int8_t blescan; // 0=disabled, 1=enabled
|
||||||
int8_t wifiant; // 0=internal, 1=external (for LoPy/LoPy4)
|
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
|
char version[10]; // Firmware version
|
||||||
} configData_t;
|
} configData_t;
|
||||||
|
|
||||||
|
20
src/main.cpp
20
src/main.cpp
@ -136,7 +136,7 @@ static void lora_init (osjob_t* j) {
|
|||||||
LMIC_startJoining();
|
LMIC_startJoining();
|
||||||
}
|
}
|
||||||
|
|
||||||
// LMIC Task
|
// LMIC FreeRTos Task
|
||||||
void lorawan_loop(void * pvParameters) {
|
void lorawan_loop(void * pvParameters) {
|
||||||
configASSERT( ( ( uint32_t ) pvParameters ) == 1 ); // FreeRTOS check
|
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
|
// is prior to send because joining state send data
|
||||||
if ( LMIC.opmode & (OP_JOINING | OP_REJOIN) ) {
|
if ( LMIC.opmode & (OP_JOINING | OP_REJOIN) ) {
|
||||||
color = COLOR_YELLOW;
|
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;
|
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)) {
|
} else if (LMIC.opmode & (OP_TXDATA | OP_TXRXPEND)) {
|
||||||
color = COLOR_BLUE;
|
color = COLOR_BLUE;
|
||||||
|
// small blink 10ms on each 1/2sec (not when joining)
|
||||||
new_led_state = ((millis() % 500) < 20) ? HIGH : LOW;
|
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 ) {
|
} else if ( LMIC.opmode & (OP_TXDATA | OP_TXRXPEND | OP_JOINING | OP_REJOIN) == 0 ) {
|
||||||
color = COLOR_RED;
|
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;
|
new_led_state = ((millis() % 2000) < 200) ? HIGH : LOW;
|
||||||
} else {
|
} else {
|
||||||
|
// led off
|
||||||
rgb_set_color(COLOR_NONE);
|
rgb_set_color(COLOR_NONE);
|
||||||
}
|
}
|
||||||
// led need to change state ?
|
// led need to change state? avoid digitalWrite() for nothing
|
||||||
// avoid digitalWrite() for nothing
|
|
||||||
if (led_state != new_led_state) {
|
if (led_state != new_led_state) {
|
||||||
if (new_led_state == HIGH) {
|
if (new_led_state == HIGH) {
|
||||||
set_onboard_led(1);
|
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
|
u8x8.setPowerSave(1 && cfg.screensaver); // set display off if screensaver is enabled
|
||||||
} // end of send data cycle
|
} // end of send data cycle
|
||||||
else {
|
else {
|
||||||
#ifdef BLECOUNTER // execute BLE count if BLE function is enabled
|
#ifdef BLECOUNTER
|
||||||
if (nloop % (WIFI_CHANNEL_MAX * cfg.blescancycle) == 0 ) { // once after cfg.blescancycle Wifi scans, do a BLE scan
|
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
|
if (cfg.blescan) // execute BLE count if BLE function is enabled
|
||||||
BLECount();
|
BLECount();
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
} // end of channel rotation loop
|
} // end of channel rotation loop
|
||||||
} // end of infinite wifi scan loop
|
} // end of infinite wifi scan loop
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// program version
|
// program version - note: increment version after modifications to configData_t struct!!
|
||||||
#define PROGVERSION "1.2.85" // use max 10 chars here!
|
#define PROGVERSION "1.2.87" // use max 10 chars here!
|
||||||
#define PROGNAME "PAXCNT"
|
#define PROGNAME "PAXCNT"
|
||||||
|
|
||||||
// Verbose enables serial output
|
// Verbose enables serial output
|
||||||
|
@ -7,9 +7,6 @@
|
|||||||
// RGB Led instance
|
// RGB Led instance
|
||||||
SmartLed rgb_led(LED_WS2812, 1, HAS_RGB_LED);
|
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)
|
float rgb_CalcColor(float p, float q, float t)
|
||||||
{
|
{
|
||||||
if (t < 0.0f)
|
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
|
// H (is color from 0..360) should be between 0.0 and 1.0
|
||||||
// S is saturation keep it to 1
|
// S is saturation keep it to 1
|
||||||
// L is brightness should be between 0.0 and 0.5
|
// 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);
|
RGBColor target = rgb_hsl2rgb( hue / 360.0f, 1.0f, 0.005f * cfg.rgblum);
|
||||||
//uint32_t color = target.R<<16 | target.G<<8 | target.B;
|
//uint32_t color = target.R<<16 | target.G<<8 | target.B;
|
||||||
rgb_led[0] = Rgb(target.R, target.G, target.B);
|
rgb_led[0] = Rgb(target.R, target.G, target.B);
|
||||||
|
Loading…
Reference in New Issue
Block a user