@@ -154,9 +154,10 @@ def read_from_eeprom(self, hex_address, size):
154154
155155 def write_to_eeprom (self , hex_address , size , data ):
156156 '''Writes to EEPROM the `size` number of bytes starting at the
157- `hex_address` with the given `data`. `data` needs to be bytes.'''
157+ `hex_address` with the given `data`. `data` needs to be bytes. CRC will be automatically added. '''
158158 self .send ("EEBWR %s %.2d\n " % (hex_address , size ), self .ACK )
159- self .send (data )
159+ data_with_crc = VantageProCRC (data ).data_with_checksum
160+ self .send (data_with_crc , self .ACK )
160161
161162 def gettime (self ):
162163 '''Returns the current datetime of the console.'''
@@ -307,6 +308,14 @@ def newsetup(self) -> None:
307308 self .wake_up ()
308309 self .send ("NEWSETUP" , self .ACK )
309310
311+ def set_rain_collector (self , type ) -> None :
312+ '''Set rain collector type. 0x00 = 0.01", 0x10 = 0.2mm, 0x20 = 0.1mm'''
313+ setup_bits = struct .unpack (b"B" , self .read_from_eeprom ("2B" , 1 ))[0 ] # type: ignore
314+ setup_bits = (setup_bits & 0xCF ) | type
315+ data = struct .pack (b'>B' , setup_bits )
316+ self .write_to_eeprom ("2B" , 1 , data )
317+ self .newsetup ()
318+
310319 @cached_property
311320 def archive_period (self ):
312321 '''Returns number of minutes in the archive period.'''
0 commit comments