From 4b33f4fe197a1fbc8cd3d06af666e508e8dffcb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Anikiel?= Date: Fri, 4 Aug 2023 10:36:35 +0000 Subject: [PATCH] scripts: Update ntc-thermistor table generator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update the script to work with the current version of the ntc-thermistor driver. Signed-off-by: Paweł Anikiel --- scripts/utils/ntc_thermistor_table.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/scripts/utils/ntc_thermistor_table.py b/scripts/utils/ntc_thermistor_table.py index 06c282a3c0f..f57d3ca662b 100755 --- a/scripts/utils/ntc_thermistor_table.py +++ b/scripts/utils/ntc_thermistor_table.py @@ -7,8 +7,8 @@ Zephyr's NTC Thermistor DTS Table generator ########################################### -This script can be used to generate a "zephyr,ntc-thermistor-rt-table" compatible -Device Tree node for NTC thermistors. This uses the Beta Parameter Equation +This script can be used to generate an NTC thermistor DTS node with a +"zephyr,compensation-table" property. This uses the Beta Parameter Equation https://devxplained.eu/en/blog/temperature-measurement-with-ntcs#beta-parameter-equation @@ -47,22 +47,17 @@ def main( temps_range = range(temp_init, temp_final + interval - 1, interval) print(f"/* NTC Thermistor Table Generated with {os.path.basename(__file__)} */\n") - print(f"/ {{") print( - f"\tthermistor_R25_{int(r25)}_B_{int(beta)}: thermistor-R25-{int(r25)}-B-{int(beta)} {{" + f"thermistor_R25_{int(r25)}_B_{int(beta)}: thermistor-R25-{int(r25)}-B-{int(beta)} {{" ) - print(f'\t\tstatus = "disabled";') - print(f'\t\tcompatible = "zephyr,ntc-thermistor-rt-table";\n') table = [] for temp in temps_range: resistance = beta_equation_calc_resistance(r25, beta, temp) table.append(f"<({int(temp)}) {int(resistance)}>") - tbl_string = ',\n\t\t\t'.join(table) - print(f"\t\t/* TR Table Format */") - print(f"\t\ttr-table = {tbl_string};") - print(f"\t}};") + tbl_string = ',\n\t\t'.join(table) + print(f"\tzephyr,compensation-table = {tbl_string};") print(f"}};")