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 dual r2 + DALLAS in GPIO9 Failed getting lock #1958

Closed
reydecopas opened this issue Oct 23, 2019 · 2 comments · Fixed by #1964
Closed

Sonoff dual r2 + DALLAS in GPIO9 Failed getting lock #1958

reydecopas opened this issue Oct 23, 2019 · 2 comments · Fixed by #1964
Labels

Comments

@reydecopas
Copy link

reydecopas commented Oct 23, 2019

Hi,
I am trying to add a dallas sensor to a sonoff dual r2, after compiling with -DDALLAS_PIN=9 -DDALLAS_SUPPORT=1 -DSENSOR_SUPPORT=1
and modifying hardware.h to
//#define BUTTON2_PIN 9 // Button 1 on header
#define BUTTON2_PIN GPIO_NONE // Button 1 on header

I am getting in the console:
[294200] [SENSOR] Initializing Dallas @ GPIO9
[294201] [GPIO] Failed getting lock for GPIO9
[294201] [SENSOR] -> ERROR 7

What am I doing wrong?

With tasmota I can read temperature in GPIO9

@mcspr
Copy link
Collaborator

mcspr commented Oct 24, 2019

Firmware tracks Dallas GPIO usage via some helper methods here:

bool gpioGetLock(unsigned char gpio) {
if (gpioValid(gpio)) {
unsigned int mask = 1 << gpio;
if ((_gpio_locked & mask) == 0) {
_gpio_locked |= mask;
DEBUG_MSG_P(PSTR("[GPIO] GPIO%u locked\n"), gpio);
return true;
}
}
DEBUG_MSG_P(PSTR("[GPIO] Failed getting lock for GPIO%u\n"), gpio);
return false;
}

But it does not even get to the locking part, because GPIO number is less than 12:
if (gpio <= 5) return true;
if (12 <= gpio && gpio <= 15) return true;

Adjusting 12 to 9 will fix the specific issue, because 8285 does not have GPIO9 connected to the SPI

@reydecopas
Copy link
Author

perfect!!! thank you!! it works!!!

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

Successfully merging a pull request may close this issue.

2 participants