RomanLut / hx_espnow_rc

Remote control library based on ESP-NOW (PlatformIO, ESP32 and ESP8266)
MIT License
66 stars 13 forks source link

tx external module not working #20

Closed AutoPlantBali closed 6 months ago

AutoPlantBali commented 7 months ago

hi @RomanLut

==>disable use_sport in tx_config.h // #define USE_SPORT

==> debug serial void getChannelValues( HXSBUSDecoder sbusDecoder, HXChannels channelValues ) { bool failsafe = sbusDecoder->isFailsafe(); channelValues-> isFailsafe = failsafe; for ( int i = 0; i < HXRC_CHANNELS_COUNT; i++) { if(i == 15){ Serial.print("CH16: "); Serial.println(sbusDecoder->getChannelValueInRange( i, 1000, 2000)); }

channelValues->channelValue[i] = sbusDecoder->getChannelValueInRange( i, 1000, 2000);

}

==> result debug_serial

but, profile 1 not working and now show ssid hxrct in network, { "transmitter_mode" : "ESPNOW", "espnow_channel" : 3, "espnow_key" : 0, "espnow_long_range_mode" : false, "ap_name" : "hxrct", "ap_password" : "" }

How do I see that profile 1 is correctly selected in serial monitor?

RomanLut commented 7 months ago

Well, change "ap_name" : "hxrct" to "ap_name" : "hxrct1" and see if AP name changes.

AutoPlantBali commented 7 months ago

Thank you for responding... I'll try it later, one more question, if I turn on the TX external module first and then connect to the remote Sbus, can that also have an effect?

RomanLut commented 7 months ago

Thank you for responding... I'll try it later, one more question, if I turn on the TX external module first and then connect to the remote Sbus, can that also have an effect?

No, code waits untill SBUS data is received. You can check the logic and expected debug output in: https://github.com/RomanLut/hx_espnow_rc/blob/9c6a12222aa7e4af4c202dcc46fa879a4a815237/lib/hx_rc_transmitter_common/modeBase.cpp#L44

AutoPlantBali commented 7 months ago

thank you @RomanLut..

I changed the code if (channel->is Failsafe) and found the cause of the wifi not appearing, because channel 16 at value 1050 goes to profile2 in LR mode and by default turning on the tx module before connecting to the remote sbus will go to profile6

select profile6 { "transmitter_mode" : "ESPNOW", "espnow_channel" : 3, "espnow_key" : 0, "espnow_long_range_mode" : false, "ap_name" : "hxrct", "ap_password" : "", "packet_rate" : "MAX", "phy_rate" : "1M", "usb_serial_telemetry_output": true, "usb_serial_baudrate": 460800 } esp32 error core 1 panic and bootloop

if select profile10 { "transmitter_mode" : "CONFIG", "ap_name" : "hxrct", "ap_password" : "", "ftp_user" : "anonymous", "ftp_password" : "anonymous" } does not work in browser http://192.168.4.1

RomanLut commented 7 months ago

If you boot esp32 and pass SBUS signal later with 1000 on CH16, esp should start profile1.json. The correct debug output is:

␀Start
Waiting for CH16 profile␛

   ====> waits infinitelly
   ===> here SBUS signal appears

!Cycle time:236
Got prof�le:0
Starting profile index=0
/profile1.json
Waiting for CH16 profile
LR Mode=false
HXESPNOWRC: Info: Board MAC address(STA): 7C:9E:BD:F4:C2:28
HXESPNOWRC: Info: Board MAC addre�s(AP): 7C:9E:BD:F4:C2:29 
G�␗�ɽ�����0      
!Cycle time:11405
Transmitter | FS: 1 | RSSI: 0 | Total: 50 | Ack�␂�~�Error:@0 | Missed time: 7 | ACKed PktRat�: 0p/s | Out telemetry: 0 b/s
            | RSSIDBm: -0dbm | Noise Floor: -0dbm | SNR: 0db | WifiRate: -1
Recei�er    | FS: 1 | RSSI: 0 | Recv/retransm: 0/0( 0%)) | Lost: 0 | Invalid/CRC: 0�0 | Tel. overflow/resyn�: 0/0 | In telemetry: 0 b/s
!Cycle time:33
Transmitter | FS: 1 | RSSI: 0 | Total: 99 | Ack�␂�>�Error: 0 | Missed time: 8 | ACKed PktRate: 0p/s | Out telemetry: 0 b/s
  �         | RWSIDBm: -0dbm | Noise Floor: -0dbm | SNR: 0db`| WifiRate: -1
Rece�vev    | FS: 1 | RSSI: 0 | Recv/retransm: 0/0( 0%)) | Lost: 0 | Invalid/CRC: 0/0 | Tel. overflow/resync: 0/0 | In telemetry: 0 b/s

In ESPPNOW mode there will be "hxrct" access point which can be used for OTA only; no http server.

In Config mode, there will be http page on http://192.168.4.1

You should see in debug output if config mode is started.

Here config mode is started because profile9.json was not found:

e␀Svart
Waiting for CH16 profile
!Cycle t�me:241
Got profile:8
Starting profile in�ex=8
/profile9.j�on
Unable to parse /�rofile9.j�on: EmptyInput
Waiting f�r CH16 profile
Config@mode start       

G��profile:8    
!Cycle time:1665
AutoPlantBali commented 7 months ago

hi @RomanLut thank you for the support. I have found the cause, the regulator (SPX3819) that I use is unstable at 4v power input, everything works normally when I set it at 5v. everything is functioning normally, only channel 16 is changed to failsafe condition to true or false, you can still change the profile.. If I want to change the profile only when the failsafe condition is true, which code do I need to change?