Yurik72/ESPHap

ESP-01 keeps restarting with INIT_CHARACHTERISTIC_VAL

Closed this issue · 1 comments

I'm using the ESPhapled2866 example with no modification, Everything works fine. However, when I add the initial value code to my sketch I still get the light button active and once I press it the ESP keeps restarting:
Here is the code I modified:

if(hapservice){
 Serial.println("notify hap"); 
 //getting on/off characteristic
 homekit_characteristic_t * ch= homekit_service_characteristic_by_type(hapservice, HOMEKIT_CHARACTERISTIC_ON);
 INIT_CHARACHTERISTIC_VAL(bool,ch,false);
 if(ch){
     Serial.println("found characteristic"); 
     if(ch->value.bool_value!=val){  //wil notify only if different
       ch->value.bool_value=val;
       homekit_characteristic_notify(ch,ch->value);
     }
 }
}

Here is the serial output:

18:53:30.004 -> led_callback
18:53:30.004 -> set_led
18:53:30.004 -> notify hap
18:53:30.004 -> found characteristic
18:53:30.004 -> led_callback
18:53:30.004 -> set_led
18:53:30.004 -> notify hap
18:53:31.756 -> --------------- CUT HERE FOR EXCEPTION DECODER ---------------
18:53:31.756 -> 
18:53:31.756 -> Soft WDT reset
18:53:31.756 -> 
18:53:31.756 -> >>>stack>>>
18:53:31.756 -> 
18:53:31.756 -> ctx: sys
18:53:31.756 -> sp: 3fff06f0 end: 3fffffb0 offset: 01a0
18:53:31.756 -> 3fff0890:  4021d703 3ffe8b7c 3fff08a8 4021d703  
18:53:31.756 -> 3fff08a0:  3fff08a8 00000001 3fff08a8 4021d730  
18:53:31.756 -> 3fff08b0:  3fff08a8 00000000 3fff08a8 4021d80d  
18:53:31.756 -> 3fff08c0:  3ffeb348 00000001 3fff3bcc 40216c49  
18:53:31.756 -> 3fff08d0:  3fff08a8 3fff3bcc 3fff3bcc 40216cce  
18:53:31.756 -> 3fff08e0:  4021d11c 3ffe9b26 3fff08a8 4021d70c  
18:53:31.809 -> 3fff08f0:  3fff08a8 00000000 3fff3c38 40216260  
18:53:31.809 -> 3fff0900:  40233100 3fff1401 3fff1430 4021d814  
18:53:31.809 -> 3fff0910:  3fff08a8 00000001 3fff3bcc 40216ca0  
18:53:31.809 -> 3fff0920:  3fff08a8 3fff3bcc 3fff3bcc 40216cce  
18:53:31.809 -> 3fff0930:  4021d11c 3ffe9b26 3fff08a8 4021d70c  
18:53:31.809 -> 3fff0940:  3fff08a8 00000000 3fff3c38 40216260  

closing the issue as it can be achieved with
hap_setinitial_characteristic_bool_value(hapservice,HOMEKIT_CHARACTERISTIC_ON,false);