Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sonoff 4CH Pro AP mode #551

Closed
jeanpaul79 opened this issue Feb 11, 2018 · 7 comments
Closed

Sonoff 4CH Pro AP mode #551

jeanpaul79 opened this issue Feb 11, 2018 · 7 comments

Comments

@jeanpaul79
Copy link

Hello,

I'm using a Sonoff 4CH Pro with 1.12.3.

I've commented #define BUTTON1_LNGCLICK BUTTON_MODE_NONE #define BUTTON1_LNGLNGCLICK BUTTON_MODE_NONE
and when I do a long press on button 1, it goes to AP mode but after 2-3s, it connects back to wifi.

Do you know how to use AP mode with this sonoff 4CH pro please.

Best regards,

@xoseperez
Copy link
Owner

I should check this, it should stay in AP mode for at least 2 minutes if I recall.
I'm on holidays now, will give it a look next week.

@xoseperez xoseperez added this to the 1.12.4 milestone Feb 12, 2018
@xoseperez xoseperez self-assigned this Feb 12, 2018
@xoseperez
Copy link
Owner

Can't reproduce this issue without more info. Can you copy here the debug log while doing the before procedure?

@xoseperez xoseperez modified the milestones: 1.12.4, 1.13.0 Mar 2, 2018
@jeanpaul79
Copy link
Author

I'm using 1.12.3 and I modified code/espurna/config/hardware.h and I commented line 484 & 485 #define BUTTON1_LNGCLICK BUTTON_MODE_NONE & #define BUTTON1_LNGLNGCLICK BUTTON_MODE_NONE

With Sonoff 4CH Pro connected to my wifi, I do a longpress on button 1 and it seems to turn to AP mode (according to LED) but then it connects to wifi immediatly.

I'll disconnect it from main power and do a debug log.

@jeanpaul79
Copy link
Author

Hello,

Here is the log:
putty.log

@xoseperez
Copy link
Owner

xoseperez commented Mar 4, 2018

In the log, you can see a "Button #0 event 4" that is resetting the device. Event 4 is BUTTON_EVENT_LNGCLICK. When you commented the 484 line the firmware uses the default action for a long click on button 0 defined in defaults.h. And that's a reset.
The defaults for the first hardware button are double click for AP mode, long click (>2s) for reset and long-long click (>10s) for factory reset.
BUT (and that's a big "but"), on the 4CH uses a secondary microcontroller for button presses and relay control. There is an explanation in the hardware.h file, just above the lines you commented. And there is a mistake in that text that explains your problem. As I said, the default behavior for long press is reset the board, not AP mode as the text says. My bad. If you want to bind it to AP mode just replace the setting with:

#define BUTTON1_LNGCLICK    BUTTON_MODE_AP

@jeanpaul79
Copy link
Author

Oh ok thanks. Yes according to what is written in hardware.h I thought that a long press switch to AP mode.

I've replaced the line as you said.

Thanks.

@xoseperez
Copy link
Owner

Staged for release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants