@@ -149,7 +149,7 @@ namespace ratgdo {
149149 this ->door_position = 0.0 ;
150150 if (this ->clear_TTC_ ) {
151151 // TODO this send_command gets sent same time as GET_OPENINGS on line 189
152- this ->send_command (Command::CANCEL_TTC , data::CANCEL_TTC_OFF );
152+ this ->send_command (Command::TTC_CANCEL , data::TTC_CANCEL_OFF );
153153 this ->clear_TTC_ = false ;
154154 }
155155 } else {
@@ -227,7 +227,7 @@ namespace ratgdo {
227227 this ->send_command (Command::GET_STATUS);
228228 }
229229 ESP_LOGD (TAG, " Motion: %s" , MotionState_to_string (*this ->motion_state ));
230- } else if (cmd == Command::SET_TTC_DURATION ) {
230+ } else if (cmd == Command::TTC_SET_DURATION ) {
231231 auto seconds = (byte1 << 8 ) | byte2;
232232 ESP_LOGD (TAG, " Time to close (TTC) update request: %ds" , seconds);
233233 } else if (cmd == Command::TTC_DURATION) {
@@ -236,13 +236,13 @@ namespace ratgdo {
236236 } else if (cmd == Command::TTC_COUNTDOWN) {
237237 auto seconds = (byte1 << 8 ) | byte2;
238238 ESP_LOGD (TAG, " (TTC) door will close in: %ds" , seconds);
239- } else if (cmd == Command::CANCEL_TTC ) {
239+ } else if (cmd == Command::TTC_CANCEL ) {
240240 if (byte1 == 0x04 ) {
241- ESP_LOGD (TAG, " CANCEL_TTC : Auto Hold Toggled" );
241+ ESP_LOGD (TAG, " TTC : Auto Hold Toggled" );
242242 } else if (byte1 == 0x05 ) {
243- ESP_LOGD (TAG, " CANCEL_TTC : Disabled" );
243+ ESP_LOGD (TAG, " TTC : Disabled" );
244244 } else {
245- ESP_LOGD (TAG, " CANCEL_TTC : Unknown Data" );
245+ ESP_LOGD (TAG, " TTC_CANCEL : Unknown Data" );
246246 }
247247 }
248248
@@ -401,10 +401,7 @@ namespace ratgdo {
401401
402402 void RATGDOComponent::query_status ()
403403 {
404- // send_command(Command::GET_STATUS);
405-
406- // TODO revert testing
407- send_command (Command::GET_TTC_DURATION, data::GET_TTC_DURATION);
404+ send_command (Command::GET_STATUS);
408405 }
409406
410407 void RATGDOComponent::query_openings ()
@@ -415,14 +412,65 @@ namespace ratgdo {
415412 void RATGDOComponent::close_with_alert ()
416413 {
417414 // TODO check if door is closed and ignore
418- // TODO check if this will work with door partially open
415+ // Only works if fully open
419416
420417 // SET_TTC closes door in 1 second with light and beeper
421- send_command (Command::SET_TTC_DURATION, data::TTC_BEEF);
422-
423- // this->clear_TTC_ = true;
418+ send_command (Command::TTC_SET_DURATION, data::TTC_1_SEC);
419+ this ->clear_TTC_ = true ;
424420 }
425421
422+ void RATGDOComponent::get_ttc_duration ()
423+ {
424+ send_command (Command::TTC_GET_DURATION, data::TTC_GET_DURATION);
425+ }
426+
427+ void RATGDOComponent::turn_ttc_off ()
428+ {
429+ send_command (Command::TTC_CANCEL, data::TTC_CANCEL_OFF);
430+ }
431+
432+ void RATGDOComponent::ttc_toggle_hold ()
433+ {
434+ send_command (Command::TTC_CANCEL, data::TTC_CANCEL_TOGGLE_HOLD);
435+ }
436+
437+ void RATGDOComponent::set_ttc_1_min ()
438+ {
439+ send_command (Command::TTC_SET_DURATION, data::TTC_1_MIN);
440+ }
441+
442+ void RATGDOComponent::set_ttc_5_min ()
443+ {
444+ send_command (Command::TTC_SET_DURATION, data::TTC_5_MIN);
445+ }
446+
447+ void RATGDOComponent::set_ttc_10_min ()
448+ {
449+ send_command (Command::TTC_SET_DURATION, data::TTC_10_MIN);
450+ }
451+
452+ void RATGDOComponent::set_ttc_beef ()
453+ {
454+ send_command (Command::TTC_SET_DURATION, data::TTC_BEEF);
455+ }
456+
457+ void RATGDOComponent::set_ttc_0_sec ()
458+ {
459+ send_command (Command::TTC_SET_DURATION, data::TTC_0_SEC);
460+ }
461+
462+ void RATGDOComponent::set_ttc_1_sec ()
463+ {
464+ send_command (Command::TTC_SET_DURATION, data::TTC_1_SEC);
465+ }
466+
467+ void RATGDOComponent::set_ttc_255_sec ()
468+ {
469+ send_command (Command::TTC_SET_DURATION, data::TTC_255_SEC);
470+ }
471+
472+
473+
426474 /* ************************ DOOR COMMUNICATION *************************/
427475 /*
428476 * Transmit a message to the door opener over uart1
0 commit comments