Kaynağa Gözat

SlotState mock data added for testing

namrota ghosh 7 ay önce
ebeveyn
işleme
65fb481855
1 değiştirilmiş dosya ile 5 ekleme ve 2 silme
  1. 5 2
      mock_setup.c

+ 5 - 2
mock_setup.c

@@ -5,11 +5,11 @@
 #include <stdio.h>
 #include "mock_setup.h"
 
-//Declare the extern variables for mock testing
+//Testing:: Declare the extern variables for mock testing, comment it out in production
 txPacket tx_packet;
 rxPacket rx_packet;
 
-//mock I2C HAL functions which will be used to test the controller functions
+//mock I2C HAL functions which will be used to test the controller functions, since the target board is not available
 bool mock_i2c_write(uint8_t const TARGET_ADDRESS)
 {   
     printf("[I2C Mock]Write to target 0x%02X\n", TARGET_ADDRESS);
@@ -54,6 +54,7 @@ void test_Controller_GetBatteryMeasurement()
     measurement.voltage = 350; // Example voltage
     measurement.current = 10; // Example current
     measurement.temperature = 25; // Example temperature
+    measurement.slot_state = SLOT_STATE_OK; // Example slot state
     // Check if the function returns success
     rx_packet.rxBuffer[0] = measurement.voltage & 0xFF; // Voltage LSB
     rx_packet.rxBuffer[1] = (measurement.voltage >> 8) & 0xFF; // Voltage MSB
@@ -61,6 +62,8 @@ void test_Controller_GetBatteryMeasurement()
     rx_packet.rxBuffer[3] = (measurement.current >> 8) & 0xFF; // Current MSB
     rx_packet.rxBuffer[4] = measurement.temperature & 0xFF; // Temperature LSB
     rx_packet.rxBuffer[5] = (measurement.temperature >> 8) & 0xFF; // Temperature MSB
+    rx_packet.rxBuffer[6] = measurement.slot_state & 0xFF; // Slot state LSB
+    rx_packet.rxBuffer[7] = (measurement.slot_state >> 8) & 0xFF; // Slot state MSB
     rx_packet.rxLen = 6;
 
     // Call the function to get battery measurement