MrBuddyCasino / ESP32_Alexa

An Alexa Smart Speaker project for the ESP32.
Mozilla Public License 2.0
264 stars 72 forks source link

Added ping request to keep connection open #27

Closed chegewara closed 6 years ago

chegewara commented 6 years ago

Changes maybe are not optimized, because im learning your code. It works for about 50 minutes, then esp32 crashes.

With this code also changes from https://github.com/kodera2t/Simple_Alexa_dif are added.

chegewara commented 6 years ago

I know why its crashing after 50-ish minutes. Amazon server is sending GOAWAY frame. Waiting for answer now: https://forums.developer.amazon.com/questions/10684/is-there-any-limit-of-avs-api.html?childToView=172203#answer-172203

MrBuddyCasino commented 6 years ago

Thanks for this PR. Whats the reason for that one? I'd understand 1.0, whats with 0.52? renderer_config->sample_rate_modifier = 0.52;

chegewara commented 6 years ago

On my board it works with that value with right alexa speed and pitch. Im think it should be 0.544 in fact (i dont have logs right now to show how i counted that). From this comment im guessing its hardware dependent: https://github.com/MrBuddyCasino/ESP32_Alexa/issues/13#issuecomment-395578883

MrBuddyCasino commented 6 years ago

If ping was async to save on stack RAM that would be better, but this is a good start. Merged.

chegewara commented 6 years ago

Yes, im aware of that, but im not good enough programmer to implement this. Also there is another option, but i dont know how to implement it. nhttp2 can send PING frame. I think it would be even better solution if someone can implement it.

chegewara commented 6 years ago

@MrBuddyCasino I did changes because i saw those two lines:

I (3413442) renderer: changing sample rate from 24000 to 44100
I (3413445) I2S: PLL_D2: Req RATE: 23990, real rate: 24038.000, BITS: 16, CLKM: 26, BCK: 8, MCLK: 6142771.446, SCLK: 769216.000000, diva: 64, divb: 3

Also i had to change this value to 22050 and now online mp3 files are played by webradio with right pitch/speed: https://github.com/MrBuddyCasino/ESP32_Alexa/blob/master/main/app_main.c#L97