HwmonTempMain: fix sensor index of Name1

For pressure and humidity sensors are using Name1 as sensor name, and it
needs manually assign the index to 2 for the thresholds config works correctly

Tested EM conifg:
{
    "Address": "0x40",
    "Bus": 10,
    "Name": "FRONT_PANEL_TEMP",
    "Name1": "FRONT_PANEL_HUMIDTY",
    "Thresholds": [
        {
            "Direction": "greater than",
            "Index": 1,
            "Name": "upper critical",
            "Severity": 1,
            "Value": 40
        },
        {
            "Direction": "less than",
            "Index": 1,
            "Name": "lower critical",
            "Severity": 1,
            "Value": 0
        },
        {
            "Direction": "greater than",
            "Index": 2,
            "Name": "upper critical",
            "Severity": 1,
            "Value": 80
        },
        {
            "Direction": "less than",
            "Index": 2,
            "Name": "lower critical",
            "Severity": 1,
            "Value": 10
        }
    ],
    "Type": "HDC1080"
}

Tested Results:
root@bletchley:~# busctl introspect xyz.openbmc_project.HwmonTempSensor /xyz/openbmc_project/sensors/temperature/FRONT_PANEL_TEMP xyz.openbmc_project.Sensor.Threshold.Critical
NAME                                          TYPE      SIGNATURE RESULT/VALUE FLAGS
.CriticalAlarmHigh                            property  b         false        emits-change
.CriticalAlarmLow                             property  b         false        emits-change
.CriticalHigh                                 property  d         40           emits-change writable
.CriticalLow                                  property  d         0            emits-change writable
root@bletchley:~# busctl introspect xyz.openbmc_project.HwmonTempSensor /xyz/openbmc_project/sensors/humidity/FRONT_PANEL_HUMIDTY xyz.openbmc_project.Sensor.Threshold.Critical
NAME                                          TYPE      SIGNATURE RESULT/VALUE FLAGS
.CriticalAlarmHigh                            property  b         false        emits-change
.CriticalAlarmLow                             property  b         false        emits-change
.CriticalHigh                                 property  d         80           emits-change writable
.CriticalLow                                  property  d         10           emits-change writable

Signed-off-by: Potin Lai <potin.lai@quantatw.com>
Change-Id: I6ae1c007729b884acde56ecc83b6c8b88ea1bc81
diff --git a/src/HwmonTempMain.cpp b/src/HwmonTempMain.cpp
index 388a7a4..166e407 100644
--- a/src/HwmonTempMain.cpp
+++ b/src/HwmonTempMain.cpp
@@ -337,10 +337,12 @@
 
                 // Temperature has "Name", pressure has "Name1"
                 auto findSensorName = baseConfigMap.find("Name");
+                int index = 1;
                 if (thisSensorParameters.typeName == "pressure" ||
                     thisSensorParameters.typeName == "humidity")
                 {
                     findSensorName = baseConfigMap.find("Name1");
+                    index = 2;
                 }
 
                 if (findSensorName == baseConfigMap.end())
@@ -375,13 +377,12 @@
                 }
 
                 std::vector<thresholds::Threshold> sensorThresholds;
-                int index = 1;
 
                 if (!parseThresholdsFromConfig(sensorData, sensorThresholds,
                                                nullptr, &index))
                 {
                     std::cerr << "error populating thresholds for "
-                              << sensorName << " index 1\n";
+                              << sensorName << " index " << index << "\n";
                 }
 
                 auto findPollRate = baseConfigMap.find("PollRate");