Closed jeras closed 7 years ago
Thank you for the fix.
This is on purpose. Multiplier is just for SI prefixes and similar multipliers not for conversion to different units.
Unit is not "angle" but base unit of the scale, so "degrees", "radians", .... If the unit name will be "angel", everybody will be confused, if it is in radians or degrees or so.
Same for length. Base unit is "meter", but I will not convert it to inches or back, because it is different unit. If the unit name will be "length" nobody will know, if it is in meters, inches, feets, or so. So I will never accept unit naming like that.
If you need conversion functions, you can introduce completely new API to translate from different units and I will be happy to incorporate it to this library.
e.g.
scpi_result_t SCPI_NumberConvert(scpi_t * context, scpi_number_t * value, scpi_unit_t target_unit);
you can later call
SCPI_NumberConvert(context, &someAngelValue, SCPI_UNIT_DEGREE) == SCPI_RES_OK
SCPI_NumberConvert(context, &someTemperatureValue, SCPI_UNIT_FAHRENHEIT) == SCPI_RES_OK
SCPI_NumberConvert(context, &someLengthValue, SCPI_UNIT_FAHRENHEIT) == SCPI_RES_ERR
For now I have only this typo fix.
I will work on SCPI for about 2 months so I will probably have more fixes.
For example angle units for degrees and radians have the same multiplication factor 1 now, which I think makes the conversion between the two wrong.