Old fashion design for PC-104
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1.3 KiB

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. //----------------------------------------------------------------------------
  2. // Laser Guard Ltd.
  3. // Copyright � 2000-2002. All Rights Reserved.
  4. // Version 1.0 01/01/2000
  5. // Last modification: 08/10/2003
  6. // PROJECT:
  7. // SUBSYSTEM:
  8. // FILE: voltage.cpp
  9. // AUTHOR: Sergey Chizhevskiy
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Source file of RELAY.CPP
  13. //----------------------------------------------------------------------------
  14. #include "voltage.h"
  15. void CVoltage::Invalidate( BOOL bVoltageOK )
  16. {
  17. // if voltage control disabled
  18. if( !m_VoltageParameters.bControl )
  19. return;
  20. // update power state
  21. if( bVoltageOK )
  22. {
  23. if( m_nBoardVoltageValue < +1000 )
  24. m_nBoardVoltageValue++;
  25. else
  26. {
  27. if( !m_bBoardVoltage )
  28. {
  29. m_bBoardVoltage = TRUE;
  30. m_bBoardVoltageChanged = TRUE;
  31. }
  32. }
  33. }
  34. else
  35. {
  36. if( m_nBoardVoltageValue > -1000 )
  37. m_nBoardVoltageValue--;
  38. else
  39. {
  40. if( m_bBoardVoltage )
  41. {
  42. m_bBoardVoltage = FALSE;
  43. m_bBoardVoltageChanged = TRUE;
  44. }
  45. }
  46. }
  47. }
  48. // protocol processing
  49. BOOL CVoltage::GetVoltage()
  50. {
  51. // clear notification flag
  52. m_bBoardVoltageChanged = FALSE;
  53. return m_bBoardVoltage;
  54. }
  55. void CVoltage::OnProtocolLgsState2Command( BYTE& bFlags )
  56. {
  57. if( m_bBoardVoltageChanged )
  58. bFlags |= LGS::S2_ITF_VOLTAGE;
  59. }