Compare commits

..

2 Commits
main ... modbus

Author SHA1 Message Date
Siwat Sirichai b0fb33b1ec Merge branch 'main' into modbus 2023-12-08 18:00:20 +07:00
Siwat Sirichai 59d0c470b1 Update Jenkinsfile 2023-12-07 16:45:56 +07:00
5 changed files with 12 additions and 18 deletions

2
Jenkinsfile vendored
View File

@ -4,7 +4,7 @@ pipeline {
stages { stages {
stage('Build') { stage('Build') {
steps { steps {
git branch: 'main', url: 'https://git.siwatsystem.com/ise-senior-iot/iot-firmware.git' git branch: 'modbus', url: 'https://git.siwatsystem.com/ise-senior-iot/iot-firmware.git'
sh 'export PLATFORMIO_PATH=/root/.platformio/penv/bin/platformio' sh 'export PLATFORMIO_PATH=/root/.platformio/penv/bin/platformio'
sh '/usr/bin/python3 gen_release.py' sh '/usr/bin/python3 gen_release.py'
stash includes: 'release/**/*', name: 'release_binaries' stash includes: 'release/**/*', name: 'release_binaries'

View File

@ -89,10 +89,6 @@ for environment in environments:
else: else:
config[f'env:{environment}']['build_flags'] = config[f'env:{environment}']['build_flags'] + f' -DFW_VERSION=\\"{git_branch}_{environment}_{commit_hash}\\"' config[f'env:{environment}']['build_flags'] = config[f'env:{environment}']['build_flags'] + f' -DFW_VERSION=\\"{git_branch}_{environment}_{commit_hash}\\"'
# Write the platformio.ini file
with open(os.path.join(firmware_folder, 'platformio.ini'), 'w') as configfile:
config.write(configfile)
# if argument is not supplied, build all environments listed in platformio.ini # if argument is not supplied, build all environments listed in platformio.ini
if len(sys.argv) == 1: if len(sys.argv) == 1:
subprocess.run([f'{platformio_path}', 'run','-c',f'{firmware_folder}/platformio.ini'], cwd=current_dir) subprocess.run([f'{platformio_path}', 'run','-c',f'{firmware_folder}/platformio.ini'], cwd=current_dir)

View File

@ -704,7 +704,7 @@ void mqtt_subscribe()
* @param payload The payload of the received message. * @param payload The payload of the received message.
* @param length The length of the payload. * @param length The length of the payload.
*/ */
IRAM_ATTR void mqtt_callback(char *topic, byte *payload, unsigned int length) void mqtt_callback(char *topic, byte *payload, unsigned int length)
{ {
uint8_t topic_length = strlen(topic); uint8_t topic_length = strlen(topic);
char topic_trim[50]; char topic_trim[50];
@ -796,7 +796,7 @@ void thread_initialization()
* @param payload The message payload. * @param payload The message payload.
* @param payload_length The length of the message payload. * @param payload_length The length of the message payload.
*/ */
IRAM_ATTR void pwm_state_callback(char *topic, uint8_t topic_length, char *payload, unsigned int payload_length) void pwm_state_callback(char *topic, uint8_t topic_length, char *payload, unsigned int payload_length)
{ {
int a = topic[5] - '0'; int a = topic[5] - '0';
int b = topic[6] - '0'; int b = topic[6] - '0';
@ -822,7 +822,7 @@ IRAM_ATTR void pwm_state_callback(char *topic, uint8_t topic_length, char *paylo
* @param payload The message payload. * @param payload The message payload.
* @param payload_length The length of the message payload. * @param payload_length The length of the message payload.
*/ */
IRAM_ATTR void pwm_value_callback(char *topic, uint8_t topic_length, char *payload, unsigned int payload_length) void pwm_value_callback(char *topic, uint8_t topic_length, char *payload, unsigned int payload_length)
{ {
int a = topic[5] - '0'; int a = topic[5] - '0';
int b = topic[6] - '0'; int b = topic[6] - '0';
@ -925,7 +925,7 @@ void publish_pwm_value(int id)
* @param id The ID of the PWM pin. * @param id The ID of the PWM pin.
* @param state The new state of the PWM pin. * @param state The new state of the PWM pin.
*/ */
IRAM_ATTR void pwm_set_state(int id, int state) void pwm_set_state(int id, int state)
{ {
if (state != pwm_states[id]) if (state != pwm_states[id])
{ {
@ -949,7 +949,7 @@ IRAM_ATTR void pwm_set_state(int id, int state)
* @param id The id of the PWM pin. * @param id The id of the PWM pin.
* @param value The value to set the PWM pin to. * @param value The value to set the PWM pin to.
*/ */
IRAM_ATTR void pwm_set_value(int id, int value) void pwm_set_value(int id, int value)
{ {
pwm_values[id] = value; pwm_values[id] = value;
int pwm_state = pwm_states[id]; int pwm_state = pwm_states[id];
@ -1268,8 +1268,6 @@ void ac_set_state(int mode, int temperature, int fan_speed)
*/ */
void publish_env_state() void publish_env_state()
{ {
if(!pwm_report_enable)
return;
int errorCode = env_sensor.read(); int errorCode = env_sensor.read();
yield(); yield();
switch (errorCode) switch (errorCode)

View File

@ -43,7 +43,7 @@
#endif #endif
#include "espmega_iot_timer.hpp" #include "espmega_iot_timer.hpp"
IRAM_ATTR void mqtt_callback(char* topic, byte* payload, unsigned int length); void mqtt_callback(char* topic, byte* payload, unsigned int length);
void virtual_interrupt_loop(); void virtual_interrupt_loop();
void virtual_interrupt_callback(int pin, int state); void virtual_interrupt_callback(int pin, int state);
void virtual_interrupt_preload(); void virtual_interrupt_preload();
@ -51,8 +51,8 @@ void network_begin();
void mqtt_connect(); void mqtt_connect();
void mqtt_subscribe(); void mqtt_subscribe();
void thread_initialization(); void thread_initialization();
IRAM_ATTR void pwm_state_callback(char* topic, uint8_t topic_length, char* payload, unsigned int payload_length); void pwm_state_callback(char* topic, uint8_t topic_length, char* payload, unsigned int payload_length);
IRAM_ATTR void pwm_value_callback(char* topic, uint8_t topic_length, char* payload, unsigned int payload_length); void pwm_value_callback(char* topic, uint8_t topic_length, char* payload, unsigned int payload_length);
void state_request_callback(); void state_request_callback();
void io_begin(); void io_begin();
void ir_loop(); void ir_loop();
@ -62,8 +62,8 @@ void ota_begin();
void publish_pwm_states(); void publish_pwm_states();
void publish_pwm_state(int id); void publish_pwm_state(int id);
void publish_pwm_value(int id); void publish_pwm_value(int id);
IRAM_ATTR void pwm_set_state(int id, int state); void pwm_set_state(int id, int state);
IRAM_ATTR void pwm_set_value(int id, int value); void pwm_set_value(int id, int value);
void pwm_toggle(int id); void pwm_toggle(int id);
void pwm_toggle(int id1, int id2); void pwm_toggle(int id1, int id2);
void pwm_cycle_value(int id); void pwm_cycle_value(int id);

View File

@ -25,7 +25,7 @@
// IR Kit Configuration // IR Kit Configuration
#define IR_RECIEVE_PIN 35 #define IR_RECIEVE_PIN 35
#define IR_SEND_PIN 5 #define IR_SEND_PIN 17
#define MARK_EXCESS_MICROS 20 #define MARK_EXCESS_MICROS 20
#define IR_RAW_BUFFER_LENGTH 750 #define IR_RAW_BUFFER_LENGTH 750
#define AC_MAX_TEMPERATURE 30 #define AC_MAX_TEMPERATURE 30