fix pwm >12 value bug
This commit is contained in:
parent
b585db50bb
commit
f1299071c1
|
@ -12,7 +12,7 @@
|
||||||
platform = espressif32
|
platform = espressif32
|
||||||
board = wt32-eth01
|
board = wt32-eth01
|
||||||
framework = arduino
|
framework = arduino
|
||||||
lib_deps = siwats/espmegapror3@^1.0.2
|
lib_deps = siwats/ESPMegaPROR3@^1.1.2
|
||||||
knolleary/PubSubClient@^2.8
|
knolleary/PubSubClient@^2.8
|
||||||
ivanseidel/ArduinoThread@^2.1.1
|
ivanseidel/ArduinoThread@^2.1.1
|
||||||
arduino-libraries/Arduino_BuiltIn@^1.0.0
|
arduino-libraries/Arduino_BuiltIn@^1.0.0
|
||||||
|
|
14
src/main.cpp
14
src/main.cpp
|
@ -40,8 +40,9 @@ unsigned long virtual_interupt_timer[VINT_COUNT];
|
||||||
const int pwm_pins[PWM_COUNT] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
|
const int pwm_pins[PWM_COUNT] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
|
||||||
int pwm_states[PWM_COUNT];
|
int pwm_states[PWM_COUNT];
|
||||||
int pwm_values[PWM_COUNT];
|
int pwm_values[PWM_COUNT];
|
||||||
const float pwm_linear_scaling_m[PWM_COUNT] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
|
// output = m*input+c
|
||||||
const float pwm_linear_scaling_c[PWM_COUNT] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
const float pwm_linear_scaling_m[PWM_COUNT] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
|
||||||
|
const float pwm_linear_scaling_c[PWM_COUNT] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||||
#define PWM_CYCLE_VALUES_COUNT 3
|
#define PWM_CYCLE_VALUES_COUNT 3
|
||||||
const int PWM_CYCLE_VALUES[PWM_CYCLE_VALUES_COUNT] = {50, 125, 255};
|
const int PWM_CYCLE_VALUES[PWM_CYCLE_VALUES_COUNT] = {50, 125, 255};
|
||||||
char PWM_SET_STATE_TOPIC[75] = MQTT_BASE_TOPIC "/pwm/00/set/state";
|
char PWM_SET_STATE_TOPIC[75] = MQTT_BASE_TOPIC "/pwm/00/set/state";
|
||||||
|
@ -173,6 +174,11 @@ void setup()
|
||||||
thread_initialization();
|
thread_initialization();
|
||||||
Serial.println("Initialization Completed.");
|
Serial.println("Initialization Completed.");
|
||||||
Serial.println("Jumping to User Code.");
|
Serial.println("Jumping to User Code.");
|
||||||
|
// Begin User Code
|
||||||
|
|
||||||
|
/*
|
||||||
|
Pre-NTP Implementation
|
||||||
|
*/
|
||||||
lcd_send_command("page dashboard");
|
lcd_send_command("page dashboard");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -682,7 +688,8 @@ void lcd_refresh()
|
||||||
}
|
}
|
||||||
void lcd_top_bar_update()
|
void lcd_top_bar_update()
|
||||||
{
|
{
|
||||||
panel.writeStr("time.txt", "NO RTC!");
|
String time_str = String(rtc.getHour())+":"+String(rtc.getMinute());
|
||||||
|
panel.writeStr("time.txt", time_str);
|
||||||
panel.writeNum("server.pic", standalone ? 4 : 5);
|
panel.writeNum("server.pic", standalone ? 4 : 5);
|
||||||
panel.writeNum("lan.pic", ETH.linkUp() ? 3 : 2);
|
panel.writeNum("lan.pic", ETH.linkUp() ? 3 : 2);
|
||||||
}
|
}
|
||||||
|
@ -729,7 +736,6 @@ void trigger2()
|
||||||
void trigger3()
|
void trigger3()
|
||||||
{
|
{
|
||||||
int value = panel.readNumber("pwm_value.val");
|
int value = panel.readNumber("pwm_value.val");
|
||||||
Serial.println(value);
|
|
||||||
lcd_send_stop_bit();
|
lcd_send_stop_bit();
|
||||||
pwm_set_value(lcd_pwmAdj_id, value);
|
pwm_set_value(lcd_pwmAdj_id, value);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue