Skip to content

Commit 76d50ec

Browse files
committed
CmakeList + Rainmaker src files edit
1 parent 399b5e6 commit 76d50ec

13 files changed

+132
-39
lines changed

Diff for: CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ endfunction()
237237

238238
maybe_add_component(esp-dsp)
239239

240-
if(IDF_TARGET MATCHES "esp32" AND CONFIG_ESP_RMAKER_TASK_STACK)
240+
if(CONFIG_ESP_RMAKER_TASK_STACK)
241241
maybe_add_component(esp_rainmaker)
242242
maybe_add_component(qrcode)
243243
endif()

Diff for: libraries/RainMaker/src/RMaker.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
#include "sdkconfig.h"
2+
#ifdef CONFIG_ESP_RMAKER_WORK_QUEUE_TASK_STACK
13
#include "RMaker.h"
2-
#if ESP_IDF_VERSION_MAJOR >= 4 && CONFIG_ESP_RMAKER_TASK_STACK && CONFIG_IDF_TARGET_ESP32
34
#include <esp_rmaker_schedule.h>
45
#include <esp_rmaker_utils.h>
56
bool wifiLowLevelInit(bool persistent);
67
static esp_err_t err;
78

8-
static void event_handler(void *arg, esp_event_base_t event_base, int event_id, void *event_data)
9+
static void event_handler(void *arg, esp_event_base_t event_base, int32_t event_id, void *event_data)
910
{
1011
if (event_base == RMAKER_EVENT) {
1112
switch (event_id) {
@@ -113,4 +114,4 @@ esp_err_t RMakerClass::enableOTA(ota_type_t type, const char *cert)
113114
}
114115

115116
RMakerClass RMaker;
116-
#endif
117+
#endif

Diff for: libraries/RainMaker/src/RMaker.h

+17-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
1+
// Copyright 2015-2020 Espressif Systems (Shanghai) PTE LTD
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
#pragma once
15+
#include "sdkconfig.h"
16+
#ifdef CONFIG_ESP_RMAKER_WORK_QUEUE_TASK_STACK
117
#include "esp_system.h"
2-
#if ESP_IDF_VERSION_MAJOR >= 4 && CONFIG_ESP_RMAKER_TASK_STACK && CONFIG_IDF_TARGET_ESP32
3-
418
#include "Arduino.h"
519
#include "RMakerNode.h"
620
#include "RMakerQR.h"
@@ -26,5 +40,4 @@ class RMakerClass
2640
};
2741

2842
extern RMakerClass RMaker;
29-
30-
#endif
43+
#endif

Diff for: libraries/RainMaker/src/RMakerDevice.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
#include "sdkconfig.h"
2+
#ifdef CONFIG_ESP_RMAKER_WORK_QUEUE_TASK_STACK
13
#include "RMakerDevice.h"
2-
#if ESP_IDF_VERSION_MAJOR >= 4 && CONFIG_ESP_RMAKER_TASK_STACK && CONFIG_IDF_TARGET_ESP32
34

45
static esp_err_t err;
56
typedef void (*deviceWriteCb)(Device*, Param*, const param_val_t val, void *priv_data, write_ctx_t *ctx);
@@ -205,5 +206,4 @@ esp_err_t Device::updateAndReportParam(const char *param_name, const char *my_va
205206
}
206207
return ESP_OK;
207208
}
208-
209-
#endif
209+
#endif

Diff for: libraries/RainMaker/src/RMakerDevice.h

+16-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
1+
// Copyright 2015-2020 Espressif Systems (Shanghai) PTE LTD
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
#pragma once
15+
#include "sdkconfig.h"
16+
#ifdef CONFIG_ESP_RMAKER_WORK_QUEUE_TASK_STACK
117
#include "esp_system.h"
2-
#if ESP_IDF_VERSION_MAJOR >= 4 && CONFIG_ESP_RMAKER_TASK_STACK && CONFIG_IDF_TARGET_ESP32
3-
418
#include "RMakerParam.h"
519
#include <esp_rmaker_standard_devices.h>
620
#include <esp_rmaker_standard_params.h>
@@ -150,5 +164,4 @@ class TemperatureSensor : public Device
150164
}
151165
}
152166
};
153-
154167
#endif

Diff for: libraries/RainMaker/src/RMakerNode.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
#include "sdkconfig.h"
2+
#ifdef CONFIG_ESP_RMAKER_WORK_QUEUE_TASK_STACK
13
#include "RMakerNode.h"
2-
#if ESP_IDF_VERSION_MAJOR >= 4 && CONFIG_ESP_RMAKER_TASK_STACK && CONFIG_IDF_TARGET_ESP32
34
static esp_err_t err;
45

56
esp_err_t Node::addDevice(Device device)
@@ -38,4 +39,4 @@ esp_err_t Node::addNodeAttr(const char *attr_name, const char *val)
3839
}
3940
return err;
4041
}
41-
#endif
42+
#endif

Diff for: libraries/RainMaker/src/RMakerNode.h

+16-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
1+
// Copyright 2015-2020 Espressif Systems (Shanghai) PTE LTD
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
#pragma once
15+
#include "sdkconfig.h"
16+
#ifdef CONFIG_ESP_RMAKER_WORK_QUEUE_TASK_STACK
117
#include "esp_system.h"
2-
#if ESP_IDF_VERSION_MAJOR >= 4 && CONFIG_ESP_RMAKER_TASK_STACK && CONFIG_IDF_TARGET_ESP32
3-
418
#include "RMakerDevice.h"
519

620
class Node
@@ -29,5 +43,4 @@ class Node
2943
node_info_t *getNodeInfo();
3044
esp_err_t addNodeAttr(const char *attr_name, const char *val);
3145
};
32-
3346
#endif

Diff for: libraries/RainMaker/src/RMakerParam.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
#include "sdkconfig.h"
2+
#ifdef CONFIG_ESP_RMAKER_WORK_QUEUE_TASK_STACK
13
#include "RMakerParam.h"
2-
#if ESP_IDF_VERSION_MAJOR >= 4 && CONFIG_ESP_RMAKER_TASK_STACK && CONFIG_IDF_TARGET_ESP32
34

45
static esp_err_t err;
56

@@ -29,5 +30,4 @@ esp_err_t Param::updateAndReport(param_val_t val)
2930
}
3031
return err;
3132
}
32-
3333
#endif

Diff for: libraries/RainMaker/src/RMakerParam.h

+16-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
1+
// Copyright 2015-2020 Espressif Systems (Shanghai) PTE LTD
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
#pragma once
15+
#include "sdkconfig.h"
16+
#ifdef CONFIG_ESP_RMAKER_WORK_QUEUE_TASK_STACK
117
#include "esp_system.h"
2-
#if ESP_IDF_VERSION_MAJOR >= 4 && CONFIG_ESP_RMAKER_TASK_STACK && CONFIG_IDF_TARGET_ESP32
3-
418
#include "RMakerType.h"
519

620
class Param
@@ -34,5 +48,4 @@ class Param
3448
esp_err_t addBounds(param_val_t min, param_val_t max, param_val_t step);
3549
esp_err_t updateAndReport(param_val_t val);
3650
};
37-
3851
#endif

Diff for: libraries/RainMaker/src/RMakerQR.h

+17-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
1+
// Copyright 2015-2020 Espressif Systems (Shanghai) PTE LTD
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
#pragma once
15+
#include "sdkconfig.h"
16+
#ifdef CONFIG_ESP_RMAKER_WORK_QUEUE_TASK_STACK
117
#include "esp_system.h"
2-
#if ESP_IDF_VERSION_MAJOR >= 4 && CONFIG_ESP_RMAKER_TASK_STACK && CONFIG_IDF_TARGET_ESP32
3-
418
#include <qrcode.h>
519

620
#define PROV_QR_VERSION "v1"
@@ -20,5 +34,4 @@ static void printQR(const char *name, const char *pop, const char *transport)
2034
qrcode_display(payload);
2135
Serial.printf("If QR code is not visible, copy paste the below URL in a browser.\n%s?data=%s\n", QRCODE_BASE_URL, payload);
2236
}
23-
24-
#endif
37+
#endif

Diff for: libraries/RainMaker/src/RMakerType.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
#include "sdkconfig.h"
2+
#ifdef CONFIG_ESP_RMAKER_WORK_QUEUE_TASK_STACK
13
#include "RMakerType.h"
2-
#if ESP_IDF_VERSION_MAJOR >= 4 && CONFIG_ESP_RMAKER_TASK_STACK && CONFIG_IDF_TARGET_ESP32
34

45
param_val_t value(int ival)
56
{
@@ -20,5 +21,4 @@ param_val_t value(float fval)
2021
{
2122
return esp_rmaker_float(fval);
2223
}
23-
2424
#endif

Diff for: libraries/RainMaker/src/RMakerType.h

+16-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
1+
// Copyright 2015-2020 Espressif Systems (Shanghai) PTE LTD
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
#pragma once
15+
#include "sdkconfig.h"
16+
#ifdef CONFIG_ESP_RMAKER_WORK_QUEUE_TASK_STACK
117
#include "esp_system.h"
2-
#if ESP_IDF_VERSION_MAJOR >= 4 && CONFIG_ESP_RMAKER_TASK_STACK && CONFIG_IDF_TARGET_ESP32
3-
418
#include <esp_rmaker_core.h>
519
#include <esp_rmaker_ota.h>
620
#include <esp_err.h>
@@ -19,5 +33,4 @@ param_val_t value(int);
1933
param_val_t value(bool);
2034
param_val_t value(char *);
2135
param_val_t value(float);
22-
2336
#endif

Diff for: libraries/RainMaker/src/RMakerUtils.h

+19-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,29 @@
1+
// Copyright 2015-2020 Espressif Systems (Shanghai) PTE LTD
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
#pragma once
15+
#include "sdkconfig.h"
16+
#ifdef CONFIG_ESP_RMAKER_WORK_QUEUE_TASK_STACK
117
#include "esp_system.h"
2-
#if ESP_IDF_VERSION_MAJOR >= 4 && CONFIG_ESP_RMAKER_TASK_STACK && CONFIG_IDF_TARGET_ESP32
3-
418
#include <esp_rmaker_utils.h>
519

620
static void RMakerFactoryReset(int seconds)
721
{
8-
esp_rmaker_factory_reset(seconds);
22+
esp_rmaker_factory_reset(0, seconds);
923
}
1024

1125
static void RMakerWiFiReset(int seconds)
1226
{
13-
esp_rmaker_wifi_reset(seconds);
27+
esp_rmaker_wifi_reset(0, seconds);
1428
}
15-
16-
#endif
29+
#endif

0 commit comments

Comments
 (0)