change sleepcycle to 16bit * 10
This commit is contained in:
		
							parent
							
								
									b5314f1288
								
							
						
					
					
						commit
						295494bd81
					
				@ -530,8 +530,8 @@ Send for example `8386` as Downlink on Port 2 to get battery status and time/dat
 | 
			
		||||
 | 
			
		||||
0x19 set sleep cycle
 | 
			
		||||
 | 
			
		||||
	0 ... 255 device sleep cycle in seconds/2
 | 
			
		||||
	e.g. 120 -> device sleeps 240 seconds after each send cycle [default = 0]
 | 
			
		||||
	bytes 1..2 = device sleep cycle in seconds/10 (MSB)
 | 
			
		||||
	e.g. {0x04, 0xB0} -> device sleeps 20 minutes after each send cycle [default = 0]
 | 
			
		||||
 | 
			
		||||
0x20 load device configuration
 | 
			
		||||
 | 
			
		||||
@ -585,7 +585,7 @@ Send for example `8386` as Downlink on Port 2 to get battery status and time/dat
 | 
			
		||||
 | 
			
		||||
0x88 set time/date
 | 
			
		||||
 | 
			
		||||
	bytes 1..4 = time/date to set in UTC epoch seconds (LSB, e.g. https://www.epochconverter.com/hex)
 | 
			
		||||
	bytes 1..4 = time/date to set in UTC epoch seconds (MSB, e.g. https://www.epochconverter.com/hex)
 | 
			
		||||
	
 | 
			
		||||
# License
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -75,7 +75,7 @@ typedef struct __attribute__((packed)) {
 | 
			
		||||
  uint8_t countermode; // 0=cyclic unconfirmed, 1=cumulative, 2=cyclic confirmed
 | 
			
		||||
  int16_t rssilimit;   // threshold for rssilimiter, negative value!
 | 
			
		||||
  uint8_t sendcycle;   // payload send cycle [seconds/2]
 | 
			
		||||
  uint8_t sleepcycle;  // sleep cycle [seconds/2]
 | 
			
		||||
  uint16_t sleepcycle; // sleep cycle [seconds/10]
 | 
			
		||||
  uint8_t wifichancycle; // wifi channel switch cycle [seconds/100]
 | 
			
		||||
  uint8_t blescantime;   // BLE scan cycle duration [seconds]
 | 
			
		||||
  uint8_t blescan;       // 0=disabled, 1=enabled
 | 
			
		||||
 | 
			
		||||
@ -42,7 +42,7 @@ static void defaultConfig(configData_t *myconfig) {
 | 
			
		||||
      COUNTERMODE;                 // 0=cyclic, 1=cumulative, 2=cyclic confirmed
 | 
			
		||||
  myconfig->rssilimit = 0;         // threshold for rssilimiter, negative value!
 | 
			
		||||
  myconfig->sendcycle = SENDCYCLE; // payload send cycle [seconds/2]
 | 
			
		||||
  myconfig->sleepcycle = SLEEPCYCLE; // sleep cycle [seconds/2]
 | 
			
		||||
  myconfig->sleepcycle = SLEEPCYCLE; // sleep cycle [seconds/10]
 | 
			
		||||
  myconfig->wifichancycle =
 | 
			
		||||
      WIFI_CHANNEL_SWITCH_INTERVAL; // wifi channel switch cycle [seconds/100]
 | 
			
		||||
  myconfig->blescantime =
 | 
			
		||||
 | 
			
		||||
@ -90,9 +90,9 @@ void irqHandler(void *pvParameters) {
 | 
			
		||||
      // goto sleep if we have a sleep cycle
 | 
			
		||||
      if (cfg.sleepcycle)
 | 
			
		||||
#ifdef HAS_BUTTON
 | 
			
		||||
        enter_deepsleep(cfg.sleepcycle * 2, (gpio_num_t)HAS_BUTTON);
 | 
			
		||||
        enter_deepsleep(cfg.sleepcycle * 10, (gpio_num_t)HAS_BUTTON);
 | 
			
		||||
#else
 | 
			
		||||
        enter_deepsleep(cfg.sleepcycle * 2);
 | 
			
		||||
        enter_deepsleep(cfg.sleepcycle * 10);
 | 
			
		||||
#endif
 | 
			
		||||
    }
 | 
			
		||||
  } // for
 | 
			
		||||
 | 
			
		||||
@ -14,7 +14,7 @@
 | 
			
		||||
 | 
			
		||||
// Payload send cycle and encoding
 | 
			
		||||
#define SENDCYCLE                       30      // payload send cycle [seconds/2], 0 .. 255
 | 
			
		||||
#define SLEEPCYCLE                      0       // sleep time after a send cycle [seconds/2], 0 .. 255; 0 means no sleep [default = 0]
 | 
			
		||||
#define SLEEPCYCLE                      0       // sleep time after a send cycle [seconds/10], 0 .. 65535; 0 means no sleep [default = 0]
 | 
			
		||||
#define PAYLOAD_ENCODER                 2       // payload encoder: 1=Plain, 2=Packed, 3=Cayenne LPP dynamic, 4=Cayenne LPP packed
 | 
			
		||||
#define COUNTERMODE                     0       // 0=cyclic, 1=cumulative, 2=cyclic confirmed
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -68,9 +68,11 @@ void set_sendcycle(uint8_t val[]) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void set_sleepcycle(uint8_t val[]) {
 | 
			
		||||
  cfg.sleepcycle = val[0];
 | 
			
		||||
  // swap byte order from msb to lsb, note: this is a platform dependent hack
 | 
			
		||||
  uint16_t t = __builtin_bswap16(*(uint16_t *)(val));
 | 
			
		||||
  cfg.sleepcycle = t;
 | 
			
		||||
  ESP_LOGI(TAG, "Remote command: set sleep cycle to %d seconds",
 | 
			
		||||
           cfg.sleepcycle * 2);
 | 
			
		||||
           cfg.sleepcycle * 10);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void set_wifichancycle(uint8_t val[]) {
 | 
			
		||||
@ -435,7 +437,7 @@ static const cmd_t table[] = {
 | 
			
		||||
    {0x13, set_sensor, 2},        {0x14, set_payloadmask, 1},
 | 
			
		||||
    {0x15, set_bme, 1},           {0x16, set_batt, 1},
 | 
			
		||||
    {0x17, set_wifiscan, 1},      {0x18, set_enscount, 1},
 | 
			
		||||
    {0x19, set_sleepcycle, 1},    {0x20, set_loadconfig, 0},
 | 
			
		||||
    {0x19, set_sleepcycle, 2},    {0x20, set_loadconfig, 0},
 | 
			
		||||
    {0x21, set_saveconfig, 0},    {0x80, get_config, 0},
 | 
			
		||||
    {0x81, get_status, 0},        {0x83, get_batt, 0},
 | 
			
		||||
    {0x84, get_gps, 0},           {0x85, get_bme, 0},
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user