Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove oldmodel macro use #1735

Merged
merged 1 commit into from
Jun 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions include/decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,4 @@
#include "util.h"
#include "decoder_util.h"

/* TODO: temporary allow to change to new style model keys */
#define _X(n, o) ((0) ? (o) : (n))

#endif /* INCLUDE_DECODER_H_ */
48 changes: 19 additions & 29 deletions src/devices/acurite.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ static int acurite_rain_896_decode(r_device *decoder, bitbuffer_t *bitbuffer)

/* clang-format off */
data = data_make(
"model", "", DATA_STRING, _X("Acurite-Rain","Acurite Rain Gauge"),
"model", "", DATA_STRING, "Acurite-Rain",
"id", "", DATA_INT, id,
_X("rain_mm","rain"), "Total Rain", DATA_FORMAT, "%.1f mm", DATA_DOUBLE, total_rain,
"rain_mm", "Total Rain", DATA_FORMAT, "%.1f mm", DATA_DOUBLE, total_rain,
NULL);
/* clang-format on */

Expand Down Expand Up @@ -202,7 +202,7 @@ static int acurite_th_decode(r_device *decoder, bitbuffer_t *bitbuffer)

/* clang-format off */
data = data_make(
"model", "", DATA_STRING, _X("Acurite-609TXC","Acurite 609TXC Sensor"),
"model", "", DATA_STRING, "Acurite-609TXC",
"id", "", DATA_INT, id,
"battery", "", DATA_STRING, battery_low ? "LOW" : "OK",
"temperature_C", "Temperature", DATA_FORMAT, "%.1f C", DATA_DOUBLE, tempc,
Expand Down Expand Up @@ -402,7 +402,7 @@ static int acurite_6045_decode(r_device *decoder, bitbuffer_t *bitbuffer, unsign

/* clang-format off */
data = data_make(
"model", "", DATA_STRING, _X("Acurite-6045M","Acurite Lightning 6045M"),
"model", "", DATA_STRING, "Acurite-6045M",
"id", NULL, DATA_INT, sensor_id,
"channel", NULL, DATA_STRING, channel_str,
"battery", "battery", DATA_STRING, battery_low ? "LOW" : "OK",
Expand Down Expand Up @@ -736,10 +736,10 @@ static int acurite_txr_decode(r_device *decoder, bitbuffer_t *bitbuffer)

/* clang-format off */
data = data_make(
"model", "", DATA_STRING, _X("Acurite-Tower","Acurite tower sensor"),
"model", "", DATA_STRING, "Acurite-Tower",
"id", "", DATA_INT, sensor_id,
"channel", NULL, DATA_STRING, &channel_str,
_X("battery_ok","battery_low"), "", DATA_INT, _X(!battery_low,battery_low),
"battery_ok", "", DATA_INT, !battery_low,
"temperature_C", "Temperature", DATA_FORMAT, "%.1f C", DATA_DOUBLE, tempc,
"humidity", "Humidity", DATA_FORMAT, "%u %%", DATA_INT, humidity,
"mic", "Integrity", DATA_STRING, "CHECKSUM",
Expand Down Expand Up @@ -788,7 +788,7 @@ static int acurite_txr_decode(r_device *decoder, bitbuffer_t *bitbuffer)
"model", "", DATA_STRING, "Acurite-515",
"id", "", DATA_INT, sensor_id,
"channel", NULL, DATA_STRING, &channel_str,
_X("battery_ok","battery_low"), "", DATA_INT, _X(!battery_low,battery_low),
"battery_ok", "", DATA_INT, !battery_low,
"temperature_F", "Temperature", DATA_FORMAT, "%.1f F", DATA_DOUBLE, tempf,
"mic", "Integrity", DATA_STRING, "CHECKSUM",
NULL);
Expand Down Expand Up @@ -843,15 +843,15 @@ static int acurite_txr_decode(r_device *decoder, bitbuffer_t *bitbuffer)

/* clang-format off */
data = data_make(
"model", "", DATA_STRING, _X("Acurite-5n1","Acurite 5n1 sensor"),
"model", "", DATA_STRING, "Acurite-5n1",
"message_type", NULL, DATA_INT, message_type,
_X("id", "sensor_id"), NULL, DATA_INT, sensor_id,
"id", NULL, DATA_INT, sensor_id,
"channel", NULL, DATA_STRING, &channel_str,
"sequence_num", NULL, DATA_INT, sequence_num,
"battery", NULL, DATA_STRING, battery_low ? "OK" : "LOW",
_X("wind_avg_km_h","wind_speed_kph"), "wind_speed", DATA_FORMAT, "%.1f km/h", DATA_DOUBLE, wind_speed_kph,
"wind_avg_km_h", "wind_speed", DATA_FORMAT, "%.1f km/h", DATA_DOUBLE, wind_speed_kph,
"wind_dir_deg", NULL, DATA_FORMAT, "%.1f", DATA_DOUBLE, wind_dir,
_X("rain_in","rain_inch"), "Rainfall Accumulation", DATA_FORMAT, "%.2f in", DATA_DOUBLE, raincounter * 0.01f,
"rain_in", "Rainfall Accumulation", DATA_FORMAT, "%.2f in", DATA_DOUBLE, raincounter * 0.01f,
"mic", "Integrity", DATA_STRING, "CHECKSUM",
NULL);
/* clang-format on */
Expand All @@ -870,13 +870,13 @@ static int acurite_txr_decode(r_device *decoder, bitbuffer_t *bitbuffer)

/* clang-format off */
data = data_make(
"model", "", DATA_STRING, _X("Acurite-5n1","Acurite 5n1 sensor"),
"model", "", DATA_STRING, "Acurite-5n1",
"message_type", NULL, DATA_INT, message_type,
_X("id", "sensor_id"), NULL, DATA_INT, sensor_id,
"id", NULL, DATA_INT, sensor_id,
"channel", NULL, DATA_STRING, &channel_str,
"sequence_num", NULL, DATA_INT, sequence_num,
"battery", NULL, DATA_STRING, battery_low ? "OK" : "LOW",
_X("wind_avg_km_h","wind_speed_kph"), "wind_speed", DATA_FORMAT, "%.1f km/h", DATA_DOUBLE, wind_speed_kph,
"wind_avg_km_h", "wind_speed", DATA_FORMAT, "%.1f km/h", DATA_DOUBLE, wind_speed_kph,
"temperature_F", "temperature", DATA_FORMAT, "%.1f F", DATA_DOUBLE, tempf,
"humidity", NULL, DATA_FORMAT, "%u %%", DATA_INT, humidity,
"mic", "Integrity", DATA_STRING, "CHECKSUM",
Expand All @@ -899,13 +899,13 @@ static int acurite_txr_decode(r_device *decoder, bitbuffer_t *bitbuffer)

/* clang-format off */
data = data_make(
"model", "", DATA_STRING, _X("Acurite-3n1","Acurite 3n1 sensor"),
"model", "", DATA_STRING, "Acurite-3n1",
"message_type", NULL, DATA_INT, message_type,
_X("id", "sensor_id"), NULL, DATA_FORMAT, "0x%02X", DATA_INT, sensor_id,
"id", NULL, DATA_FORMAT, "0x%02X", DATA_INT, sensor_id,
"channel", NULL, DATA_STRING, &channel_str,
"sequence_num", NULL, DATA_INT, sequence_num,
"battery", NULL, DATA_STRING, battery_low ? "OK" : "LOW",
_X("wind_avg_mi_h","wind_speed_mph"), "wind_speed", DATA_FORMAT, "%.1f mi/h", DATA_DOUBLE, wind_speed_mph,
"wind_avg_mi_h", "wind_speed", DATA_FORMAT, "%.1f mi/h", DATA_DOUBLE, wind_speed_mph,
"temperature_F", "temperature", DATA_FORMAT, "%.1f F", DATA_DOUBLE, tempf,
"humidity", NULL, DATA_FORMAT, "%u %%", DATA_INT, humidity,
"mic", "Integrity", DATA_STRING, "CHECKSUM",
Expand Down Expand Up @@ -1075,7 +1075,7 @@ static int acurite_986_decode(r_device *decoder, bitbuffer_t *bitbuffer)

/* clang-format off */
data = data_make(
"model", "", DATA_STRING, _X("Acurite-986","Acurite 986 Sensor"),
"model", "", DATA_STRING, "Acurite-986",
"id", NULL, DATA_INT, sensor_id,
"channel", NULL, DATA_STRING, channel_str,
"battery", "battery", DATA_STRING, battery_low ? "LOW" : "OK",
Expand Down Expand Up @@ -1141,7 +1141,7 @@ static int acurite_606_decode(r_device *decoder, bitbuffer_t *bitbuffer)

/* clang-format off */
data = data_make(
"model", "", DATA_STRING, _X("Acurite-606TX","Acurite 606TX Sensor"),
"model", "", DATA_STRING, "Acurite-606TX",
"id", "", DATA_INT, sensor_id,
"battery", "Battery", DATA_STRING, battery ? "OK" : "LOW",
"temperature_C", "Temperature", DATA_FORMAT, "%.1f C", DATA_DOUBLE, temp_c,
Expand Down Expand Up @@ -1319,7 +1319,6 @@ static int acurite_00275rm_decode(r_device *decoder, bitbuffer_t *bitbuffer)
static char *acurite_rain_gauge_output_fields[] = {
"model",
"id",
"rain", // TODO: remove this
"rain_mm",
NULL,
};
Expand Down Expand Up @@ -1364,24 +1363,18 @@ r_device acurite_th = {
*/
static char *acurite_txr_output_fields[] = {
"model",
"subtype", // TODO: remove this
"message_type", // TODO: remove this
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one also has 'TODO: remove this'

"id",
"sensor_id", // TODO: remove this
"channel",
"sequence_num",
"battery_low", // TODO: remove this
"battery_ok",
"battery",
"temperature_C",
"temperature_F",
"humidity",
"wind_speed_mph", // TODO: remove this
"wind_speed_kph", // TODO: remove this
"wind_avg_mi_h",
"wind_avg_km_h",
"wind_dir_deg",
"rain_inch", // TODO: remove this
"rain_in",
"rain_mm",
"storm_dist",
Expand Down Expand Up @@ -1487,16 +1480,13 @@ r_device acurite_606 = {
static char *acurite_00275rm_output_fields[] = {
"model",
"subtype",
"probe", // TODO: remove this
"id",
"battery",
"temperature_C",
"humidity",
"water",
"temperature_1_C",
"humidity_1",
"ptemperature_C",
"phumidity",
"mic",
NULL,
};
Expand Down
2 changes: 1 addition & 1 deletion src/devices/akhan_100F14.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ static int akhan_rke_callback(r_device *decoder, bitbuffer_t *bitbuffer)
return DECODE_FAIL_SANITY;

data = data_make(
"model", "", DATA_STRING, _X("Akhan-100F14","Akhan 100F14 remote keyless entry"),
"model", "", DATA_STRING, "Akhan-100F14",
"id", "ID (20bit)", DATA_FORMAT, "0x%x", DATA_INT, id,
"data", "Data (4bit)", DATA_STRING, cmd_str,
NULL);
Expand Down
36 changes: 16 additions & 20 deletions src/devices/alecto.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,14 @@ static int alectov1_callback(r_device *decoder, bitbuffer_t *bitbuffer)

/* clang-format off */
data = data_make(
"model", "", DATA_STRING, _X("AlectoV1-Wind","AlectoV1 Wind Sensor"),
"id", "House Code", DATA_INT, sensor_id,
"channel", "Channel", DATA_INT, channel,
"battery", "Battery", DATA_STRING, battery_low ? "LOW" : "OK",
_X("wind_avg_m_s","wind_speed"), "Wind speed", DATA_FORMAT, "%.2f m/s", DATA_DOUBLE, speed * 0.2F,
_X("wind_max_m_s","wind_gust"), "Wind gust", DATA_FORMAT, "%.2f m/s", DATA_DOUBLE, gust * 0.2F,
_X("wind_dir_deg","wind_direction"), "Wind Direction", DATA_INT, direction,
"mic", "Integrity", DATA_STRING, "CHECKSUM",
"model", "", DATA_STRING, "AlectoV1-Wind",
"id", "House Code", DATA_INT, sensor_id,
"channel", "Channel", DATA_INT, channel,
"battery", "Battery", DATA_STRING, battery_low ? "LOW" : "OK",
"wind_avg_m_s", "Wind speed", DATA_FORMAT, "%.2f m/s", DATA_DOUBLE, speed * 0.2F,
"wind_max_m_s", "Wind gust", DATA_FORMAT, "%.2f m/s", DATA_DOUBLE, gust * 0.2F,
"wind_dir_deg", "Wind Direction", DATA_INT, direction,
"mic", "Integrity", DATA_STRING, "CHECKSUM",
NULL);
/* clang-format on */
decoder_output_data(decoder, data);
Expand All @@ -180,12 +180,12 @@ static int alectov1_callback(r_device *decoder, bitbuffer_t *bitbuffer)

/* clang-format off */
data = data_make(
"model", "", DATA_STRING, _X("AlectoV1-Rain","AlectoV1 Rain Sensor"),
"id", "House Code", DATA_INT, sensor_id,
"channel", "Channel", DATA_INT, channel,
"battery", "Battery", DATA_STRING, battery_low ? "LOW" : "OK",
_X("rain_mm","rain_total"), "Total Rain", DATA_FORMAT, "%.02f mm", DATA_DOUBLE, rain_mm,
"mic", "Integrity", DATA_STRING, "CHECKSUM",
"model", "", DATA_STRING, "AlectoV1-Rain",
"id", "House Code", DATA_INT, sensor_id,
"channel", "Channel", DATA_INT, channel,
"battery", "Battery", DATA_STRING, battery_low ? "LOW" : "OK",
"rain_mm", "Total Rain", DATA_FORMAT, "%.02f mm", DATA_DOUBLE, rain_mm,
"mic", "Integrity", DATA_STRING, "CHECKSUM",
NULL);
/* clang-format on */
decoder_output_data(decoder, data);
Expand All @@ -205,13 +205,13 @@ static int alectov1_callback(r_device *decoder, bitbuffer_t *bitbuffer)

/* clang-format off */
data = data_make(
"model", "", DATA_STRING, _X("AlectoV1-Temperature","AlectoV1 Temperature Sensor"),
"model", "", DATA_STRING, "AlectoV1-Temperature",
"id", "House Code", DATA_INT, sensor_id,
"channel", "Channel", DATA_INT, channel,
"battery", "Battery", DATA_STRING, battery_low ? "LOW" : "OK",
"temperature_C", "Temperature", DATA_FORMAT, "%.02f C", DATA_DOUBLE, temp_c,
"humidity", "Humidity", DATA_FORMAT, "%u %%", DATA_INT, humidity,
"mic", "Integrity", DATA_STRING, "CHECKSUM",
"mic", "Integrity", DATA_STRING, "CHECKSUM",
NULL);
/* clang-format on */
decoder_output_data(decoder, data);
Expand All @@ -228,11 +228,7 @@ static char *output_fields[] = {
"battery",
"temperature_C",
"humidity",
"rain_total", // TODO: remove this
"rain_mm",
"wind_speed", // TODO: remove this
"wind_gust", // TODO: remove this
"wind_direction", // TODO: remove this
"wind_avg_m_s",
"wind_max_m_s",
"wind_dir_deg",
Expand Down
5 changes: 2 additions & 3 deletions src/devices/ambient_weather.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ static int ambient_weather_decode(r_device *decoder, bitbuffer_t *bitbuffer, uns
humidity = b[4];

data = data_make(
"model", "", DATA_STRING, _X("Ambientweather-F007TH","Ambient Weather F007TH Thermo-Hygrometer"),
_X("id","device"), "House Code", DATA_INT, deviceID,
"model", "", DATA_STRING, "Ambientweather-F007TH",
"id", "House Code", DATA_INT, deviceID,
"channel", "Channel", DATA_INT, channel,
"battery", "Battery", DATA_STRING, isBatteryLow ? "Low" : "OK",
"temperature_F", "Temperature", DATA_FORMAT, "%.1f F", DATA_DOUBLE, temperature,
Expand Down Expand Up @@ -104,7 +104,6 @@ static int ambient_weather_callback(r_device *decoder, bitbuffer_t *bitbuffer)

static char *output_fields[] = {
"model",
"device", // TODO: delete this
"id",
"channel",
"battery",
Expand Down
2 changes: 1 addition & 1 deletion src/devices/brennenstuhl_rcs_2044.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ static int brennenstuhl_rcs_2044_process_row(r_device *decoder, bitbuffer_t *bit
return 0; /* Pressing simultaneously ON and OFF key is not useful either */

data = data_make(
"model", "Model", DATA_STRING, _X("Brennenstuhl-RCS2044","Brennenstuhl RCS 2044"),
"model", "Model", DATA_STRING, "Brennenstuhl-RCS2044",
"id", "id", DATA_INT, system_code,
"key", "key", DATA_STRING, key,
"state", "state", DATA_STRING, (on_off == 0x02 ? "ON" : "OFF"),
Expand Down
2 changes: 1 addition & 1 deletion src/devices/bresser_3ch.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ static int bresser_3ch_decode(r_device *decoder, bitbuffer_t *bitbuffer)

/* clang-format off */
data = data_make(
"model", "", DATA_STRING, _X("Bresser-3CH","Bresser 3CH sensor"),
"model", "", DATA_STRING, "Bresser-3CH",
"id", "Id", DATA_INT, id,
"channel", "Channel", DATA_INT, channel,
"battery", "Battery", DATA_STRING, battery_low ? "LOW": "OK",
Expand Down
Loading