Skip to content

Commit

Permalink
[tacmi] reverted unit lookup - Units.getInstance().getUnit() did not …
Browse files Browse the repository at this point in the history
…resolve units properly
  • Loading branch information
marvkis committed Oct 14, 2024
1 parent 0019f60 commit 4fa7406
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import tech.units.indriya.format.SimpleUnitFormat;

/**
* The {@link ApiPageParser} class parses the 'API' schema page from the CMI and
* maps it to our channels
Expand Down Expand Up @@ -389,7 +391,8 @@ private void getApiPageEntry(@Nullable String id2, int line, int col, String sho
// U+2126 is the 'real' OHM sign, but it seems to be registered as Greek Omega
// (U+03A9) in the units
String unitStrRepl = unitStr.replace((char) 0x2126, (char) 0x03A9);
Unit<?> parsedUnit = Units.getInstance().getUnit(unitStrRepl);
// Unit<?> parsedUnit = Units.getInstance().getUnit(unitStrRepl);
Unit<?> parsedUnit = SimpleUnitFormat.getInstance().parse(unitStrRepl);
channelType = "Number:" + UnitUtils.getDimensionName(parsedUnit);
unitData = new UnitAndType(parsedUnit, channelType);
} catch (MeasurementParseException mpe) {
Expand Down

0 comments on commit 4fa7406

Please sign in to comment.