mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-30 22:53:59 +00:00 
			
		
		
		
	Move setting global voice assistant to constructor (#7630)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
		| @@ -23,6 +23,8 @@ static const size_t SEND_BUFFER_SIZE = INPUT_BUFFER_SIZE * sizeof(int16_t); | ||||
| static const size_t RECEIVE_SIZE = 1024; | ||||
| static const size_t SPEAKER_BUFFER_SIZE = 16 * RECEIVE_SIZE; | ||||
|  | ||||
| VoiceAssistant::VoiceAssistant() { global_voice_assistant = this; } | ||||
|  | ||||
| float VoiceAssistant::get_setup_priority() const { return setup_priority::AFTER_CONNECTION; } | ||||
|  | ||||
| bool VoiceAssistant::start_udp_socket_() { | ||||
| @@ -68,12 +70,6 @@ bool VoiceAssistant::start_udp_socket_() { | ||||
|   return true; | ||||
| } | ||||
|  | ||||
| void VoiceAssistant::setup() { | ||||
|   ESP_LOGCONFIG(TAG, "Setting up Voice Assistant..."); | ||||
|  | ||||
|   global_voice_assistant = this; | ||||
| } | ||||
|  | ||||
| bool VoiceAssistant::allocate_buffers_() { | ||||
|   if (this->send_buffer_ != nullptr) { | ||||
|     return true;  // Already allocated | ||||
|   | ||||
| @@ -91,7 +91,8 @@ struct Configuration { | ||||
|  | ||||
| class VoiceAssistant : public Component { | ||||
|  public: | ||||
|   void setup() override; | ||||
|   VoiceAssistant(); | ||||
|  | ||||
|   void loop() override; | ||||
|   float get_setup_priority() const override; | ||||
|   void start_streaming(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user