mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-25 19:56:30 +00:00
parent
bee95c5b56
commit
ea2357375a
@ -1,4 +1,5 @@
|
|||||||
/* 6.1.0a
|
/* 6.1.0a
|
||||||
|
* Fix TM1638 compile error (#3212)
|
||||||
* Add TM1638 switch support (#2226)
|
* Add TM1638 switch support (#2226)
|
||||||
* Fix invalid response using more than 4 switches and domoticz
|
* Fix invalid response using more than 4 switches and domoticz
|
||||||
* Update sensor drivers to provide instant results
|
* Update sensor drivers to provide instant results
|
||||||
|
@ -116,6 +116,8 @@ typedef unsigned long power_t; // Power (Relay) type
|
|||||||
#define min(a,b) ((a)<(b)?(a):(b))
|
#define min(a,b) ((a)<(b)?(a):(b))
|
||||||
#define max(a,b) ((a)>(b)?(a):(b))
|
#define max(a,b) ((a)>(b)?(a):(b))
|
||||||
*/
|
*/
|
||||||
|
#define tmin(a,b) ((a)<(b)?(a):(b))
|
||||||
|
#define tmax(a,b) ((a)>(b)?(a):(b))
|
||||||
|
|
||||||
#define STR_HELPER(x) #x
|
#define STR_HELPER(x) #x
|
||||||
#define STR(x) STR_HELPER(x)
|
#define STR(x) STR_HELPER(x)
|
||||||
|
@ -126,7 +126,6 @@ int mod(int a, int b)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define cmin(a,b) ((a)<(b)?(a):(b))
|
|
||||||
|
|
||||||
void Ws2812UpdatePixelColor(int position, struct WsColor hand_color, float offset)
|
void Ws2812UpdatePixelColor(int position, struct WsColor hand_color, float offset)
|
||||||
{
|
{
|
||||||
@ -140,9 +139,9 @@ void Ws2812UpdatePixelColor(int position, struct WsColor hand_color, float offse
|
|||||||
|
|
||||||
color = strip->GetPixelColor(mod_position);
|
color = strip->GetPixelColor(mod_position);
|
||||||
float dimmer = 100 / (float)Settings.light_dimmer;
|
float dimmer = 100 / (float)Settings.light_dimmer;
|
||||||
color.R = cmin(color.R + ((hand_color.red / dimmer) * offset), 255);
|
color.R = tmin(color.R + ((hand_color.red / dimmer) * offset), 255);
|
||||||
color.G = cmin(color.G + ((hand_color.green / dimmer) * offset), 255);
|
color.G = tmin(color.G + ((hand_color.green / dimmer) * offset), 255);
|
||||||
color.B = cmin(color.B + ((hand_color.blue / dimmer) * offset), 255);
|
color.B = tmin(color.B + ((hand_color.blue / dimmer) * offset), 255);
|
||||||
strip->SetPixelColor(mod_position, color);
|
strip->SetPixelColor(mod_position, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,8 +25,6 @@
|
|||||||
* References:
|
* References:
|
||||||
* - https://www.dfrobot.com/wiki/index.php/Weather-proof_Ultrasonic_Sensor_SKU_:_SEN0207
|
* - https://www.dfrobot.com/wiki/index.php/Weather-proof_Ultrasonic_Sensor_SKU_:_SEN0207
|
||||||
\*********************************************************************************************/
|
\*********************************************************************************************/
|
||||||
#define max(a,b) ((a)>(b)?(a):(b))
|
|
||||||
#define min(a,b) ((a)<(b)?(a):(b))
|
|
||||||
|
|
||||||
uint8_t sr04_echo_pin = 0;
|
uint8_t sr04_echo_pin = 0;
|
||||||
uint8_t sr04_trig_pin = 0;
|
uint8_t sr04_trig_pin = 0;
|
||||||
@ -42,7 +40,7 @@ uint8_t sr04_trig_pin = 0;
|
|||||||
#define PING_OVERHEAD 5
|
#define PING_OVERHEAD 5
|
||||||
|
|
||||||
// Conversion from uS to distance (round result to nearest cm or inch).
|
// Conversion from uS to distance (round result to nearest cm or inch).
|
||||||
#define EchoConvert(echoTime, conversionFactor) (max(((unsigned int)echoTime + conversionFactor / 2) / conversionFactor, (echoTime ? 1 : 0)))
|
#define EchoConvert(echoTime, conversionFactor) (tmax(((unsigned int)echoTime + conversionFactor / 2) / conversionFactor, (echoTime ? 1 : 0)))
|
||||||
|
|
||||||
/********************************************************************************************/
|
/********************************************************************************************/
|
||||||
|
|
||||||
@ -74,7 +72,7 @@ uint16_t Sr04Ping(uint16_t max_cm_distance)
|
|||||||
uint16_t duration = 0;
|
uint16_t duration = 0;
|
||||||
uint16_t maxEchoTime;
|
uint16_t maxEchoTime;
|
||||||
|
|
||||||
maxEchoTime = min(max_cm_distance + 1, (uint16_t) MAX_SENSOR_DISTANCE + 1) * US_ROUNDTRIP_CM;
|
maxEchoTime = tmin(max_cm_distance + 1, (uint16_t) MAX_SENSOR_DISTANCE + 1) * US_ROUNDTRIP_CM;
|
||||||
|
|
||||||
/* The following trigPin/echoPin cycle is used to determine the
|
/* The following trigPin/echoPin cycle is used to determine the
|
||||||
distance of the nearest object by bouncing soundwaves off of it. */
|
distance of the nearest object by bouncing soundwaves off of it. */
|
||||||
|
@ -155,7 +155,7 @@ void TmInit()
|
|||||||
digitalWrite(tm1638_clock_pin, HIGH);
|
digitalWrite(tm1638_clock_pin, HIGH);
|
||||||
|
|
||||||
Tm16XXSendCommand(0x40);
|
Tm16XXSendCommand(0x40);
|
||||||
Tm16XXSendCommand(0x80 | (tm1638_active_display ? 8 : 0) | min(7, tm1638_intensity));
|
Tm16XXSendCommand(0x80 | (tm1638_active_display ? 8 : 0) | tmin(7, tm1638_intensity));
|
||||||
|
|
||||||
digitalWrite(tm1638_strobe_pin, LOW);
|
digitalWrite(tm1638_strobe_pin, LOW);
|
||||||
Tm16XXSend(0xC0);
|
Tm16XXSend(0xC0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user