{"action":"created","issue":{"url":"https://api.github.com/repos/OpenSource-EBike-firmware/TongSheng_TSDZ2_motor_controller_firmware/issues/12","repository_url":"https://api.github.com/repos/OpenSource-EBike-firmware/TongSheng_TSDZ2_motor_controller_firmware","labels_url":"https://api.github.com/repos/OpenSource-EBike-firmware/TongSheng_TSDZ2_motor_controller_firmware/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/OpenSource-EBike-firmware/TongSheng_TSDZ2_motor_controller_firmware/issues/12/comments","events_url":"https://api.github.com/repos/OpenSource-EBike-firmware/TongSheng_TSDZ2_motor_controller_firmware/issues/12/events","html_url":"https://github.com/OpenSource-EBike-firmware/TongSheng_TSDZ2_motor_controller_firmware/issues/12","id":352880180,"node_id":"MDU6SXNzdWUzNTI4ODAxODA=","number":12,"title":"Watt Hours does not reset","user":{"login":"jbalat","id":551275,"node_id":"MDQ6VXNlcjU1MTI3NQ==","avatar_url":"https://avatars3.githubusercontent.com/u/551275?v=4","gravatar_id":"","url":"https://api.github.com/users/jbalat","html_url":"https://github.com/jbalat","followers_url":"https://api.github.com/users/jbalat/followers","following_url":"https://api.github.com/users/jbalat/following{/other_user}","gists_url":"https://api.github.com/users/jbalat/gists{/gist_id}","starred_url":"https://api.github.com/users/jbalat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbalat/subscriptions","organizations_url":"https://api.github.com/users/jbalat/orgs","repos_url":"https://api.github.com/users/jbalat/repos","events_url":"https://api.github.com/users/jbalat/events{/privacy}","received_events_url":"https://api.github.com/users/jbalat/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-08-22T09:49:51Z","updated_at":"2018-08-22T10:12:22Z","closed_at":null,"author_association":"NONE","body":"My 10s battery should charge to 42v but it only charges to 41.5v\r\nIs the watt hour display supposed to reset after you charge the battery ?\r\nHow do you reset the trip meter ?"},"comment":{"url":"https://api.github.com/repos/OpenSource-EBike-firmware/TongSheng_TSDZ2_motor_controller_firmware/issues/comments/414983137","html_url":"https://github.com/OpenSource-EBike-firmware/TongSheng_TSDZ2_motor_controller_firmware/issues/12#issuecomment-414983137","issue_url":"https://api.github.com/repos/OpenSource-EBike-firmware/TongSheng_TSDZ2_motor_controller_firmware/issues/12","id":414983137,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNDk4MzEzNw==","user":{"login":"casainho","id":147128,"node_id":"MDQ6VXNlcjE0NzEyOA==","avatar_url":"https://avatars2.githubusercontent.com/u/147128?v=4","gravatar_id":"","url":"https://api.github.com/users/casainho","html_url":"https://github.com/casainho","followers_url":"https://api.github.com/users/casainho/followers","following_url":"https://api.github.com/users/casainho/following{/other_user}","gists_url":"https://api.github.com/users/casainho/gists{/gist_id}","starred_url":"https://api.github.com/users/casainho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/casainho/subscriptions","organizations_url":"https://api.github.com/users/casainho/orgs","repos_url":"https://api.github.com/users/casainho/repos","events_url":"https://api.github.com/users/casainho/events{/privacy}","received_events_url":"https://api.github.com/users/casainho/received_events","type":"User","site_admin":false},"created_at":"2018-08-22T10:12:22Z","updated_at":"2018-08-22T10:12:22Z","author_association":"CONTRIBUTOR","body":"LCD3 calculates and manages Watt Hours. Here is the piece of code on LCD3 that do that management of reset:\r\n\r\n```\r\nuint8_t first_time_management (void)\r\n{\r\n  uint8_t ui8_status = 0;\r\n\r\n  // don't update LCD up to we get first communication package from the motor controller\r\n  if (ui8_motor_controller_init &&\r\n      (uart_received_first_package () == 0))\r\n  {\r\n    ui8_status = 1;\r\n  }\r\n  // this will be executed only 1 time at startup\r\n  else if (ui8_motor_controller_init)\r\n  {\r\n    ui8_motor_controller_init = 0;\r\n\r\n    // reset Wh value if battery is over 54.4V (when battery is near fully charged)\r\n    if (((uint32_t) motor_controller_data.ui16_adc_battery_voltage * ADC_BATTERY_VOLTAGE_PER_ADC_STEP_X10000) > 544000)\r\n    {\r\n      configuration_variables.ui32_wh_x10_offset = 0;\r\n    }\r\n  }\r\n\r\n  return ui8_status;\r\n}\r\n```\r\nMaybe we can add this reset voltage value as an option on LCD? Or calc it based on the cells number? what do you think?"}}
{"actor":{"display_login":"casainho"}}