PaulStoffregen / OneWire

Library for Dallas/Maxim 1-Wire Chips
http://www.pjrc.com/teensy/td_libs_OneWire.html
579 stars 382 forks source link

esp32c3 compile error when using OneWire #111

Closed ZJDATY closed 2 years ago

ZJDATY commented 2 years ago

Board esp32c3

Device Description D:\Users\XXX\Documents\Arduino\libraries\OneWire\util/OneWire_direct_gpio.h:226:18: error: 'gpio_dev_t' {aka 'volatile struct gpio_dev_s'} has no member named 'enable1_w1ts'; did you mean 'enable_w1ts'? GPIO.enable1_w1ts.val = ((uint32_t)1 << (pin - 32)); ^~~~ enable_w1ts exit status 1 为开发板 ESP32C3 Dev Module 编译时出错。

Hardware Configuration gpio18 connect ds18b20 data

esp32 Version v2.0.2

IDE Name arduino

Operating System windows 11

Flash frequency 40

PSRAM enabled no

Upload speed 115200

Description Compilation failed

Sketch // Include the libraries we need

include

include

// Data wire is plugged into port 2 on the Arduino

define ONE_WIRE_BUS 2

// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs) OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature. DallasTemperature sensors(&oneWire);

// arrays to hold device address DeviceAddress insideThermometer;

/*

// function to print the temperature for a device void printTemperature(DeviceAddress deviceAddress) { // method 1 - slower //Serial.print("Temp C: "); //Serial.print(sensors.getTempC(deviceAddress)); //Serial.print(" Temp F: "); //Serial.print(sensors.getTempF(deviceAddress)); // Makes a second call to getTempC and then converts to Fahrenheit

// method 2 - faster float tempC = sensors.getTempC(deviceAddress); if(tempC == DEVICE_DISCONNECTED_C) { Serial.println("Error: Could not read temperature data"); return; } Serial.print("Temp C: "); Serial.print(tempC); Serial.print(" Temp F: "); Serial.println(DallasTemperature::toFahrenheit(tempC)); // Converts tempC to Fahrenheit } /*

// function to print a device address void printAddress(DeviceAddress deviceAddress) { for (uint8_t i = 0; i < 8; i++) { if (deviceAddress[i] < 16) Serial.print("0"); Serial.print(deviceAddress[i], HEX); } } Debug Message D:\Users\XXX\Documents\Arduino\libraries\OneWire\util/OneWire_direct_gpio.h:226:18: error: 'gpio_dev_t' {aka 'volatile struct gpio_dev_s'} has no member named 'enable1_w1ts'; did you mean 'enable_w1ts'? GPIO.enable1_w1ts.val = ((uint32_t)1 << (pin - 32)); ^~~~ enable_w1ts exit status 1 为开发板 ESP32C3 Dev Module 编译时出错。

uzi18 commented 2 years ago

@pstolarz are you ready with OneWireNg?

pstolarz commented 2 years ago

C3 works fine on my lib. Future release 0.11 will support S3 and H2.

Jason2866 commented 2 years ago

PR #114

PaulStoffregen commented 2 years ago

I've merged #114. For everyone following this issue and still using ESP32, please download the latest OneWire and reply here to confirm (or deny) this fully solves the problem.

I am waiting for your feedback before publishing a new OneWire version which will make this fix available to everyone using the Arduino Library Manager. Please take a moment to test this latest code and let me know if it should be published as a release to the wider Arduino community?

lpatiny commented 2 years ago

I'm playing with ESP-32 (https://github.com/Hackuarium/esp32-c3/blob/main/src/taskOneWire.cpp) with various sensors and I can confirm that the head is working correctly. (and I could not let it work with the current release). Many thanks !

PaulStoffregen commented 2 years ago

released 2.3.7